на аион-уникью некоторое время назад скачал скрипт регистрации (правда кривоватый он был но..)
.index.php
PHP код:
<?
ini_set("error_reporting", E_ALL & ~E_NOTICE);
include ("include/config.php");
if($_POST['act']=="Register") {
$id = htmlspecialchars($_POST['id']);
$password = htmlspecialchars($_POST['password']);
$password2 = htmlspecialchars($_POST['password2']);
$name = htmlspecialchars($_POST['name']);
$email = htmlspecialchars($_POST['email']);
$days = htmlspecialchars($_POST['days']);
$months = htmlspecialchars($_POST['months']);
$years = htmlspecialchars($_POST['years']);
$id = strip_tags($id);
$password = strip_tags($password);
$password2 = strip_tags($password2);
$name = strip_tags($name);
$email = strip_tags($email);
$days = strip_tags($days);
$months = strip_tags($months);
$years = strip_tags($years);
function anti_injection($string){
$string = str_ireplace(" or ", "", $string);
$string = str_ireplace("select ", "", $string);
$string = str_ireplace("delete ", "", $string);
$string = str_ireplace("create ", "", $string);
$string = str_replace("#", "", $string);
$string = str_replace("=", "", $string);
$string = str_replace("--", "", $string);
$string = str_replace(";", "", $string);
$string = str_replace("*", "", $string);
$string = trim($string);
$string = strip_tags($string);
$string = addslashes($string);
return $string;
}
// here I get all the data from the form
// and treatment all at once and now creates the corresponding variables
foreach ($_POST as $field => $amount) {
$field = anti_injection ($amount);
}
//There already exists ID
$selec = "SELECT * FROM account_data WHERE name='".$id."'";
$exec = mysql_query($selec, $connects) or die(mysql_error());
$total = mysql_num_rows($exec);
if($total>="1") {
echo "<center><p><br><p><font color=red>The ID $id exists in our records, choose another!</font>";
echo "<meta HTTP-EQUIV='Refresh' CONTENT='3;URL=index.php'>";
} else {
if(empty($id) || empty($password) || empty($password2) || empty($name) || empty($email) || empty($days) || empty($months) || empty($years)) {
echo "<center><p><br><p><font color=red>All fields are Mandatory</font>";
echo "<meta HTTP-EQUIV='Refresh' CONTENT='3;URL=index.php'>";
} else {
if ($password != $password2) {
echo "<center><p><br><p><font color=red>Подтверждение пароля неверно. Попробуйте еще раз.</font>";
echo "<meta HTTP-EQUIV='Refresh' CONTENT='3;URL=index.php'>";
} else {
//Getting IP
$ip = $_SERVER["REMOTE_ADDR"];
// Crypt password
$passwordsha = sha1($password, true);
$passwordcript = base64_encode($passwordsha);
//Game Registration Table
$qry = "INSERT INTO account_data (name, password, last_ip) VALUES ('$id','$passwordcript','$ip')" or die("Error in $qry");
$exe = mysql_query($qry, $connects) or print(mysql_error());
$data_register = date("Y-m-d H:i:s");
$birth = "$years-$months-$days";
//Custom Data Table
$qryp = "INSERT INTO personal_data (acc_id, name, email, data_register, birth)
VALUES ('$id','$name','$email','$data_register','$birth')" or die("Error in $qry");
$exep = mysql_query($qryp, $connects) or print(mysql_error());
//echo "Congratulations, your account was created successfully!";
?>
<!-- Return to Home Page, Timer 0, 1, 2, ......5000 -->
<script>
setTimeout("location.href='index.php'", 5);
</script>
<?
} } }
} else {
?>
<body>
<p class="style2">Aion<span class="style1"><a href="http://www.aion.skyage2.com"> Основной сайт </a></span></p>
<form name="form" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="4" align="center">
<tr>
<td colspan="2" align="center" style="height: 27px"><strong>Форма регистрации</strong></td>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<tr>
<td align="right" style="width: 43%"><strong>Логин:</strong></td>
<td style="width: 60%">
<input name="id" type="text" id="id" maxlength="11" value="<? $_POST['id']!='' ? print($_POST['id']) : print(''); ?>"> </td>
</tr>
<tr>
<td align="right"><strong>Пароль:</strong></td>
<td><input type="password" name="password" id="password" value="<? $_POST['password']!='' ? print($_POST['password']) : print(''); ?>"></td>
</tr>
<tr>
<td align="right"><strong>Повторите пароль:</strong></td>
<td><input type="password" name="password2" value="<? $_POST['password2']!='' ? print($_POST['password2']) : print(''); ?>"></td>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<tr>
<td align="right"><strong>Имя:</strong></td>
<td><input name="name" type="text" id="name" size="35" value="<? $_POST['name']!='' ? print($_POST['name']) : print(''); ?>"></td>
</tr>
<tr>
<td align="right"><strong>E-mail:</strong></td>
<td><input name="email" type="text" id="email" size="35" value="<? $_POST['email']!='' ? print($_POST['email']) : print(''); ?>"></td>
</tr>
<tr>
<td align="right"><strong>Дата рождения:</strong></td>
<td><select name="days">
<?
for($i = 1; $i <= date("t"); $i++) {
$i==date("d") ? $amount = "selected" : $amount = "";
$i<=9 ? $zero = "0" : $zero = "";
echo "<option value='$zero$i' $amount>$zero$i</option>";
}
?>
</select>
/
<?
$months = array("", "01", "02", "03", "04","05", "06", "07", "08","09", "10", "11", "12");
$date = date("m");
$date <= 9 ? $date = $date[1] : $date = $date;
?>
<select name="months">
<?
for($i = 1; $i <= count($months)-1; $i++) {
$i == $date ? $amount = "selected" : $amount = "";
echo "<option value='$months[$i]' $amount>$months[$i]</option>";
}
?>
</select>
/
<select name="years">
<?
for($i = 1950; $i <= date("Y"); $i++) {
$i==date("Y") ? $amount = "selected" : $amount = "";
echo "<option value='$i' $amount>$i</option>";
}
?>
.config.php
PHP код:
<?php
$connects = mysql_connect("localhost","db","pass");
mysql_select_db("db", $connects);
?>
В нем ток поменял язык, и добавил проверку пароля (так как в оригинале не проверялась идентичность пароля и потверждения)
Если подойдет то используй