This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-09-15 11:12:55

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

PHP Userpage Maker Help

So far I have this code, but it says "Error at line 16":

Code:

<title>Scratch User Panel 1.0</title>
<?php
if(!isset($_POST['submit'])){ ?>
    <form action="userpage_creator.php" method="post" name="userpageCreator">
    Username: <input type="text" name="username" />
    Status: <input type="radio" name="status" value="New Scratcher" />New Scatcher<br />
    <input type="radio" name="status" value="Scratcher" />Scratcher<br />
    <input type="submit" name = "submit" value = "View Source"/>
    </form>
    <html>
    <head>
    <?php
}
if(isset($_POST['submit'])){
        
        <?php echo "
        Username:" . $_POST['username'] . "
        Account Type:" . $_POST['status'] . "
        Status: [img]http://blocks.scratchr.org/API.php?action=onlineStatus&type=text&user=" . $_POST['username'] . "[/img]
        Newest Project: [url=http://blocks.scratchr.org/API.php?action=projects&type=newest&return=link&user=" . $_POST['username']. "][...][/url]
        Newest Friend: [url=http://www.blocks.scratchr.org/API.php?action=friends&type=newest&return=link&user=" . $_POST['username']. "][...][/url]"
        ?>
        <?php
    }
}
?>

http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#2 2011-09-15 11:14:23

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: PHP Userpage Maker Help

...
<?php
}
if(isset($_POST['submit'])){
       
        <?php echo "
...

^^^^ You put a php tag inside a php tag ¬_¬ Simply get rid of the second <?php

If you got notepad++ you'd notice it yourself because the colouring would look wrong (Hint hint :P )

You could also delete lines 22 and 23 (?> <?php) because there's nothing between them.

Last edited by sparks (2011-09-15 11:18:59)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#3 2011-09-15 11:18:58

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: PHP Userpage Maker Help

Done that but:

Parse error: syntax error, unexpected '<' in /home/a5292800/public_html/userpage_creator.php on line 16


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#4 2011-09-15 11:19:38

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: PHP Userpage Maker Help

Repost your code as it looks now. Are you sure you deleted the whole <?php and didn't just leave the <?

Last edited by sparks (2011-09-15 11:20:06)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#5 2011-09-15 11:22:12

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: PHP Userpage Maker Help

Code:

<title>Scratch User Panel 1.0</title>
<?php
if(!isset($_POST['submit'])){ ?>
    <form action="userpage_creator.php" method="post" name="userpageCreator">
    Username: <input type="text" name="username" />
    Status: <input type="radio" name="status" value="New Scratcher" />New Scatcher<br />
    <input type="radio" name="status" value="Scratcher" />Scratcher<br />
    <input type="submit" name = "submit" value = "View Source"/>
    </form>
    <html>
    <head>
    <?php
}
if(isset($_POST['submit'])){
        
        echo "
        Username:" . $_POST['username'] . "
        Account Type:" . $_POST['status'] . "
        Status: [img]http://blocks.scratchr.org/API.php?action=onlineStatus&type=text&user=" . $_POST['username'] . "[/img]
        Newest Project: [url=http://blocks.scratchr.org/API.php?action=projects&type=newest&return=link&user=" . $_POST['username']. "][...][/url]
        Newest Friend: [url=http://www.blocks.scratchr.org/API.php?action=friends&type=newest&return=link&user=" . $_POST['username']. "][...][/url]"
        
    }
}
?>

Now it says "Parse error: syntax error, unexpected '}', expecting ',' or ';' in /home/a5292800/public_html/userpage_creator.php on line 23
"

You can check here for error updates!: http://plaxon.comyr.com/userpage_creator.php


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#6 2011-09-15 11:24:53

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: PHP Userpage Maker Help

You forgot to finish your echo with a ";". The error message tells you what you're looking for. It's found a } when it's not expecting it which either means you have too many of them (Although then you often get the message "unexpected $end". In this case the } was unexpected because it's still waiting for the ;. Since it actually tells you what it's expecting you can easily look around the line number given to spot where a , or ; should have gone.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#7 2011-09-15 11:28:16

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: PHP Userpage Maker Help

I removed the } it told me to remove on line 23, but it still says the error.


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#8 2011-09-15 11:28:48

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: PHP Userpage Maker Help

where did you learn reading?

unexpected '}' means the '}' doesn't belong to there.
expecting ',' or ';' means you have to put one of these.... -.-

sorry for being a bit rude, but it really sometimes annoys when you just post an error message and cry for help while you could easily find it out yourself

Last edited by roijac (2011-09-15 16:12:36)

Offline

 

#9 2011-09-15 11:43:00

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: PHP Userpage Maker Help

WE, you don't remove the }, you add a ; after the echo command that you missed out (end of line 22)  smile

Please get notepad++! It makes errors really apparent!

Last edited by sparks (2011-09-15 11:46:18)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#10 2011-09-15 12:57:23

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: PHP Userpage Maker Help

