Quote:
Originally Posted by Rulzan
I request a register page more complex,like requesting email,and stuff,so if you lose you're password,you can handle yourself
(tq binary 5095)
|
Here you go everyone
Changing Password with Required Info.
Code:
<?php
require_once ('config.php');
?>
<center><b class="h2"> <?php echo '<font color="#000000">Welcome to '.$servername.' Password change'; ?> </b><br />
<br /></center>
<br />
<center><form method='post' action=''><table class=body width="440" height="229">
<tr>
<td align="left" height="32"><b>Account Id:</b></td>
<td class="it3" height="32"><input class="it" name="login" id="id" /></td>
</tr> <tr>
<td align="left" height="37">New Password:</td>
<td class="it3" height="37"><input class="it" id="ipassword" type="password" maxLength=12 name="pass" /></td>
</tr> <tr>
<td align="left" height="32">Retype New Password:</td>
<td class=it3 height="32"><input class="it1" id="ipassword" type="password" maxlength=12 name="retpass" /></td>
</tr> <tr>
<td colspan="2"> </td>
</tr> <tr>
<td colspan="2"><b></b></td>
</tr> <tr>
<td align="left" height="32"><b>Account Question:</b></td>
<td class=it3 height="32"><input type="text" maxlength=16 name="ownerID" /></td>
</tr> <?php if ($chPass) { ?> <tr>
<td align="left" height="32"><b>Question Anwser</b></td>
<td class=it3 height="32"><input type="text" maxlength=16 name="ownerReply" /></td>
</tr> <?php } ?> <tr>
<td colspan="2"> </td>
</tr> <tr>
<td align="left" height="32">E-mail:</td>
<td class=it3 height="32"><input type="text" name="email" /></td>
</tr> <?php if ($requireCAPTCHA) { ?> <tr>
<td align="left" height="32"><b>Type Check Code</b>:</td>
<td class=it3 height="32"><input name='CheckCode' size='20' maxlength='6'class=it style="FONT-SIZE: 9pt"></td>
</tr> <tr>
<td height="25" align="left">Check Code:</td>
<td height="25"><span style="font-size: 9pt">
<img src='./inc/img.php' width='200' height='60' alt='CAPTCHA' /></td>
</tr> <?php } ?> <tr>
<td></td>
<td style="FONT-SIZE: 14px; VERTICAL-ALIGN: middle">
<span style="font-size: 9pt"><input type="hidden" name="hash">
<input class=Butt type=submit onClick="hash.value = login(pass.value)" value='Change it' name=B1 /></span></td>
</tr></table>
</form>
<?php
if(isset($_POST['retpass']) && isset($_POST['login']) && isset($_POST['pass']) && isset($_POST['ownerID'])) {
if(!Empty($_POST['retpass']) && !Empty($_POST['login']) && !Empty($_POST['pass']) && !Empty($_POST['ownerID'])) {
$ok=false;
if ($requireCAPTCHA) { if (PhpCaptcha::Validate($_POST['CheckCode'])) $ok=true; }
else $ok=true;
if($ok) {
mysql_select_db($accdb);
$userid = trim($_POST['login']);
$password=trim($_POST['pass']);
$passretype=trim($_POST['retpass']);
$hash=$_POST['hash'];
$ownerReply=(isset($_POST['ownerReply']) ? substr(trim($_POST['ownerReply']), 0,16) : '');
$mail=(isset($_POST['email']) ? trim($_POST['email']) : '');
$ownerID=substr(trim($_POST['ownerID']), 0,16);
if (!Empty($mail)) if (!ereg("^[0-9a-zA-Z]{4,128}$", (strtr($mail, Array('@'=>'','.'=>''))))) {
$mail='';
echo 'mail > Only letters a to z and special chars @ . are allowed';
}
if(!eregi("^[0-9a-z]{4,12}$",$userid)) {
echo 'login > Only letters from "a" to "z" and numbers, lenght of 4 to 12 characters';
}
else {
if($password == $passretype) {
if(!ereg("^[0-9a-zA-Z]{4,22}$",$password)) {
echo 'password > Only letters or numbers, lenght of 4 to 22 characters';
}
else {
$res = mysql_query('SELECT * FROM account WHERE name="'.$userid.'" AND idnumber="'.$ownerID
.($chPass ? '" AND phone="'.$ownerReply : '').'" ORDER BY id DESC');
if(mysql_num_rows($res) == 1) {
mysql_query('UPDATE account SET password="'.($passhash ? $hash : $password)
.(!Empty($mail) ? '", email="'.$mail : '')
.'", netbar_ip="'.$_SERVER['REMOTE_ADDR'].'", ip_mask="'.'255.255.255.0" '
.'WHERE name="'.$userid.'" AND idnumber="'.$ownerID.'";');
echo 'Success > Account info updated successfully.';
}
else echo 'Error > Wrong login and/or owner... info.';
}
}
else echo 'Error > New passwords did not match.';
}
}
else echo 'Error > Check Code is Wrong.';
}
else echo 'Error > umm why there is empty <b>required</b> areas in register form????';
}
?>
And this is Main Page For Register Below
Code:
<?php
require_once ('config.php');
?>
</center>
<br />
<center><form method='post' action=''><table class=body width="440" height="229">
<tr>
<td align="left" height="32"><b>UserID</b>: </td>
<td class="it3" height="32"><input class="it" name="id" id="id" /></td>
</tr> <tr>
<td align="left" height="37"><b>Password</b>:</td>
<td class="it3" height="37"><input class="it" id="ipassword" type="password" maxLength=12 name="pass" /></td>
</tr> <tr>
<td align="left" height="32"><b>Retype Password</b>:</td>
<td class=it3 height="32"><input class="it1" id="ipassword" type="password" maxlength=12 name="retpass" /></td>
</tr> <tr>
<td colspan="2"> </td>
</tr> <tr>
<td colspan="2"><b></b></td>
</tr> <tr>
<td align="left" height="32"><b>Account Question:</b></td>
<td class=it3 height="32"><input type="text" maxlength=16 name="ownerID" /></td>
</tr> <tr>
<td align="left" height="32">Question Answer:</td>
<td class=it3 height="32"><input type="text" maxlength=16 name="ownerReply" /></td>
</tr> <tr>
<td colspan="2"> </td>
</tr> <tr>
<td colspan="2"><b></b></td>
</tr
></tr>
<td align="left" height="32"><b>Real Name:</b></td>
<td class=it3 height="32"><input type="text" maxlength=16 name="User Name" /></td>
</tr> <tr>
<td align="left" height="32">Own Country:</td>
<td class=it3 height="32"><input type="text" maxlength=16 name="Country" /></td>
</tr> <tr>
<td align="left" height="32">Your City:</td>
<td class=it3 height="32"><input type="text" maxlength=16 name="City" /></td>
</tr> <tr>
<td align="left" height="32">ID-number:</td>
<td class=it3 height="32"><input type="text" maxlength=16 name="IDNumber" /></td>
</tr> <tr>
<td colspan="2"> </td>
</tr> <tr>
<td align="left" height="32">E-mail:</td>
<td class=it3 height="32"><input type="text" name="email" /></td>
</tr> <?php if ($requireCAPTCHA) { ?> <tr>
<td align="left" height="32"><b>Type Check Code</b>:</td>
<td class=it3 height="32"><input name='CheckCode' size='20' maxlength='6'class=it style="FONT-SIZE: 9pt"></td>
</tr> <tr>
<td height="25" align="left">Check Code:</td>
<td height="25"><span style="font-size: 9pt">
<img src='./inc/img.php' width='200' height='60' alt='CAPTCHA' /></td>
</tr> <?php } ?> <tr>
<td></td>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="60%">
<tbody>
<tr>
<td align="right"><div align="center" class="style11">If you have trouble Registering an account, please email us at
</div>
</td>
</tr>
<tr>
<td align="left"><input id="isAgreement" type="checkbox" name="isAgreement" checked="checked" />
<span class="stylered1">I Agree.</span>
</div></td>
</tr>
</tbody>
</table></td>
</tr>
</table></td>
</tr>
<td style="FONT-SIZE: 14px; VERTICAL-ALIGN: middle">
<span style="font-size: 9pt"><input type="hidden" name="hash"><!-- Created by <someone> @ webyt.net -->
<input class=Butt type=submit onClick="hash.value = login(pass.value)" value='Register' name=B1 /></span></td>
</tr></table>
</form>
<?php
if(isset($_POST['retpass']) && isset($_POST['id']) && isset($_POST['pass']) && isset($_POST['ownerID'])) {
if(!Empty($_POST['retpass']) && !Empty($_POST['id']) && !Empty($_POST['pass']) && !Empty($_POST['ownerID'])) {
$ok=false;
if ($requireCAPTCHA) { if (PhpCaptcha::Validate($_POST['CheckCode'])) $ok=true; }
else $ok=true;
if($ok) {
mysql_select_db($accdb);
$userid = trim($_POST['id']);
$password=trim($_POST['pass']);
$passretype=trim($_POST['retpass']);
$hash=$_POST['hash'];
$ownerReply=(isset($_POST['ownerReply']) ? substr(trim($_POST['ownerReply']), 0,16) : '');
$mail=(isset($_POST['email']) ? substr(trim($_POST['email']), 0,16) : '');
$ownerID=substr(trim($_POST['ownerID']), 0,16);
if (!Empty($mail)) if (!ereg("^[0-9a-zA-Z]{4,128}$", (strtr($mail, Array('@'=>'','.'=>''))))) {
$mail='';
echo 'mail > Only letters a to z and special chars @ . are allowed';
}
if(!ereg("^[0-9a-z]{4,12}$",$userid)) {
echo 'login > Only letters from "a" to "z" and numbers, lenght of 4 to 12 characters';
}
else {
if($password == $passretype) {
if(!ereg("^[0-9a-zA-Z]{4,22}$",$password)) {
echo 'password > Only letters or numbers, lenght of 4 to 22 characters';
}
else {
$res = mysql_query('SELECT * FROM account WHERE name = "'.$userid.'" ORDER BY id DESC');
if(mysql_num_rows($res) == 0) {
mysql_query('INSERT INTO account(name,password,pointtime,idnumber,phone,email,netbar_ip,ip_mask) VALUES ("'
.$userid.'","'.($passhash ? $hash : $password).'","'.date('Ymd').'", "'
.$ownerID.'", "'.$ownerReply.'", "'.$mail.'", "'
.$_SERVER['REMOTE_ADDR'].'", "'.'255.255.255.0")');
echo 'Congratz Account registered successfully on Server.';
}
else echo ' Account Already exists.';
}
}
else echo 'Error > Passwords did not match.';
}
}
else echo 'Error > Check Code is Wrong.';
}
else echo 'Error > umm why there is empty <b>required</b> areas in register form????';
}
?>
Page Requires your Pre-Existing config.php
BTW all Register Pages are setup with same config.php So go Download one ;p