PHP expert |
|
heb nu een script van als je registreert, word er automatisch een mail verzonden met een activation key erin, dat doet het allemaal wel, maar hij zeurt dat de key niet goed is, heb voor de zekerheid nog een x aangemeld en weer deed de activerings key het niet
hier is activate.php
<?php
include ("config.php");
$id = $HTTP_GET_VARS['id'];
$key = $HTTP_GET_VARS['key'];
if($id != "" && $key != ""){
$query = mysql_query("SELECT * FROM $table WHERE id='" . $id . "' AND activate='" . $key . "'") OR die(mysql_error());
$list = mysql_fetch_object($query);
if($key != $list->activate){
echo ("The code your enterd was invalid!<br>");
echo ("<a href=\"?page=user/activate\">Click here</a> to try again");
}
else{
mysql_query("UPDATE $table SET activatie='1' WHERE id='" . $id . "'") OR die(mysql_error());
echo ("The account is with succes activated<br>");
echo ("We've send a mail with your username & password<br>");
echo ("<br>");
echo ("<a href=\"?page=user/login\">Click here</a> oto login!");
$mail = "$list->mail";
$username = "$list->username";
$pass = "$list->pass";
mail("$mail", "Ultimatum - Activation complete",
"Hi, $username,
You are registerd on <a href=http://ultimatum.ul.funic.de/'>http://ultimatum.ul.funpic.de/</a>!
Your account info.
Your login info:
----------------------------------
Username: $username
Password: $pass
Don't lose these!
<a href='http://ultimatum.ul.funpic.de/?page=user/login'>Click here</a> to login in
S");
}
}
else{
if($activate){
$username = $_POST['username'];
$key = $_POST['key'];
$query = mysql_query("SELECT * FROM $table WHERE username='" . $username . "' AND activate='" . $key . "'") OR die(mysql_error());
$list = mysql_fetch_object($query) OR die(mysql_error());
$id = $list->id;
echo ("<meta http-equiv=refresh content=0;URL=?page=user/activate&id=$id&key=key>");
}
else{
?>
<form name="form" method="post">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>Username:</td>
<td>
<input type="text" name="username">
</td>
</tr>
<tr>
<td>Activation code:</td>
<td><input type="text" name="key"></td>
</tr>
<tr>
<td><div align="right">
<input type="submit" name="activate" value="Activeer!">
</div></td>
<td><input type="reset" name="Reset" value="Opnieuw beginnen!"></td>
</tr>
</table>
</form>
<?php
}
}
?>
<?php include ("config.php"); $id = $HTTP_GET_VARS['id']; $key = $HTTP_GET_VARS['key']; if($id != "" && $key != ""){ if($key != $list->activate){ echo ("The code your enterd was invalid!<br>"); echo ("<a href=\"?page=user/activate\">Click here</a> to try again"); } else{ echo ("The account is with succes activated<br>"); echo ("We've send a mail with your username & password<br>"); echo ("<a href=\"?page=user/login\">Click here</a> oto login!"); $mail = "$list->mail"; $username = "$list->username"; $pass = "$list->pass"; mail("$mail", "Ultimatum - Activation complete", "Hi, $username, You are registerd on <a href=http://ultimatum.ul.funic.de/'>http://ultimatum.ul.funpic.de/</a>! Your account info. Your login info: ---------------------------------- Username: $username Password: $pass Don't lose these! <a href='http://ultimatum.ul.funpic.de/?page=user/login'>Click here</a> to login in S"); } } else{ if($activate){ $username = $_POST['username']; $key = $_POST['key']; $query = mysql_query("SELECT * FROM $table WHERE username='" . $username . "' AND activate='" . $key . "'") OR die(mysql_error()); $id = $list->id; echo ("<meta http-equiv=refresh content=0;URL=?page=user/activate&id=$id&key=key>"); } else{ ?> <form name="form" method="post"> <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <td>Username:</td> <td> <input type="text" name="username"> </td> </tr> <tr> <td>Activation code:</td> <td><input type="text" name="key"></td> </tr> <tr> <td><div align="right"> <input type="submit" name="activate" value="Activeer!"> </div></td> <td><input type="reset" name="Reset" value="Opnieuw beginnen!"></td> </tr> </table> </form> <?php } } ?>
functions.php
<?php
//key-maker
function makekey ()
{
$aantaltekens = 10;
$sleutel = "";
$tekens = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l",
"m", "n", "o", "p", "q", "r", "s", "t", "v", "x", "y", "z", "A", "B", "C", "D",
"E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
"V", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
for ($i = 0; $i < $aantaltekens; $i++)
$sleutel .= $tekens[rand(0,(count($tekens)-1))];
return $sleutel;
}
$key = makekey();
?>
<?php //key-maker function makekey () { $aantaltekens = 10; $sleutel = ""; $tekens = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "v", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "V", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"); for ($i = 0; $i < $aantaltekens; $i++) $sleutel .= $tekens[rand(0,(count($tekens)-1))]; return $sleutel; } $key = makekey(); ?>
als jullie meer pagina's nodig hebbe voor dit probleem, just ask
|