sparks wrote:

WE, you don't remove the }, you add a ; after the echo command that you missed out (end of line 22)  smile

Please get notepad++! It makes errors really apparent!

I have notepad++ and it's great! Thanks, that's what I forgot to put the ; at the end  smile


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#11 2011-09-15 13:30:01

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: PHP Userpage Maker Help

Good good, once you save a file as .html or .php it should start colour coding  smile

I find it hurts my eyes to look at the while textarea for too long so I tend to use the 'bespin' style under settings > Style Configurator. You might spot a style you like there  big_smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#12 2011-09-15 13:31:55

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: PHP Userpage Maker Help

Ok! I don't find it hurting my eyes though. By the way, how do I make a global variable, so that if it changes on one pc online, it changes on all pcs?


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#13 2011-09-15 13:37:00

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: PHP Userpage Maker Help

Bye the way, I made the thing now! You can see it here: http://plaxon.comyr.com/userpage_creator.php

I made it to help people make their own forum userpages  smile
(See this post.)


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#14 2011-09-15 14:16:01

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: PHP Userpage Maker Help

That site leads to a webhost 404


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#15 2011-09-15 14:26:19

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: PHP Userpage Maker Help

big_smile  good going @WindowsExplorer  ,  i want to suggest Aptana Studio 3 over Notepad++ it also helps u by assisting with function calls and stuff much ahead of notepad++ ,, but then aptana is a pure web-development ide.


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#16 2011-09-15 14:27:39

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: PHP Userpage Maker Help

sparks wrote:

That site leads to a webhost 404

website wrote:

Website Under Review

You are seeing this page because the system administrator of 000webhost.com is currently checking this website for malicious content. This redirect page will be removed once we finish manually checking all files on this account. Since we check over 100 websites per day, it can take about 2-4 hours to complete. If you are the owner of this website, you will get an email confirmation once it's done. If you are a visitor, please come back later.

www.000webhost.com is the most popular free web hosting provider, and as such, suffers from abusers. Around 5% of users sign up here just to start hacking or phishing websites or causing other problems. So, in order to survive, we must monitor what our users are hosting.

We are sorry for the inconvenience, but checking all content manually is the only way to provide you with the most secure and reliable service. If you find any illegal websites on our network, you can report it here.

Thats what it says to me now


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#17 2011-09-15 14:29:31

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: PHP Userpage Maker Help

I don't see that...


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#18 2011-09-15 14:40:13

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: PHP Userpage Maker Help

I do...


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#19 2011-09-15 15:25:06

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: PHP Userpage Maker Help

How do I set a variable to the pc's ip address? I searched it, but none of them worked  sad


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#20 2011-09-15 15:44:36

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: PHP Userpage Maker Help

WindowsExplorer wrote:

How do I set a variable to the pc's ip address? I searched it, but none of them worked  sad

Code:

$ip = $_SERVER['REMOTE_ADDR'];

Works for me.


/* No comment */

Offline

 

#21 2011-09-15 15:52:19

cskidmsonic
Scratcher
Registered: 2011-01-22
Posts: 100+

Re: PHP Userpage Maker Help

TheSuccessor wrote:

WindowsExplorer wrote:

How do I set a variable to the pc's ip address? I searched it, but none of them worked  sad

Code:

$ip = $_SERVER['REMOTE_ADDR'];

Works for me.

[offtopic]YOU'RE BACK!!!![/offtopic]


This signature is TDD's fault... yes, I had to.

Offline

 

#22 2011-09-15 16:00:03

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: PHP Userpage Maker Help

cskidmsonic wrote:

TheSuccessor wrote:

WindowsExplorer wrote:

How do I set a variable to the pc's ip address? I searched it, but none of them worked  sad

Code:

$ip = $_SERVER['REMOTE_ADDR'];

Works for me.

[offtopic]YOU'RE BACK!!!![/offtopic]

Yep!  big_smile


/* No comment */

Offline

 

#23 2011-09-15 16:09:25

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: PHP Userpage Maker Help

roijac wrote:

where did you learn reading?

unexpected '}' means the '}' doesn't belong to there.
expecting ',' or ';' means you have to put one of these.... -.-

sorry for being a bit rude, but it really sometimes annoys when you just post an error message and cry for help while you could easily fins it out yourself

+1  hmm

Offline

 

#24 2011-09-15 16:38:33

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: PHP Userpage Maker Help

roijac wrote:

where did you learn reading?

unexpected '}' means the '}' doesn't belong to there.
expecting ',' or ';' means you have to put one of these.... -.-

sorry for being a bit rude, but it really sometimes annoys when you just post an error message and cry for help while you could easily fins it out yourself

You know, I only started PHP a few days ago, so it doesn't help much to be a bit rude.


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#25 2011-09-16 03:37:45

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: PHP Userpage Maker Help

Also, how do I make a text to image thing work. None of the tutorials that I found worked  sad


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

Board footer