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.
<?php
mysql_connect("хост","потребител","парола");
mysql_select_db("база данни.");
?>
<?php
session_start();
include_once "config.php";
if (isset($_SESSION['username']))
{
echo "hello $_SESSION[username]";
}
else
{
echo "<a href='login.php'>login</a> ";
echo "<a href='register.php'>register</a> ";
}
?>
<?php
session_start();
include_once "config.php";
if (isset($_SESSION['username']))
{
echo "hello $_SESSION[username]";
}
else
{
echo "<form method='POST'>";
echo "Username: <input type='text' name='username' maxlength='30'><br>";
echo "Password: <input type='password' name='password' maxlength='30'><br>";
echo "<input type='submit' name='submit' value='Login'>";
echo "</form>";
if (isset($_POST['submit']))
{
$username = htmlspecialchars($_POST['username']);
$password = htmlspecialchars($_POST['password']);
$a = mysql_query("SELECT * FROM users WHERE username='$username' and password='$password'") or die(mysql_error());
$b = mysql_num_rows($a);
if ($b > 0)
{
$_SESSION['username'] = $username;
echo "Vie vlqzohte uspeshno. <a href='index.php'>Nachalo</a>";
}
else
{
echo "Gresno ime ili parola.";
}
}
}
?>
<?php
session_start();
include_once "config.php";
if (isset($_SESSION['username']))
{
echo "hello $_SESSION[username]";
}
else
{
echo "<form method='POST'>";
echo "Username: <input type='text' name='username' maxlength='30'><br>";
echo "Password: <input type='password' name='password' maxlength='30'><br>";
echo "<input type='submit' name='submit' value='Register'>";
echo "</form>";
if (isset($_POST['submit']))
{
$username = htmlspecialchars($_POST['username']);
$password = htmlspecialchars($_POST['password']);
if (!empty($username) and !empty($password))
{
mysql_query("INSERT INTO users (username,password) VALUES ('$username','$password')") or die(mysql_error());
echo "Vie se registrirahte uspeshno. <a href='login.php'>Vleznete v akaunta si.</a>";
}
else
{
echo "Ne ste populnili vsichki poleta.";
}
}
}
?>
<?php
session_start();
session_destroy();
echo "успешно излезна!";
?>