Jump to content


Photo

PHP Membership System problem


  • Please log in to reply
56 replies to this topic

#1 Fruddy

Fruddy
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts

Posted 03 August 2006 - 09:16 AM

I followed the PHP Membership System tutorial, and when i go to the register.php i get this message:
Parse error: parse error, unexpected $ in /home/virtual/my-project.dk/public_html/register.php on line 115


On line 119 is where i close my php tag, ?>

its like theres something wrong the the mail function.


<?
# tip: its always best to have an include file with all your
# database information in one location. I'll post this file next.
include 'database.php';
# grab the POST variables from the HTML form,
# put them into PHP variables so we can work with them
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email_address = $_POST['email_address'];
$username = $_POST['username'];
$info = $_POST['info'];
$first_name = stripslashes($first_name);
$last_name = stripslashes($last_name);
$email_address = stripslashes($email_address);
$username = stripslashes($username);
$info = stripslashes($info);

# Any errors in the posted fields? Lets check...
# If there is an error, then we show the join form again
# so they can fill it out again. If everything
# checks out, then go ahead with your bad self!
if((!$first_name) || (!$email_address) || (!$username)){
    echo 'Du har ikke udfyldt de påkrævede felter! <br />';
    if(!$first_name){
        echo "Fornavn er et påkrævet felt!<br />";
    if(!$email_address){
        echo "Emailadresse er et påkrævet felt!<br />";
    }
    if(!$username){
        echo "Brugernavn er et påkrævet felt!<br />";
    }
    include 'join_form.html';
    exit();
}
    
# does this user already exist in the database? lets check for that now... 
 $sql_email_check = mysql_query("SELECT email_address FROM users WHERE email_address='$email_address'");
 $sql_username_check = mysql_query("SELECT username FROM users WHERE username='$username'");
 
 $email_check = mysql_num_rows($sql_email_check);
 $username_check = mysql_num_rows($sql_username_check);
 
 if(($email_check > 0) || ($username_check > 0)){
     echo "Fix følgende fejl: <br />";
     if($email_check > 0){
         echo "<strong>Emailadressen er allerede blevet taget! Vælg et andet.<br />";
         unset($email_address);
     }
     if($username_check > 0){
         echo "Brugernavnet er allerede blevet taget! Vælg et andet.<br />";
         unset($username);
     }
     include 'join_form.html'; // Show the form again!
     exit();
 }
 
# everything checks out so far, so lets add this user!

/* Random Password generator. Thanks a ton, phpfreak!
http://www.phpfreaks.com/quickcode/Random_Password_Generator/56.php
We'll generate a random password for the
user and encrypt it, email it and then enter it into the db.
*/

function makeRandomPassword() {
  $salt = "abchefghjkmnpqrstuvwxyz0123456789";
  srand((double)microtime()*1000000); 
      $i = 0;
      while ($i <= 7) {
            $num = rand() % 33;
            $tmp = substr($salt, $num, 1);
            $pass = $pass . $tmp;
            $i++;
      }
      return $pass;
}

$random_password = makeRandomPassword();

$db_password = md5($random_password);

/* Enter info into the Database.
I changed a little bit here from phpfreak's awesome tutorial on this subject. When I would get data from the user, I would not get an unencrypted password, only the md5 encrypted one. I couldn't use that, and me being the powertrip guy, I wrote in another little snippet to grab that password before it gets encrypted and stuff it into a blank variable, and write it to the database. Pretty nifty, eh?
*/
$info2 = htmlspecialchars($info);
$sql = mysql_query("INSERT INTO users (first_name, last_name, email_address, username, password, info, signup_date, 

decrypted_password)
        VALUES('$first_name', '$last_name', '$email_address', '$username', '$db_password', '$info2', now(), '$random_password')") or die (mysql_error());

if(!$sql){
    echo 'Det er kommet en fejl. Kontakt webmasteren';
} else {
    $userid = mysql_insert_id();
    // Let's mail the user!
    $subject = "Your Distributor Membership at www.my-project.dk";
    $message = "Dear $first_name $last_name,
    You are now registered at our website, http://www.my-project.dk!
    
    To activate your membership, please login here: http://www.mywebsite.com/distributors_section/login_form.html
    
    Once you activate your membership, you will be able to login with the following information:
    Username: $username
    Password: $random_password
    Please keep this username and password in a location that is easily accessible by you.
    
    Thanks!
    #Fruddy my-project.dk
    
    This is an automated response, please do not reply!";
    
    mail($email_address, $subject, $message, "From: MyWebSite<email@mywebsite.com>\nX-Mailer: PHP/" . phpversion());
}
?>


#2 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 03 August 2006 - 10:10 AM

that error message normaly means that you are missing a { somewhere

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#3 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 03 August 2006 - 10:27 AM

I copied this to view in dreamweaver

Line 25-26 of that text is missing an }
3rd line down in my example
[code=php:0]
if((!$first_name) || (!$email_address) || (!$username)){
    echo 'Du har ikke udfyldt de påkrævede felter! <br />';
    if(!$first_name){
        echo "Fornavn er et påkrævet felt!<br />";
    if(!$email_address){
        echo "Emailadresse er et påkrævet felt!<br />";
    }
    if(!$username){
        echo "Brugernavn er et påkrævet felt!<br />";
    }
    include 'join_form.html';
    exit();
}
[/php
Tell me the problem, I will try tell you the solution

#4 Fruddy

Fruddy
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts

Posted 03 August 2006 - 11:09 AM

Well now the php error message is gone, but:
http://www.my-project.dk/register.php

Its says that this is a resticted area, and its not showing the join_form.php

#5 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 03 August 2006 - 11:18 AM

ok did you change

if((!$first_name) || (!$email_address) || (!$username)){
    echo 'Du har ikke udfyldt de påkrævede felter! <br />';
    if(!$first_name){
        echo "Fornavn er et påkrævet felt!<br />";
    if(!$email_address){
        echo "Emailadresse er et påkrævet felt!<br />";
    }
    if(!$username){
        echo "Brugernavn er et påkrævet felt!<br />";
    }
    include 'join_form.html';
    exit();
}

To

if((!$first_name) || (!$email_address) || (!$username)){
    echo 'Du har ikke udfyldt de påkrævede felter! <br />';
    if(!$first_name){
        echo "Fornavn er et påkrævet felt!<br />";
    }
    if(!$email_address){
        echo "Emailadresse er et påkrævet felt!<br />";
    }
    if(!$username){
        echo "Brugernavn er et påkrævet felt!<br />";
    }
    include ("join_form.html");
    exit;
}

Good luck,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#6 Fruddy

Fruddy
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts

Posted 03 August 2006 - 11:32 AM

Yea i have modified a }


but:

Well now the php error message is gone, but:
http://www.my-project.dk/register.php

Its says that this is a resticted area, and its not showing the join_form.php



#7 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 03 August 2006 - 11:41 AM

no, look at my second example a little closer. You also did not wrap the include in ()

try changing
include("whatever.php");

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#8 Fruddy

Fruddy
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts

Posted 03 August 2006 - 11:48 AM

Ok i have changes the exit; now, but not the big change:
www.my-project.dk/register.php

if((!$first_name) || (!$email_address) || (!$username)){
    echo 'Du har ikke udfyldt de påkrævede felter! <br />';
    if(!$first_name){
        echo "Fornavn er et påkrævet felt!<br />";
    }
    if(!$email_address){
        echo "Emailadresse er et påkrævet felt!<br />";
    }
    if(!$username){
        echo "Brugernavn er et påkrævet felt!<br />";
    }
    include ("http://www.my-project.dk/join.php");
    exit;
}


#9 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 03 August 2006 - 11:56 AM

I get this message after trying to register.
Dit brugernavn og kodeord passer ikke! Eller du har ikke valideret din brugeropretning endnu!
Prøv igen!!

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#10 Fruddy

Fruddy
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts

Posted 03 August 2006 - 11:59 AM

yea, but if u go to www.my-project.dk/register.php

Du har ikke udfyldt de påkrævede felter!
Fornavn er et påkrævet felt!
Emailadresse er et påkrævet felt!
Brugernavn er et påkrævet felt!
Du har ikke rettigheder til det pågældende sted.

You have not rights to view this area.




And the login_form is missing.

#11 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 03 August 2006 - 12:03 PM

ok you need to create a form with the html that will post to this script. The reason that it is showing your error messages is that you are going directly to the register.php instead of the html form

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#12 Fruddy

Fruddy
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts

Posted 03 August 2006 - 12:09 PM

But my join_form contains PHP:


join.php
<?php
# starting the session here
session_start();
if ($_SESSION['email_address'] != "youremail@here.com" ) {
    echo "<b>Du har ikke rettigheder til det pågældende sted.</b><br><br><br>";

# this prevents a user from typing or pasting a URL string
# into their browser to get to this page. If the $first_name
# variable is empty, then they log in like everyone else.
if ( empty( $first_name ) ) {
    print "Please login below!";
    include 'login_form.php';
}
} else { print "
# Here's the HTML form. Pretty simple, cut and dried.
# You should have learned this in day one of HTML class.
# See, this tutorial isn't that hard, is it?!

<form name=form1 method=post action=register.php>
  <table width=100% border=0 cellpadding=4 cellspacing=0>
    <tr>
      <td width=24% align=left valign=top>Fornavn</td>
      <td width=76%><input name=first_name type=text id=first_name2></td>
    </tr>
    <tr>
      <td align=left valign=top>Efternavne</td>
      <td><input name=last_name type=text id=last_name></td>
    </tr>
    <tr>
      <td align=left valign=top>Email</td>
      <td><input name=email_address type=text id=email_address></td>
    </tr>
    <tr>
      <td align=left valign=top>Brugernavn</td>
      <td><input name=username type=text id=username></td>
    </tr>
    <tr>
      <td align=left valign=top>Lidt om dig</td>
      <td><textarea name=info id=info></textarea></td>    </tr>
    <tr>
      <td align=left valign=top> </td>
      <td><input type=submit name=Submit value=opret bruger!></td>
    </tr>
  </table>
"; } ?>

#13 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 03 August 2006 - 12:11 PM

Someone realy needs to write a new member system tutorial. That one is a bit out of date. Give me a few minutes and I will write you a better register script/form and login script/form. Both will be more secure.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#14 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 03 August 2006 - 12:13 PM

2 steps ahead of you

Creating a members area tutorial
Part 1


Part2

Tell me the problem, I will try tell you the solution

#15 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 03 August 2006 - 01:32 PM

Alright here go (sorry it took so long)

here is the register.php

<?php
include("db.php");//your database connection file
array_pop($_POST);
if ( get_magic_quotes_gpc() ) {
    $_POST= array_map('stripslashes', $_POST); 
}
$username = mysql_real_escape_string(trim($_POST['username']));
$first_name = mysql_real_escape_string(trim($_POST['first_name']));
$last_name = mysql_real_escape_string(trim($_POST['last_name']));
$email = mysql_real_escape_string(trim($_POST['email_address']));	    

if ((!$username) || (!first_name) || (!$last_name) || (!email_address)) {
    $message = "info";
    if (!username) {
       $error = "username";
   }
   if (!first_name) {
       $error = "first_name";
   }
   if (!$last_name) {
      $error = "last_name";
   }
   if (!email_address) {
      $error = "email_address";
   }
   include("join.php");
   exit;
}
					
$user_sql = "SELECT COUNT (*) user_match FROM 'users' WHERE 'username' ='$username'";
$email_sql = "SELECT COUNT (*) email_match FROM 'users' WHERE 'email_address' ='$email'";

$res= mysql_query($user_sql) or die(mysql_error());
$result= mysql_query($email_sql) or die(mysql_error());

$user_match= mysql_result($res, 0, 'user_match');
$email_match= mysql_result($result, 0, 'email_match');

if (($user_match > 0) || ($email_match > 0)) {
    if ($username > 0 ) {
        $message = "username_match";
         unset($username) 
    }
    if ($email_match > 0) {
        $message = "email_match";
        unset($email);
    }
    include("join.php");
    exit;
}

function makepassword() { 
  $salt = "abchefghjkmnpqrstuvwxyz0123456789"; 
  srand((double)microtime()*1000000);  
      $i = 0; 
      while ($i <= 7) { 
            $num = rand() % 33; 
            $tmp = substr($salt, $num, 1); 
            $pass = $pass . $tmp; 
            $i++; 
      } 
      return $pass; 
}

$randompwd =  makepassword();
$mdpwd = md5($randompwd);

$sql = mysql_query("INSERT INTO users (first_name, last_name, email_address, username, password, signup_date)
        VALUES('$first_name', '$last_name', '$email_address', '$username', '$mdpwd', now())") or die (mysql_error());
		
					if(!$sql){
    echo 'Det er kommet en fejl. Kontakt webmasteren';
} else {
    $userid = mysql_insert_id();
    // Let's mail the user!
    $subject = "Your Distributor Membership at www.my-project.dk";
    $message = "Dear $first_name $last_name,
    You are now registered at our website, http://www.my-project.dk!
    
    To activate your membership, please login here: http://www.mywebsite.com/distributors_section/login_form.html
    
    Once you activate your membership, you will be able to login with the following information:
    Username: $username
    Password: $random_password
    Please keep this username and password in a location that is easily accessible by you.
    
    Thanks!
    #Fruddy my-project.dk
    
    This is an automated response, please do not reply!";
    
    mail($email_address, $subject, $message, "From: MyWebSite<email@mywebsite.com>\nX-Mailer: PHP/" . phpversion());
}
?>

And here is the form that posts to it.

Join.php


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Join Us</title>
</head>

<body>
<?php
if (($message == "info") || ($message == "email_check") || ($message == "username_check")) {
    if ($message == "info") {
        echo "You did not submit the following information";
	    if ($error == "username") {
	        echo "Username is a required field";
	    }	
	    if ($error == "first_name") {
	        echo "First Name is a required field";
	    }	
	    if ($error == "last_name") {
	        echo "Last name is a required field";
	    }	
	    if ($error == "email_address") {
	        echo "Your email address is a required field";
	    }
    }
    if ($message == "email_check") {
	    echo "You are already a member.";
	}
	if ($message == "username_check") {
	    echo "Your username is already being used by another member. Please try again.";
    }
}						
?>
<form method="post" action="register.php">
  <table width="100%" border="0" cellpadding="4" cellspacing="0">
    <tr> 
      <td width="24%" align="left" valign="top">Fornavn</td>
      <td width="76%"><input name="first_name" type="text" id="first_name2"></td>
    </tr>
    <tr> 
      <td align="left" valign="top">Efternavne</td>
      <td><input name="last_name" type="text" id="last_name"></td>
    </tr>
    <tr> 
      <td align="left" valign="top">Email</td>
      <td><input name="email_address" type="text" id="email_address"></td>
    </tr>
    <tr> 
      <td align="left" valign="top">Brugernavn</td>
      <td><input name="username" type="text" id="username"></td>
    </tr>
      <td align="left" valign="top"> </td>
      <td><input type="submit" name="Submit" value="opret bruger!"></td>
    </tr>
  </table>
</form>  
</body>
</html>


Here is the checkuser.php


<?php
session_start(); 
include ('includes/db.php');
array_pop($_POST); 
if ( get_magic_quotes_gpc() ) { 
    $_POST= array_map('stripslashes', $_POST); 
} 
$username= mysql_real_escape_string(trim($_POST['username'])); 
$password= mysql_real_escape_string(trim($_POST['password']));
$mdpwd= md5($password);

if ((!$username) || (!password)) {
    $message = "login_info";
    include("login.php");
	exit;
}			 

$sql= sprintf("SELECT COUNT(*) AS login_match FROM `users` WHERE `username` = '%s' AND `password`= '%s'", $username, $mdpwd); 
$res= mysql_query($sql) or die(mysql_error()); 
$login_match= mysql_result($res, 0, 'login_match'); 

if ( $login_match == 1 ) { 
    $_SESSION['username']= "$username";
    include("somepage.php");//where ever you want a loged in user to go to
} else { 
    $error ="userinfo";
	include('login.php');
	// not logged in 
}
?>

and here is the form that posts to it.

login.php


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Login Form</title>
</head>

<body>
<?php
if (($message == "login_info") || (!$message == "userinfo") {
    if ($message == "login_info") {
	    echo "You did not enter your username or password. Please try again.";
	}
	if ($message == "userinfo") {
	    echo "Your username and password do not match. Please try again";
	}
}			
?>
<form action="checkuser.php" method="post" name="form1">
  <div align="justify">
    <table width="50%" border="0" align="center" cellpadding="4" cellspacing="0">
      <tr> 
        <td width="20%">Brugernavn</td>
        <td width="80%"><input name="username" type="text" id="username"></td>
      </tr>
      <tr> 
        <td>Kodeord</td>
        <td><input name="password" type="password" id="password"></td>
      </tr>
      <tr> 
        <td> </td>
        <td><input type="submit" name="Submit" value="Submit"></td>
      </td>
    </table>
  </div>
</form>  
</body>
</html>


Hope this helps,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#16 Fruddy

Fruddy
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts

Posted 03 August 2006 - 02:32 PM

Phew! Thansk for the great work Tomfmason!

I think theres missing a end } somewhere, but I cant figure out where  ???
www.my-project.dk/register.php


<?php
include("db.php");//your database connection file
array_pop($_POST);
if ( get_magic_quotes_gpc() ) {
    $_POST= array_map('stripslashes', $_POST); 
}
$username = mysql_real_escape_string(trim($_POST['username']));
$first_name = mysql_real_escape_string(trim($_POST['first_name']));
$last_name = mysql_real_escape_string(trim($_POST['last_name']));
$email = mysql_real_escape_string(trim($_POST['email_address']));
if ((!$username) || (!first_name) || (!$last_name) || (!email_address)) {
    $message = "info";
if (!username) {
    $error = "username";
}
if (!first_name) {
    $error = "first_name";
}
if (!$last_name) {
    $error = "last_name";
}
if (!email_address) {
    $error = "email_address";
}
include("join.php");
exit;
}

$user_sql = "SELECT COUNT (*) user_match FROM 'users' WHERE 'username' ='$username'";
$email_sql = "SELECT COUNT (*) email_match FROM 'users' WHERE 'email_address' ='$email'";

$res= mysql_query($user_sql) or die(mysql_error());
$result= mysql_query($email_sql) or die(mysql_error());

$user_match= mysql_result($res, 0, 'user_match');
$email_match= mysql_result($result, 0, 'email_match');

if (($user_match > 0) || ($email_match > 0)) {
    if ($username > 0 ) {
    $message = "username_match";
unset($username) 
}
if ($email_match > 0) {
    $message = "email_match";
unset($email);
}
include("join.php");
exit;
}
function makepassword() { 
  $salt = "abchefghjkmnpqrstuvwxyz0123456789"; 
  srand((double)microtime()*1000000);  
      $i = 0; 
      while ($i <= 7) { 
            $num = rand() % 33; 
            $tmp = substr($salt, $num, 1); 
            $pass = $pass . $tmp; 
            $i++; 
      } 
      return $pass; 
}
$randompwd =  makepassword();
$mdpwd = md5($randompwd);

$sql = mysql_query("INSERT INTO users (first_name, last_name, email_address, username, password, signup_date)
        VALUES('$first_name', '$last_name', '$email_address', '$username', '$mdpwd', now())") or die (mysql_error());

if(!$sql){
    echo 'Det er kommet en fejl. Kontakt webmasteren';	
} else {
    $userid = mysql_insert_id();
    // Let's mail the user!
    $subject = "Your Distributor Membership at www.my-project.dk";
    $message = "Dear $first_name $last_name,
    You are now registered at our website, http://www.my-project.dk!
    
    To activate your membership, please login here: http://www.mywebsite.com/distributors_section/login_form.html
    
    Once you activate your membership, you will be able to login with the following information:
    Username: $username
    Password: $random_password
    Please keep this username and password in a location that is easily accessible by you.
    
    Thanks!
    #Fruddy my-project.dk
    
    This is an automated response, please do not reply!";
    
    mail($email_address, $subject, $message, "From: MyWebSite<email@mywebsite.com>\nX-Mailer: PHP/" . phpversion());
}
?> 
<script language="JavaScript">
          alert("Du kan nu logge ind!")
          location.href = "http://www.my-project.dk";
</script>


#17 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 03 August 2006 - 02:36 PM

2nd IF statement
if ((!$username) || (!first_name) || (!$last_name) || (!email_address)) {
    $message = "info";
if (!username) {
Tell me the problem, I will try tell you the solution

#18 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 03 August 2006 - 02:42 PM

no that is not it. For some reason the if's get all messed up when posting them. The problem is with the

if (($user_match > 0) || ($email_match > 0)) {
    if ($username > 0 ) {
    $message = "username_match";
unset($username) //<---right here. I forgot a ;
}
if ($email_match > 0) {
    $message = "email_match";
unset($email);
}
include("join.php");
exit;
}

@onlyican

The if statement there is meant to inclose more ifs. so if there is no username,first_name, last_name or email then it will proceed with the ifs and define the error messages.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#19 Fruddy

Fruddy
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts

Posted 03 August 2006 - 02:56 PM

Ok, now theres no error message in the register.php, BUT try to make a user...

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(*) user_match FROM 'users' WHERE 'username' ='sdasa'' at line
:-[ :-[
Is it really that stressfull to make a login system? :-X

#20 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 03 August 2006 - 03:03 PM

It is not stress ful to me. I like a to be challenged. Any way it is another simple error on my part. I keep saying that I am going to test the scripts that I post(so stuff like this won't happen).

change
$user_sql = "SELECT COUNT (*) user_match FROM 'users' WHERE 'username' ='$username'";
$email_sql = "SELECT COUNT (*) email_match FROM 'users' WHERE 'email_address' ='$email'";


To

$user_sql = "SELECT COUNT (*) AS user_match FROM 'users' WHERE 'username' ='$username'";
$email_sql = "SELECT COUNT (*) AS email_match FROM 'users' WHERE 'email_address' ='$email'";

Forgot an AS.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users