View Single Post
  #2 (permalink)  
Old 06-30-09, 01:48 AM
=OTS=G-Man =OTS=G-Man is offline
Newbie Coder
 
Join Date: Jun 2009
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
seems easy enough
PHP Code:

<?php
// Check if he wants to register:  
if (!empty($_POST[username]))  
{  
    
// Check if passwords match.  
    
if ($_POST['password'] != $_POST['password2'])  
        exit(
"Error - Passwords don't match. Please go back and try again.");  

    if (
$_POST['email'] != $_POST['email2'])
        exit(
"Error - Emails don't match. Please go back and try again.");


    
// Assign some variables.  
    
$date mktime("d - m - Y");  
    
$ip $_SERVER['REMOTE_ADDR'];  

    require_once(
"connect.php");  

    
// Register him.  
    
$query mysql_query("INSERT INTO members   
    (username, email, password, date, ip)  
    VALUES    ('"
.$_POST['username']."','".$_POST['email']."','".$_POST['password']."','$date','$ip')")  
    or die (
"Error - Couldn't register user.");  
      
    echo 
"Welcome $_POST[username]! You've been successfully reigstered!<br /><br />  
        Please login <a href='login.php'><b>here</b></a>."
;  
    exit();  
}  

?>  

<html>  
    <head>  
        <title>Register</title>  
    </head>  
    <body>  
        <form action="register.php" method="post">  
            <table width="75%" border="1" align="center" cellpadding="3" cellspacing="1">  
                <tr>  
                    <td width="100%"><h5>Registration</h5></td>  
                </tr>  
                <tr>  
                    <td width="100%"><label>Desired Username: <input type="text" name="username" size="25" value="<? echo $_POST['username']; ?>"></label></td>  
                </tr>  
                <tr>  
                    <td width="100%"><label>Email: <input type="text" name="email" size="25" value="<? echo $_POST['email']; ?>"></label></td>  
                </tr>  
                <tr>  
                    <td width="100%"><label>Verify Email: <input type="text" name="email2" size="25"></label></td>  
                </tr>  
                <tr>  
                    <td width="100%"><label>Password: <input type="password" name="password" size="25" value="<? echo $_POST['password']; ?>"></label></td>  
                </tr>  
                <tr>  
                    <td width="100%"><label>Verify Password: <input type="password" name="password2" size="25" value=""></label></td>  
                </tr>  
                <tr>  
                    <td width="100%"><input type="submit" value="Register!"></td>  
                </tr>  
            </table>  
        </form>  
    </body>  
</html>
You will still need to change the database to match the new fields
Reply With Quote