Jump to content

This WAS working fine?


desjardins2010

Recommended Posts

This script was working fine yesterday i havn't changed anything?? not it don't register the user upon completing the script no error, just when you hit submit it refreshes and does nothing?

 

<?php
//check for submit
$submit =$_POST['submit'];

//gather POST variable
$fullname =strip_tags($_POST['fullname']);
$email =strip_tags($_POST['email']);
$username =strip_tags($_POST['username']);

$password =strip_tags($_POST['password']);
$password2 =strip_tags($_POST['password2']);


if ($submit) 
{
//check that fields were filled in
if ($fullname&&$email&&$username&&$password&&$password2)
{
//check to see if our two password fields match	
if ($password==$password2) 

{
$password = md5($password);

// register the user
//open database
$connect = mysql_connect("localhost", "root", "");
mysql_select_db("users");


//begine insert
$queryreg = mysql_query("INSERT INTO members VALUES ('','inet_aton('127.0.0.1')','$fullname','$email','$username','$password')");
if ($queryreg) {
echo "Thanks, For Registering! Click <a href=\"index.php\">HERE</a>To Login!";
}

}

//otherwise if passwords don't match
else {
echo "<font color='red'>The passwords you entered do not match</font>";
//end of checking password	
}

}		

else {
echo "<font color='red'>Please enter all fields!</font>";
}

}

//end check for submit 
?>
<form action='testreg.php' method="post">
<table align="center">
<tr>
    	<td>
    	Your Full Name:
        </td>
        <td>
        <input type="text" name="fullname" value="<?php echo $fullname; ?>">        
        </td>
    </tr>
    	<tr>
    	<td>
    	Email Address:
        </td>
        <td>
        <input type="text" name="email" value="<?php echo $email; ?>">        
        </td>
    	<tr>
    	<td>
    	Choose Username:
        </td>
        <td>
        <input type="text" name="username" value="<?php echo $username; ?>">        
        </td>
    </tr>
    	<tr>
    	<td>
    	Password:
        </td>
        <td>
        <input type="password" name="password">        
        </td>
    </tr>
    	<tr>
    	<td>
    	Retype Password:
        </td>
        <td>
        <input type="password" name="password2">        
        </td>
    </tr>
</table>
<p>
<center><input type="submit" name="submit" value="Register"></center>

</form>

Link to comment
https://forums.phpfreaks.com/topic/221675-this-was-working-fine/
Share on other sites

In your code, when the query fails due to any kind of error, you don't do anything, so you don't know that an error occured.

 

Also, inet_aton() is a mysql function in the query statement. It does not get enclosed in single-quotes as that would make it a piece of string data - the characters - i n e t _ a t o n ( ... in a string.

Archived

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

×
×
  • Create New...

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.