Newbie Spellweaver
- Joined
- Sep 11, 2007
- Messages
- 84
- Reaction score
- 17
Here a working Register Script we made for the flyff web we are working on and maby some wants it
flyff-madweb-web on ragezone
flyff-madweb-web on ragezone
Code:
<?php
$Flyff_config["mysql_host"]="localhost"; // MySQL IP
$Flyff_config["mysql_port"]=3306; // MySQP port
$Flyff_config["mysql_db"]="madwebtest"; // Flyff Database name
$Flyff_config["mysql_login"]="madgizmo"; // MySQL Login name
$Flyff_config["mysql_password"]="mw2"; // MySQL Password
error_reporting(0);
?>
<?php
$Flyff_config["javascript_sort_method"]="bubble";
$link = mysql_connect($Flyff_config['mysql_host'].":".$Flyff_config['mysql_port'], $Flyff_config['mysql_login'], $Flyff_config['mysql_password']);
if (!$link) die("Couldn't connect to MySQL");
@mysql_select_db($Flyff_config['mysql_db'], $link)
or die ('Error '.mysql_errno().': '.mysql_error());
?>
<script type="text/javascript">//<![CDATA[
function isAlphaNumeric(value)
{
if (value.match(/^[a-zA-Z0-9]+$/))
return true;
else
return false;
}
function checkform(f)
{
if (f.account.value=="")
{
alert("Fill in all fields Please"); return false;
}
if (!isAlphaNumeric(f.account.value))
{
alert("Fill in all fields"); return false;
}
if (f.password.value=="")
{
alert("No password "); return false;
}
if (!isAlphaNumeric(f.password.value))
{
alert("444444"); return false;
}
if (f.password2.value=="")
{
alert("You didnt repeat a password");
return false;
}
if (f.password.value!=f.password2.value)
{
alert("Not the same password ");
return false;
}
return true;
}
//]]>
</script>
<form method="post" action="index.php?op=reg" onsubmit="return checkform(this)">
<table>
<td><b><font face="Trebuchet MS" color="white" size="1">Login</font></b></td>
<td><font face="Trebuchet MS" size="1"><b>
<input type="text" name="account" maxlength="15" size="10" /></b></font></td>
<td><b><font face="Trebuchet MS" color="white" size="1">Password</font></b></td>
<td><font face="Trebuchet MS" size="1"><b>
<input type="password" name="password" maxlength="15" size="10" /></b></font></td>
<td><b><font face="Trebuchet MS" color="white" size="1">Repeat </font></b></td>
<td><font face="Trebuchet MS" size="1"><b>
<input type="password" name="password2" maxlength="15" size="10" /></b></font></td>
<td colspan="2" style="text-align: center;">
<font size="1" face="Trebuchet MS"><b>
<input type="submit" name="submit" value="Register" /></b></font></td>
</tr>
</table>
</form>
<?php
if(ereg("^([a-zA-Z0-9_-])*$", $_POST['account']) && ereg("^([a-zA-Z0-9_-])*$", $_POST['password']) && ereg("^([a-zA-Z0-9_-])*$", $_POST['password2']))
{
if ($page="index.php" && $_POST['account'] && strlen($_POST['account'])<16 && strlen($_POST['account'])>3 && $_POST['password'] && $_POST['password2'] && $_POST['password']==$_POST['password2'])
{
$check=mysql_query("select * from accounts where username='".$_POST['account']."'");
$check1=mysql_num_rows($check);
if($check1>0)
{
echo "<p clss='error'><b>An account already with that login please try oneother </b></p>";
}
else
{
mysql_query("INSERT INTO accounts (username, password, accesslevel) VALUES ('".$_POST['account']."', '".base64_encode(pack('H*', sha1($_POST['password'])))."', 0)", $link);
mysql_close($link);
print '<p class="error"><b><center>Registration successful Have fun on our Flyff server</center></b></p>';
}
}
else
{
print '<p class="error"><b> </b></p>'.mysql_error();
}
}
else
{
echo "Error Plz try again.";
}
?>
</font>
</body>
</html>
Attachments
You must be registered for see attachments list