Ken2k7 Posted August 25, 2007 Share Posted August 25, 2007 I keep getting this error: Parse error: syntax error, unexpected T_VARIABLE in /hosted/subs/ulmb.com/a/l/alpha/public_html/game/index.php on line 13 I don't know why. Here's the code: <?php session_start(); define("OPEN", 1); include "config.php"; include "classes.php"; if ($_POST['submit']) { $_SESSION['name'] = $_POST['name']; $_SESSION['pass'] = $_POST['pass']; $error = "The username and password are incorrect.<br />If you are not registered, please <a href='register.php'>register</a>; otherwise, try again." $query = mysql_query("SELECT * FROM member WHERE name='{$_SESSION['name']}'"); $row = mysql_fetch_assoc($query); if (mysql_num_rows($query) == 0) echo "The username does not exist. Please register."; else if ($query['name'] == $_SESSION['name']) if ($query['password'] == sha1($_SESSION['pass'])) header("Location: {$_SESSION['name']}"); else echo error; else eccho error; } if (isset($_SESSION['name'])) header("Location: {$_SESSION['name']}"); else echo "<title>Coder's Alliance</title> <h1>Coder's Alliance Login</h1> <form action='$PHP_SELF' method='post'> Username: <input type='text' name='name' size='40' length='40'><br /> Password: <input type='text' name='pass' size='40' length='40'><br /> <input type='submit' name='submit' value='Submit'> <input type='reset' name='reset' value='Clear It'> </form>"; ?> Link to comment https://forums.phpfreaks.com/topic/66619-solved-error/ Share on other sites More sharing options...
beboo002 Posted August 25, 2007 Share Posted August 25, 2007 try this code Link to comment https://forums.phpfreaks.com/topic/66619-solved-error/#findComment-333765 Share on other sites More sharing options...
Ken2k7 Posted August 25, 2007 Author Share Posted August 25, 2007 try this code ??? Link to comment https://forums.phpfreaks.com/topic/66619-solved-error/#findComment-333766 Share on other sites More sharing options...
beboo002 Posted August 25, 2007 Share Posted August 25, 2007 opps sorry <?php ob_start(); session_start(); define("OPEN", 1); include "config.php"; include "classes.php"; if ($_POST['submit']) { $_SESSION['name'] = $_POST['name']; $_SESSION['pass'] = $_POST['pass']; $error = "The username and password are incorrect.<br />If you are not registered, please <a href='register.php'>register</a>; otherwise, try again."; $query = mysql_query("SELECT * FROM member WHERE name= ''".$_SESSION['username']."'"); $row = mysql_fetch_assoc($query); if (mysql_num_rows($query) == 0) { echo "The username does not exist. Please register."; } else if ($query['name'] == $_SESSION['name']) { if ($query['password'] == sha1($_SESSION['pass'])) header("Location: {$_SESSION['name']}"); } else { echo "error"; } } else { echo "error"; } if (isset($_SESSION['name'])) header("Location: {$_SESSION['name']}"); else echo "<title>Coder's Alliance</title> <h1>Coder's Alliance Login</h1> <form action='$PHP_SELF' method='post'> Username: <input type='text' name='name' size='40' length='40'><br /> Password: <input type='text' name='pass' size='40' length='40'><br /> <input type='submit' name='submit' value='Submit'> <input type='reset' name='reset' value='Clear It'> </form>"; ?> Link to comment https://forums.phpfreaks.com/topic/66619-solved-error/#findComment-333767 Share on other sites More sharing options...
Ken2k7 Posted August 25, 2007 Author Share Posted August 25, 2007 Nope. Adding ob_start(); didn't help. Link to comment https://forums.phpfreaks.com/topic/66619-solved-error/#findComment-333770 Share on other sites More sharing options...
beboo002 Posted August 25, 2007 Share Posted August 25, 2007 in my machine it give this output plz check Warning: Failed opening 'config.php' for inclusion (include_path='.;c:\apache\php\pear') in c:\apache\htdocs\abhishek\t.php on line 6 Warning: Failed opening 'classes.php' for inclusion (include_path='.;c:\apache\php\pear') in c:\apache\htdocs\abhishek\t.php on line 7 this warning come out bcoz i hav no database connect plz cut and paste above code surly it work try it Link to comment https://forums.phpfreaks.com/topic/66619-solved-error/#findComment-333772 Share on other sites More sharing options...
beboo002 Posted August 25, 2007 Share Posted August 25, 2007 wht happend???? Link to comment https://forums.phpfreaks.com/topic/66619-solved-error/#findComment-333775 Share on other sites More sharing options...
Ken2k7 Posted August 25, 2007 Author Share Posted August 25, 2007 Nothing, that's the problem. It doesn't work Link to comment https://forums.phpfreaks.com/topic/66619-solved-error/#findComment-333777 Share on other sites More sharing options...
beboo002 Posted August 25, 2007 Share Posted August 25, 2007 is there session value reach in select query plz echo the select query and also echo the session value Link to comment https://forums.phpfreaks.com/topic/66619-solved-error/#findComment-333779 Share on other sites More sharing options...
Ken2k7 Posted August 25, 2007 Author Share Posted August 25, 2007 is there session value reach in select query please echo the select query and also echo the session value I can't do that because the php page doesn't even run; thus I can't echo anything. I just keep getting that stupid error. Link to comment https://forums.phpfreaks.com/topic/66619-solved-error/#findComment-333781 Share on other sites More sharing options...
micmania1 Posted August 25, 2007 Share Posted August 25, 2007 Look at the end of line 12. You have missed the semi-colon off the end thus giving an error on line 13. Your script should work fine once you've changed that. Link to comment https://forums.phpfreaks.com/topic/66619-solved-error/#findComment-333782 Share on other sites More sharing options...
Ken2k7 Posted August 25, 2007 Author Share Posted August 25, 2007 Wow, thanks. Funny thing is I just found that out myself too. PHP should really give better errors. Link to comment https://forums.phpfreaks.com/topic/66619-solved-error/#findComment-333784 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.