when i log in and click register i can see the register form but what i want it to do is recognize that im allready registerd and tell me that ‘You are allready registerd’ please help me?
heres my register.php
[code=php]<?PHP session_start();?>
<? include(“includes/connect.php”);?>
<title>Pulse-Box @ SALES</title>
<link rel=”stylesheet” href=”assets/css/style.css” type=”text/css” media=”all” />
</head>
<body align=”center”>
<div id=”wrapper”>
<?php include (‘header.php’); ?>
<div id=”nav”></div>
<?php include (‘leftbar.php’); ?>
<div id=”right”>
<h1><font size=”2″>» Member Registartion</font></h1>
<p>
<?PHP session_start();?>
<? include(“includes/connect.php”);?>
<? if($_POST[‘submit’]) { ?>
<?
// Get data sent by form
$fullname = $_POST[‘fullname’];
$gender = $_POST[‘gender’];
$email = $_POST[’email’];
$username = $_POST[‘username’];
$password = $_POST[‘password’];
$v_password = $_POST[‘v_password’];
$ip = $_SERVER[‘REMOTE_ADDR’];
// Check database for any usernames that are the same as the entered one.
$checkusername = “SELECT * from members where username=’$username'”;
$checkusername2 = mysql_query($checkusername) or die(“Unable to Query for Username”);
$checkusername3 = mysql_fetch_array($checkusername2);
// Check database for any email address’s that are the same as the entered one.
$checkemail = “SELECT * from members where email=’$email'”;
$checkemail2 = mysql_query($checkemail) or die(“Unable to Query for Email Address”);
$checkemail3 = mysql_fetch_array($checkemail2);
?>
<?
// Check if the fullname field is empty.
if(!$fullname) { ?>
Please enter your fullname.
<? }
// Check if they have entered both names.
else if(!strstr($fullname,” “)) { ?>
Please enter your fullname correctly.
<? }
// Check to make sure they have enter a gender
else if($gender != ‘Male’ && $gender != ‘Female’) { ?>
Please enter your gender.
<? }
// Check if the email field is empty.
else if(!$email) { ?>
Please enter your email address.
<? }
// Check if the email is longer than the minimum character needed.
else if(strlen($email) < 6) { ?>
Please enter your email address correctly.
<? }
// Check if the email has the required symbols @ and .
else if((!strstr($email , “@”)) || (!strstr($email , “.”))) { ?>
Please enter your email address correctly.
<? }
// Check to see if the email address entered is unique.
else if($checkemail3) { ?>
The email address entered has already been taken. Choose another.
<? }
// Check if the username field is empty.
else if(!$username) { ?>
Please enter a username.
<? }
// Check to make sure the username is equal to or longer than 5 characters.
else if(strlen($username) < 5) { ?>
Your username must be at least 5 characters in length.
<? }
// Check to make sure the username is equal to or less than 30 characters.
else if(strlen($username) > 30) { ?>
Your username can not be longer than 30 characters in length.
<? }
// Check to make sure the username entered is unique.
else if($checkusername3) { ?>
The username entered had already been taken. Choose another.
<? }
// Check to make sure they have entered a password.
else if(!$password) { ?>
Please enter a password.
<? }
// Check if the password is at least 5 characters in length, for security reasons.
else if(strlen($password) < 5) { ?>
Your password must be at least 5 characters in length. For security reasons.
<? }
// Check if the re-entered password field is empty.
else if(!$v_password) { ?>
Please re-enter your password.
<? }
// Check to make sure the password and re-entered passwords are the same.
else if($password != $v_password) { ?>
Your passwords don’t match. Please re-enter them.
<? }
// If all of the information is verified, register them.
else { ?>
<?
$new_member = “INSERT INTO `members` (`ip`, `fullname`, `gender`, `email`, `username`, `password`)
VALUES (‘$ip’, ‘$fullname’, ‘$gender’, ‘$email’, ‘$username’, ‘$password’)”;
mysql_query($new_member) or die(mysql_error());
?>
<? $_SESSION[‘new_reg’]=’Yes’; ?>
<script type=”text/javascript”>location.replace(“login.php”);</script>
<? } ?>
<? } else { ?>
<?//================================================================//?>
<form method=”POST” action=”register.php”>
<table cellpadding=”0″ cellspacing=”1″ border=”0″>
<tr>
<td><font size=”2″> Fullname </font></td>
<td> <input type=”text” name=”fullname” id=”fullname” value=””> </td>
</tr>
<tr>
<td><font size=”2″> Gender </font></td>
<td> <select class=”drop_down” name=”gender” id=”gender”> <option value=”Male”>Male</option> <option value=”Female”>Female</option> </select> </td>
</tr>
<tr>
<td><font size=”2″> E-mail Adress </font></td>
<td> <input type=”text” name=”email” id=”email” value=””> </td>
</tr>
<tr>
<td><font size=”2″> Username </font></td>
<td> <input type=”text” name=”username” id=”username” value=””> </td>
</tr>
<tr>
<td><font size=”2″> Password </font></td>
<td> <input type=”password” name=”password” id=”password” value=””> </td>
</tr>
<tr>
<td><font size=”2″> Re-Enter Password </font></td>
<td> <input type=”password” name=”v_password” id=”v_password” value=””> </td>
</tr>
<tr><td>
<input type=”submit” name=”submit” id=”submit” value=”Register!”>
</td></tr>
</table>
<?//================================================================//?>
<? } ?>
</div>
</div>
<?php include (‘footer.php’); ?>
</body>