Hi Everyone!
I created a register script that works fine, and creates the correct fields and stuff in the database, but when I go to login, it comes with an error...
The error says:
Parse error: parse error, unexpected $ in /home/public_html/logscript.php on line 61
The error comes up on the logscript.php file (which is linked by a html form (<form action="logscript.php" method="post">...) on a file called login.php)
Here is the code on logscript.php
Also, the "class" ($class) is found in different ROWS in the user table... I created a test user, called "test" and the class is "One".Code:<?php
include("config.php");
// connect to the mysql server
$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());
// select the database
mysql_select_db($database)
or die ("Could not select database because ".mysql_error());
$match = "select id from $table where username = '".$_POST['username']."'
and password = '".$_POST['password']."';";
$qry = mysql_query($match)
or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($qry);
if ($num_rows <= 0) {
echo "Sorry, there is no username $username with the specified password.<br>";
echo "<a href=login.php>Try again</a>";
exit;
} else {
setcookie("loggedin", "TRUE", time()+(3600 * 24));
setcookie("mysite_username", "$username");
if ($class != One) {
echo "You are now logged in as One!<br>";
echo "Continue to the <a href=one/index.php>members</a> section.";
if ($class != Two) {
echo "You are now logged in as Two!<br>";
echo "Continue to the <a href=two/index.php>members</a> section.";
if ($class != Three) {
echo "You are now logged in as Three!<br>";
echo "Continue to the <a href=three/index.php>members</a> section.";
if ($class != Four) {
echo "You are now logged in as Four!<br>";
echo "Continue to the <a href=Four/index.php>members</a> section.";
if ($class != Five) {
echo "You are now logged in as Five!<br>";
echo "Continue to the <a href=Five/index.php>members</a> section.";
if ($class != Six) {
echo "You are now logged in as Six!<br>";
echo "Continue to the <a href=Six/index.php>members</a> section.";
if ($class != Seven) {
echo "You are now logged in as Seven!<br>";
echo "Continue to the <a href=Seven/index.php>members</a> section.";
if ($class != Eight) {
echo "You are now logged in as Eight!<br>";
echo "Continue to the <a href=Eight/index.php>members</a> section.";
?>
Thanks to anyone who takes the time to read my problem and to all who try to help!
