Tjek om noget er i db
Ello, there jeg har dette script som tjekker om feltet email allerede eksistere... men hvis det gør skriver den bare OPTAGET, og så laver den også min echo længere samt sender en mail med det info man har lavet.. hvordan sætter man så den stopper efter "OPTAGET" ???<link rel="STYLESHEET" type="text/css" href="style.css">
<?
$action = $_GET['action'];
$nick = $_REQUEST['nick'];
$password = $_REQUEST['password'];
$email = $_REQUEST['email'];
if($action == "opret")
{
if (mysql_result(mysql_query("SELECT COUNT(*) FROM brugere WHERE email='$email'"),0) == 1) {
echo 'Optaget';
} else {
mysql_query("INSERT INTO brugere (userid, nick, password, email)
VALUES('', '$nick', md5('$password'), '$email')") or die(mysql_error());
}
$pass = md5('$password');
$mailbody = "
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<style type=\"text/css\">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
}
-->
</style>
</head>
<body>
<span class=\"style1\">Welcome to Team Kapow! - <u>$nick</u><br> <br>
To log into our site you have to activate your account by clicking at this link!:<br>
<a href=\"http://yellow.dammoel.dk/aktiver.php?nick=$nick&password=$password\"> Here...!</a><br><br>
Your username: <strong>$nick</strong><br>
Your password: <strong>$password</strong><br><br>
Regards:<br>
<a href=\"www.Team-Kapow.com</a><br>" target="_blank">http://www.team-kapow.com\">www.Team-Kapow.com</a><br>
</span>
</body>
</html>";
mail("$email", "Welcome to Team Kapow!","$mailbody", "From: \"Activation link from team-kapow.com\"<activate@team-kapow.com>\nContent-Type: text/html; charset=iso-8859-1\nContent-Transfer-Encoding: 8bit");
echo "Your have now recieved an email wih at registration link...!";
}
else
{
echo "<body>
<form action=\"?site=addmember&action=opret\" method=\"post\">
<table>
<tr>
</tr>
<tr>
<td width=\"72\"><font face=\"Verdana\" style=\"font-size: 8pt\">Username:</font></td>
<td width=\"1\"><input type=\"text\" name=\"nick\" size=\"20\"></td>
</tr>
<tr>
<td width=\"72\"><font face=\"Verdana\" style=\"font-size: 8pt\">Password:</font></td>
<td width=\"1\"><input type=\"text\" name=\"password\" size=\"20\"></td>
</tr>
<tr>
<td width=\"72\"><font face=\"Verdana\" style=\"font-size: 8pt\">Email:</font></td>
<td width=\"1\"><input type=\"text\" name=\"email\" size=\"20\"></td>
</tr>
<tr>
<td width=\"338\" colspan=\"2\"><center><input type=\"submit\" value=\"add user\"></td>
</tr>
</table>
</form>";
}
?>
