Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
//This page let users sign up
include('config.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
<title>Sign Up</title>
</head>
<body>
<div align="center">
<div class="header">
<a href="<?php echo $url_home; ?>"><img width="80%" src="<?php echo $design; ?>/images/logo.png" alt="Espace Membre" /></a>
</div></div>
<?php
if(isset($_POST['username'], $_POST['password'], $_POST['passverif'], $_POST['email'], $_POST['user_address']) and $_POST['username']!='')
{
if(get_magic_quotes_gpc())
{
$_POST['username'] = stripslashes($_POST['username']);
$_POST['password'] = stripslashes($_POST['password']);
$_POST['passverif'] = stripslashes($_POST['passverif']);
$_POST['email'] = stripslashes($_POST['email']);
$_POST['user_address'] = stripslashes($_POST['user_address']);
}
if($_POST['password']==$_POST['passverif'])
{
if(strlen($_POST['password'])>=6)
{
if(preg_match('#^(([a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+\.?)*[a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+)@(([a-z0-9-_]+\.?)*[a-z0-9-_]+)\.[a-z]{2,}$#i',$_POST['email']))
{
// edited by salman
$username = mysqli_real_escape_string($var,$_POST['username']);
$password = mysqli_real_escape_string($var,sha1($_POST['password']));
$email = mysqli_real_escape_string($var,$_POST['email']);
$user_address = mysqli_real_escape_string($var,$_POST['user_address']);
$dn = mysqli_num_rows(mysqli_query($var,'select id from users where username="'.$username.'"'));
if($dn==0)
{
$dn2 = mysqli_num_rows(mysqli_query($var,'select id from users'));
$id = $dn2+1;
if(mysqli_query($var,'insert into users(id, username, password, email, user_address, signup_date) values ('.$id.', "'.$username.'", "'.$password.'", "'.$email.'", "'.$user_address.'", "'.time().'")'))
{
$form = false;
?>
<div class="message">You have successfully been signed up. You can now log in.<br />
<a href="login.php">Log in</a></div>
<?php
}
else
{
$form = true;
$message = 'An error occurred while signing you up.';
}
}
else
{
$form = true;
$message = 'Another user already use this username.';
}
}
else
{
$form = true;
$message = 'The email you typed is not valid.';
}
}
else
{
$form = true;
$message = 'Your password must have a minimum of 6 characters.';
}
}
else
{
$form = true;
$message = 'The passwords you entered are not identical.';
}
}
else
{
$form = true;
}
if($form)
{
if(isset($message))
{
echo '<div class="message">'.$message.'</div>';
}
?>
<div class="contentsignup">
<div class="box">
<div class="box_left">
WCSF Index &gt; Sign Up
</div>
<div class="box_right">
<a href="login.php">Login</a>
</div>
<div class="clean"></div>
</div>
<form action="signup.php" method="post">
Please fill this form to sign up:<br />
<div class="center">
<label for="username">Username</label><input type="text" name="username" value="<?php if(isset($_POST['username'])){echo htmlentities($_POST['username'], ENT_QUOTES, 'UTF-8');} ?>" /><br />
<label for="password">Password<span class="small">(6 characters min.)</span></label><input type="password" name="password" /><br />
<label for="passverif">Password<span class="small">(verification)</span></label><input type="password" name="passverif" /><br />
<label for="email">Email</label><input type="text" name="email" value="<?php if(isset($_POST['email'])){echo htmlentities($_POST['email'], ENT_QUOTES, 'UTF-8');} ?>" /><br />
<label for="user_address">User address<span class="small"></span></label><input type="text" name="user_address" value="<?php if(isset($_POST['user_address'])){echo htmlentities($_POST['user_address'], ENT_QUOTES, 'UTF-8');} ?>" /><br /><br />
<input type="submit" value="Sign Up" />
</div>
</form>
</div>
<?php
}
?>
</body>
</html>