user registration and email activation
<p><strong>I have the following code for registration--</strong></p>

<pre><code>&lt;?php 
 // Connects to your Database 
 mysql_connect("my serner", "user", "password") or die(mysql_error()); 
 mysql_select_db("ec09580") or die(mysql_error()); 
 //This code runs if the form has been submitted
 if (isset($_POST['submit'])) { 
 //This makes sure they did not leave any fields blank
 if(isset($_POST['firstname']) &amp;&amp; isset($_POST['lastname']) &amp;&amp; isset($_POST['email']) &amp;&amp; isset($_POST['username']) &amp;&amp; isset($_POST['pass1']) &amp;&amp; isset($_POST['pass2']))
           {
            $fname = $_POST['firstname'];
            $lname = $_POST['lastname'];

            $email_id = $_POST['email'];

            $username_r = $_POST['username'];
            $password_1 = $_POST['pass'];
            $password_2 = $_POST['pass2'];

//if (!$_POST['firstname'] | !$_POST['lastname'] | !$_POST['email'] | !$_POST['username']| !$_POST['pass2'] ) {

        //die('You did not complete all of the required fields');
        //}

 // checks if the username is in use
    if (!get_magic_quotes_gpc()) {

        $_POST['username'] = addslashes($_POST['username']);
    }
 $usercheck = $_POST['username'];
 $check = mysql_query("SELECT username FROM User WHERE username = '$usercheck'") 
or die(mysql_error());
 $check2 = mysql_num_rows($check);

 //if the name exists it gives an error
 if ($check2 != 0) {
        die('Sorry, the username '.$_POST['username'].' is already in use.');
    }
 // this makes sure both passwords entered match

    if ($_POST['pass'] != $_POST['pass2']) {
        die('Your passwords did not match. ');
    }
    // here we encrypt the password and add slashes if needed

    $_POST['pass'] = md5($_POST['pass']);

    if (!get_magic_quotes_gpc()) {
        $_POST['pass'] = addslashes($_POST['pass']);
        $_POST['username'] = addslashes($_POST['username']);
    }
}
 // now we insert it into the database
    $insert = "INSERT INTO User set FirstName='$fname', LastName='$lname',  Email='$email_id', username='$username_r', password='$password_1'";
    $add_member = mysql_query($insert);
    ?&gt;
 &lt;h1&gt;Registered&lt;/h1&gt;
 &lt;p&gt;Thank you, you have registered - you may now login&lt;/a&gt;.&lt;/p&gt;
 &lt;?php 
 } 
 else 
 {  
 ?&gt;
 &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post"&gt;
 &lt;table border="0"&gt;
 &lt;tr&gt;&lt;td&gt;Firstname:&lt;/td&gt;&lt;td&gt;
 &lt;input type="text" name="firstname" maxlength="60"&gt;
 &lt;/td&gt;&lt;/tr&gt;
 &lt;tr&gt;&lt;td&gt;LastName:&lt;/td&gt;&lt;td&gt;
 &lt;input type="text" name="lastname" maxlength="60"&gt;
 &lt;/td&gt;&lt;/tr&gt;
 &lt;tr&gt;&lt;td&gt;Email:&lt;/td&gt;&lt;td&gt;
 &lt;input type="text" name="email" maxlength="60"&gt;
 &lt;/td&gt;&lt;/tr&gt;
 &lt;tr&gt;&lt;td&gt;Username:&lt;/td&gt;&lt;td&gt;
 &lt;input type="text" name="username" maxlength="60"&gt;
 &lt;/td&gt;&lt;/tr&gt;
 &lt;tr&gt;&lt;td&gt;Password:&lt;/td&gt;&lt;td&gt;
 &lt;input type="password" name="pass" maxlength="10"&gt;
 &lt;/td&gt;&lt;/tr&gt;
 &lt;tr&gt;&lt;td&gt;Confirm Password:&lt;/td&gt;&lt;td&gt;
 &lt;input type="password" name="pass2" maxlength="10"&gt;
 &lt;/td&gt;&lt;/tr&gt;
 &lt;tr&gt;&lt;th colspan=2&gt;&lt;input type="submit" name="submit" 
value="Register"&gt;&lt;/th&gt;&lt;/tr&gt; &lt;/table&gt;
 &lt;/form&gt;
 &lt;?php
 }
 ?&gt; 
</code></pre>

<p>And for activation I have the following code--</p>

<pre><code>&lt;?php
if (isset($_GET['x'])) {
    $x = (int) $_GET['x'];
} else {
    $x = 0;
}
if (isset($_GET['y'])) {
    $y = $_GET['y'];
} else {
    $y = 0;
}
if ( ($x&gt; 0) &amp;&amp; (strlen($y) == 32)) {
    require_once ('mysql_connect.php');
    $query = "UPDATE User SET active=NULL WHERE (id=$x AND active='" . $y . "') LIMIT 1";  
    $result = mysql_query($query);

    if (mysql_affected_rows() == 1) {
        echo "&lt;h3&gt;Your account is now active. You may now log in.&lt;/h3&gt;";
    } else {
        echo '&lt;p&gt;&lt;font color="red" size="+1"&gt;Your account could not be activated. Please re-check the link or contact the system administrator.&lt;/font&gt;&lt;/p&gt;';
    }
    mysql_close();
} else {
    echo '&lt;b&gt;Activation link not valid!&lt;/b&gt;';
}
?&gt;
</code></pre>

<p><strong>I keep on getting this error-</strong>-</p>

<pre><code>Notice: Undefined variable: fname in /var/www/users/ec09580/project_test/r_test.php on line 87 
Notice: Undefined variable: lname in /var/www/users/ec09580/project_test/r_test.php on line 87 
Notice: Undefined variable: email_id in /var/www/users/ec09580/project_test/r_test.php on line 87 
Notice: Undefined variable: username_r in /var/www/users/ec09580/project_test/r_test.php on line 87 
Notice: Undefined variable: password_1 in /var/www/users/ec09580/project_test/r_test.php on line 87 
</code></pre>

<p>I am confused waht to do. Can anyone please help me? Thankyou.</p>
