Jacques1
<?php
if(isset($_POST['submit']))
{
session_start();
if($_POST['kapcha'] != $_SESSION['rand_code'])
exit ("<center>error code image</center>");
else
echo "";
if (isset($_POST['login']))
{
$login = $_POST['login'];
if ($login == '')
{
unset($login);
}
}
$err = array();
if(!preg_match("/^[a-z0-9\_]+$/", $login))
{
exit ("<center>Username can only contain letters of the Latin alphabet and numbers!</center>");
}
if( preg_match( "/[а-яёА-ЯЁ|\s]/", $login ) )
{
exit ("<center>Username may contain only letters and numbers!</center>");
}
if (isset($_POST['password']))
{
$password = $_POST['password'];
if ($password =='')
{
unset($password);
}
}
if (strlen($login) < 3 or strlen($login) > 25)
{
exit ("<center>Login must be at least from <b> 3 </ b> characters and no more than: <b>25<b>, go back and try again</center>");
}
if (strlen($password) < 6 or strlen($password) > 20) {
exit ("<center>The password should consist of at least from <b> 6 </ b> characters and no more than from <b> 20 </ b>, go back and try again</center>");
}
if (empty($login) or empty($password))
{
exit ("<center>You do not have entered all the information, go back and fill in all fields!</center>");
}
$login = stripslashes($login);
$login = htmlspecialchars($login);
$password = stripslashes($password);
$password = htmlspecialchars($password);
$login = $_POST['login'];
$password = $_POST['password'];
//$password = htmlspecialchars($password);
//$password = md5($password);
//удаляем лишние пробелы
$login = trim($login);
$password = trim($password);
include ("mysql.php");
$result = mysql_query("SELECT username FROM users WHERE username='$login'", $db);
$myrow = mysql_fetch_array($result);
if (!empty($myrow['username']))
{
exit ("<center>Sorry, you entered login is already registered. Please enter a different username.</center>");
}
$result2 = mysql_query ("INSERT INTO users (username,password) VALUES('$login','$password')");
$login = mysql_real_escape_string($_POST['login']);
$password = mysql_real_escape_string($_POST['password']);
if ($result2=="TRUE")
{
echo "<center>You have successfully logged in! Now you can log in using your ID.</center>";
}
else {
echo "Error! You are not registred.";
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<meta charset="utf-8"/>
<head>
<link rel="stylesheet" href="css/styles.css">
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
<title>Register</title>
</head>
<body>
<center><h3><a href="/">Jabber Server </a></h3></center>
<div>
<form action="../register.php?do=reg" method="post">
<label for="name">Login:</label> <input name="login" type="name" size="15" maxlength="15">
<br />
<label for="password">password:</label> <input name="password" type="password" size="15" maxlength="15">
<br />
<input name="md5" type="hidden">
<img src = "captcha.php" />
<br />
<input type = "text" name = "kapcha" />
<br />
<input type="submit" name="submit" value="Register">
<center>
</center>
</form>
</div>
</body>
</html>
I want to make as there https://jabber.ru/user/register