10-13-2012, 10:53 AM
<?php
#####################################################
# LcDevClub #
#####################################################
$server = "localhost";
$user = "root";
$password = "";
$database = "newproject_db_auth";
function clean($str) {$str = @trim($str);
if(get_magic_quotes_gpc())
{
$str = stripslashes($str);
}
return @mysql_escape_string($str);
}
$submit = strip_tags(@$_POST ['submit']) ;
$user_id = clean(strip_tags(@$_POST ['user_id'])) ;
$passwd = clean(strip_tags(@$_POST ['passwd'])) ;
$repeatpasswd = clean(strip_tags(@$_POST ['repeatpasswd'])) ;
$email = strip_tags(@$_POST ['email']) ;
if ($submit)
{
if ($user_id&&$passwd&&$repeatpasswd&&$email)
{
if ($passwd==$repeatpasswd)
{
$link = mysql_connect( "$server","$user","$password");
if(!$link) {
die('ÃÂÃ¥ óäàëîñü ïîäêëþ÷èòüñÿ ê ñåðâåðó: ' . mysql_error());
}
$db = mysql_select_db("$database");
if(!$db) {
die("Cannot connecto to database/");
}
mysql_query("set names 'UTF8'");
if($user_id != '') {
$qry = "SELECT * FROM bg_user WHERE user_id = '$user_id'";
$result = mysql_query($qry);
if($result) {
if(mysql_num_rows($result) > 0)
{
echo "<font color=red> <h2>Username already taken.</font></h2>";
}
else
{
if (strlen($user_id)>15||strlen($email)>30)
{
echo "<h2><font color=red>Login or Email is very long.</font></h2>";
}
else
{
if (strlen($passwd)>15||strlen($passwd)<6)
{
echo "<h2><font color=red>Password must be have 3-15 symbols.</font></h2>";
}
else
{
$queryreg = mysql_query("INSERT INTO bg_user (user_id, passwd, email) VALUES ('$user_id', '$passwd', '$email')");
echo "<h2><font color=green>Successfully.</font></h2>";
}
}
}
}
}
}
else
echo "<h2><font color=red>Passwords don't match.</font></h2>";
}
else
echo "<h2><font color=red>You should fill all <b>âñå</b> fields!</font></h2>";
}
?>
<form action='register.php' method='POST'>
<table>
<h3>Username: </h3
>
<input type='text' class="texta" onkeyup="javascript:this.value=this.value.replace(/[ß,ö,ü,ä,!,§,$,%,&,/,(,),=,-,_,:,;,',.,+,*,°,^,?,´,`,#,@,²,³,{,},\,~,|,<,>,µ]/g, '');" name='user_id' value='<?php echo $user_id ?>'>
<h3>Password: </h3>
<input type='password' class="texta" onkeyup="javascript:this.value=this.value.replace(/[ß,ö,ü,ä,!,§,$,%,&,/,(,),=,-,_,:,;,',.,+,*,°,^,?,´,`,#,@,²,³,{,},\,~,|,<,>,µ]/g, '');" name='passwd'>
<h3>Password again: </h4>
<input type='password' class="texta" onkeyup="javascript:this.value=this.value.replace(/[ß,ö,ü,ä,!,§,$,%,&,/,(,),=,-,_,:,;,',.,+,*,°,^,?,´,`,#,@,²,³,{,},\,~,|,<,>,µ]/g, '');" name='repeatpasswd'>
<h3>Email: </h3>
<input type='text' class="texta" onkeyup="javascript:this.value=this.value.replace(/[ß,ö,ü,ä,!,§,$,%,&,/,(,),=,-,_,:,;,',+,*,°,^,?,´,`,#,²,³,{,},\,~,|,<,>,µ]/g, '');" name='email' value='<?php echo $email ?>'>
<h3> <input type='submit' class="buttonz" name='submit' style='padding:3px; padding-right: 3px; font-size:16px; background: white; color: black; shadow: 1px 2px 10px blue; ' value=' Register! '> </h3>
</table> </form>
