...

View Full Version : Parse Error



Fashong
06-17-2005, 02:30 AM
Parse error: parse error, unexpected $ in /home2/fashong/public_html/signup.php on line 69



<form method="POST" action="signup.php?action=signup">
Username:<br> <input type="text" name="username" size="20" maxlength="15"><br>
Password:<br> <input type="password" name="password" size="20" maxlength="15"><br>
Verify Password:<br> <input type="password" name="verpassword" size="20" maxlength="15"><br>
Email:<br> <input type="text" name="email" size="20" maxlength="25"><br><br>


Note: Your ip will be logged so please do not make multiple accounts<br><br>
<input type="submit" name="action" value="Signup"></form>



<?php

IF ($action == "signup"){

$ipcheck = mysql_query("select * from users where IP='$IP'");
IF (@mysql_numrows($ipcheck) > 0) {
$ipused = yes;
}else{
$ipused = no;
}

IF ($password == "$verpassword") {
$passwordmatch = yes;
}else{
$passwordmatch = no;
}




IF ($ipused == "no" && $passwordmatch == "yes"){

$userupdate = mysql_query("INSERT INTO users (id, username, email, password, status, ipaddress, age) VALUES ('', '$username', '$email', '$password', '', '$IP', '')");
}else{
echo "You etheir have an account already, or your passwords do not match!";
}

?>

Fashong
06-17-2005, 02:30 AM
Register Globals == 'on' because $username and etc work, no need for $_POST['username']

Nightfire
06-17-2005, 02:32 AM
Need a } before the ?>

Fashong
06-17-2005, 02:48 AM
Thanks

Fashong
06-17-2005, 02:54 AM
It's not inserting into the db now, I will have to check on it tomorrow.

Fashong
06-17-2005, 02:02 PM
Can't figure it out, I do not know what could be wrong, this is wierd.

Nightfire
06-17-2005, 03:17 PM
If you was using superglobals, it'd work ;)

Rename your submit button to something else as by the looks of it, the script is getting confused as to which 'action' variable it's meant to be checking 'signup' exists with, the submit button or the url and I'm guessing it's trying to find 'signup' from the submit button

Kurashu
06-17-2005, 04:01 PM
Register Globals == 'on' because $username and etc work, no need for $_POST['username']

I'd turn that off for secuirty, but then again that's just me.

Fashong
06-17-2005, 04:12 PM
I changed the button value to "submit" and it still doesn't work

Kurashu
06-17-2005, 05:30 PM
Change the name of the button.

Fashong
06-17-2005, 06:54 PM
I changed the button value to "submit" and it still doesn't work

I already did if you had read that (not to be mean or anything)

Nightfire
06-18-2005, 12:30 AM
Have you connected to the db? I only see you querying it, not connecting

Kurashu
06-18-2005, 06:19 AM
He includes a file at the top of the script, I assume that it contains the MySQL connection call.

Taylor_1978
06-18-2005, 08:15 AM
You have a CAPITAL S for Signup in the button form, yet you are looking for action=signup... Make them the same! :-)

Also.. don't have BOTH action=sigun.php?action=signup AND <input type="submit" name="action" value="signup"> You are giving the value twice.. pointless. Just have your action as "signup.php"

Fashong
06-18-2005, 01:40 PM
I know! I changed the value of the submit button to "submit" it still does not work

Fashong
06-18-2005, 01:43 PM
No Errors, doesn't insert or echo anything




<?php
$title = "Signup";
include("top.php");
$IP = $_SERVER['REMOTE_ADDR'];
?>


<div id="content">
<span>Signup</span>


<p>
<form method="POST" action="signup.php?action=signup">
Username:<br> <input type="text" name="username" size="20" maxlength="15"><br>
Password:<br> <input type="password" name="password" size="20" maxlength="15"><br>
Verify Password:<br> <input type="password" name="verpassword" size="20" maxlength="15"><br>
Email:<br> <input type="text" name="email" size="20" maxlength="25"><br><br>


Note: Your ip will be logged so please do not make multiple accounts<br><br>
<input type="submit" name="action" value="submit"></form>



<?php

IF ($action == "signup"){

$ipcheck = mysql_query("select * from users where IP='$IP'");
IF (@mysql_numrows($ipcheck) > 0) {
$ipused = "yes";
}else{
$ipused = "no";
}

IF ($password == "$verpassword") {
$passwordmatch = "true";
}else{
$passwordmatch = "false";
}

IF ($ipused == "no" && $passwordmatch == "true"){

$userupdate = mysql_query("INSERT INTO users (id, username, email, password, status, ipaddress, age) VALUES ('', '$username', '$email', '$password', '', '$IP', '')");
}else{
echo "You etheir have an account already, or your passwords do not match!";
}
}
?>

Kura_kai
06-18-2005, 02:14 PM
If i am correct and if id is the key and auto increments you don't have to mess with that so try this



$userupdate = mysql_query("INSERT INTO users (username, email, password, status, ipaddress, age) VALUES ('$username', '$email', '$password', '', '$IP', '')");

Kura_kai
06-18-2005, 02:20 PM
and what they were saying about the names is here
name="action" for the properties of the submit button. try renaming that part also

Fashong
06-18-2005, 02:39 PM
My update is fine, it worked before I added more stuff. I do not know what is wrong now.

Nightfire
06-18-2005, 02:43 PM
The 4th time this has been said, change the name of the submit button. Changing the value makes no difference

Fashong
06-18-2005, 02:44 PM
Thanks, that was the problem. It was trying to use that action instead..

Fashong
06-18-2005, 02:58 PM
Now, it lets me make more then one account. The ip thing worked before on a poll script I made so it only let you vote once. I do not have a clue on this etheir, any help?

Kurashu
06-18-2005, 03:58 PM
As said before: using the IP as a ways of stopping multiple account creation is ineffective.

Taylor_1978
06-18-2005, 04:05 PM
A little tip: Try to read properly the suggestions being made to you. As mentioned it took 4 attempts to explain to you about the name of the button. I know sometimes when you're scripting for what seems like forever trying to fix an error, its hard to make sense of anything/anyone... but if you don't pay careful attention to what people are suggesting, they will also get frustrated and just not want to help.

Good luck! :thumbsup:

Fashong
06-18-2005, 06:27 PM
Taylor, not to be mean or anything but please read. The button is fixed now and now it's not grabbing the ip right and checking if it's a multi. It doesn't matter if it's inefective it shouldn't let me sign up twice on the same ip.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum