Курсовая работа: Создание инструментального средства для организации социологических опросов
}
function admin_sess_beg(){
global $CURRENT_USER;
$_SESSION['admin']=md5("Admin"."pass");
$_SESSION['name'] = "Ann & Katya";
$CURRENT_USER = "Ann & Katya";
}
function check_user($name,$pass){
$sql = "SELECT * FROM user WHERE name = '$name' and pass='$pass'";
$result = @mysql_query($sql);
if(@mysql_num_rows($result))
return true;
else
return false;
}
function check_sess(){
@$name = $_SESSION['name'];
$sql = "SELECT * FROM user WHERE name='$name'";
$result = @mysql_query($sql);
if(@mysql_num_rows($result)){
$user=mysql_fetch_assoc($result);
$check = md5(session_id().$user['name'] .$user['pass']);
if($_SESSION['check']==$check)
return true;
else
return false;
}
else return false;
}