Jump to content

Archived

This topic is now archived and is closed to further replies.

stikky

parse error in registration page?

Recommended Posts

Parse error: syntax error, unexpected T_STRING in /home/thecy3/public_html/test/login/enterdata.php on line 29

thats the message i get from the following code when i try to 'register' on this login system i am trying to make for a friend. i have checked all sorts of forums etc, so i realise that it's probably something stupid like a missing quote or bracket, but i just can't find it. if i comment out that line and eveything after it, and do "echo $login", everything works just as expected...so there must be something wrong with the line
      if ($login == "location:firstPage.php") {
what the heck can it be?
oh, and btw, obviously i havn't been able to check what comes after that, so please don't laugh if it's awful...!

"problem.php"
<?php
session_start();
$_SESSION['username'] = $_POST['name'];
$_SESSION['password'] = $_POST['word'];
$name = $_SESSION['username'];
$word = $_SESSION['password'];
$host = "localhost";
$account = "xxxxxxx";
$password = "xxxxxxx";
$dbname = "xxxxxxx";
$connect = mysql_connect($host,$account,$password) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db($dbname) or die ('I cannot select the database because: ' . mysql_error());
$sql = "SELECT * FROM users";
$result = mysql_query($sql,$connect) or die ('I cannot query the database because: ' . mysql_error());
$num = mysql_num_rows($result) or die ('I cannot count the rows because: ' . mysql_error());
$i=0;
while ($i < $num) {
$row = mysql_fetch_array($result) or die ('I cannot fetch the array because: ' . mysql_error());
if ($row[0] == $name) {
    $login = "location:register.php";
      }
else {
    $login = "location:firstPage.php";
      }
$i++;
}
if ($login == "location:firstPage.php") {
        INSERT INTO users ( 'username' , 'password' , 'date' , 'ip' )
        VALUES ('$name', '$word', '', '') or die ('I cannot select insert data to the database because: ' . mysql_error());
}
else {
    $_SESSION['samename'] = "yes";
}
header($login);
exit();
?>
???

Share this post


Link to post
Share on other sites
Yeah, the line after that is just "there" ... where's the string?

Share this post


Link to post
Share on other sites
sorry, i don't understand what you mean. it's supposed to compare $login with the string "location:firstPage.php", and then go on to enter the data to the database if that is so, etc. do you mean the problem is with the code that is supposed to enter the data? i did wonder whether i needed to tell it to contact the DB etc etc all over again first. :-[

Share this post


Link to post
Share on other sites
Do you not see the floating characters?
[code]
if ($login == "location:firstPage.php") {
        INSERT INTO users ( 'username' , 'password' , 'date' , 'ip' )
        VALUES ('$name', '$word', '', '') or die ('I cannot select insert data to the database because: ' . mysql_error());
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.