Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<html>
<head>
<title>Shvepi.com | Register</title>
</head>
<?php
// Connecting to the DataBase
include("../include/config.php");
// If the submit button is pressed execute this
if($_POST['register'])
{
$username = $_POST['username'];
$password = $_POST['password'];
$cpassword = $_POST['cpassword'];
$email = $_POST['email'];
// Checking if there is an empy field
if($username == NULL | $password == NULL | $cpassword == NULL | $email == NULL)
{
echo "A field was left blank.";
}
// If there is no blank field we continue
else
{
// Checking if the passwords are the same
if($password != $cpassword)
{
echo "The passwords are not the same";
}
else
{
$password = md5($password);
$cname = mysql_query("SELECT username FROM users WHERE username = '$username'");
$cname = mysql_num_rows($cname);
$cemail = mysql_query("SELECT email FROM users WHERE email = '$email'");
$cemail = mysql_num_rows($cemail);
if($cname > 0 | cemail > 0)
{
echo "This username or email are already registered.";
}
else
{
$username = htmlspecialchars($username);
$password = htmlspecialchars($password);
$email = htmlspecialchars($email);
// If everything is ok so far we insert the info into the DataBase
$query = mysql_query("INSERT INTO users (username, password, email) VALUES ('$username', '$password', '$email')");
echo "You have successfully registered!";
}
}
}
}
// If the form is not submited show the registration table
else
{
echo "<form method='POST'>";
echo "Username: <input type='text' name='username'><br />";
echo "Password: <input type='password' name='password'><br />";
echo "Password: <input type='password' name='cpassword'><br />";
echo "Email: <input type='text' name='email'><br />";
echo "<input type='submit' value='Register' name='register'>";
echo "</form";
}
?>
$rs=mysql_query('SELECT * FROM users WHERE username="$promenliwa_za_login" AND pass="'.md5($i_za_pass).'"');