Код:
function register_form(){
$date = date('D, M, Y');
echo '<html>
<body bgcolor="cccccc">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /></head><center>
<form action="?act=register" method="post">
Потребител.: <input type="text" name="username" size="30"><br>
Парола: <input type=password name="password" size="30"><br>
Отново: <input type=password name=password_conf size=30><br>
<input type=hidden name=date value=$date>
<input type=submit value=Register>
</form>';
}
function register(){
$connect = mysql_connect("localhost", "bux", "bux");
if(!$connect){
die(mysql_error());
}
$select_db = mysql_select_db("site");
if(!$select_db){
die(mysql_error());
}
$username = $_POST['username'];
$password = $_POST['password'];
$pass_conf = $_POST['password_conf'];
$date = $_POST['date'];
if(empty($username)){
die("Please enter your username!<br>");
}
if(empty($password)){
die("Please enter your password!<br>");
}
if(empty($pass_conf)){
die("Please confirm your password!<br>");
}
if($do_user_check > 0){
die("Username is already in use!<br>");
}
if($do_email_check > 0){
die("Email is already in use!");
}
if($password != $pass_conf){
die("Passwords don't match!");
}
$insert = mysql_query("INSERT INTO users (user, pass) VALUES ('$username', '$password')");
if(!$insert){
die("There's little problem: ".mysql_error());
}
echo '<html>
<body bgcolor="cccccc">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /></head><center>'.$username.', Ти се регистрира успешно<br><a href=index.php>Index</a>';
}
switch($act){
default;
register_form();
break;
case "register";
register();
break;
}
Код:
<?php
session_start();
include ('check_login.php');
echo'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body><center>
<div class="header"></div>
';
if($_SESSION['log']=$r['id'])
{
echo '
<div class="menu">
<a href="index.php">Начало</a> <font color="555555">|</font>
<a href="profile.php">Профил</a> <font color="555555">|</font>
<a href="rating.php">Класация</a> <font color="555555">|</font>
<a href="contacts.php">Свържи се с нас</a> <font color="555555">|</font>
<a href="logout.php">Излез</a> <font color="555555">|</font>
</div>';
}
else
{
echo '<div class="menu">
<a href="index.php">Начало</a> <font color="555555">|</font>
<a href="login.php">Влез</a> <font color="555555">|</font>
<a href="register.php">Регистрирай се</a> <font color="555555">|</font>
<a href="rating.php">Класация</a> <font color="555555">|</font>
<a href="contacts.php">Свържи се с нас</a>
</div>';
}
echo'
<div class="content" align="center"><br>
Добре дошли в сайта на Knights-bg
</div>
<div class="footer"></div>
</center>
</body>
</html>';
Като формата трябва да се покава вместо текста "Добре дошли в сайта на Knights-bg" ...
Thanks in advance