Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.