- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
function user_ini() {
session_start();
dbconnect();
if(!isset($_SESSION['id']) && isset($_COOKIE['id'])) {
$u_id=security_sql($_COOKIE['id'],32);
$id_request = mysql_query("select id from users where uniq_id='$u_id'");
if(mysql_num_rows($id_request) == 1) {
$id_mass = mysql_fetch_array($id_request);
$_SESSION['id'] = $id_mass['id'];
}
else die("wrong user data");
}
if(isset($_SESSION['id'])) {
mysql_query("UPDATE users SET last_date='".date("Ymd")."' where id='".$_SESSION['id']."'");
}
}