42 |
function sessionClass($duration, $session_id, $staff_account) { |
function sessionClass($duration, $session_id, $staff_account) { |
43 |
|
|
44 |
// Set the database connection variables |
// Set the database connection variables |
45 |
$this->con_session = @mysql_connect ( $this->db_session_srv, $this->db_session_usr, $this->db_session_pwd ) |
$this->con_session = @xx_connect ( $this->db_session_srv, $this->db_session_usr, $this->db_session_pwd ) |
46 |
or die ( "ERROR: Could not connect to database server!" ); |
or die ( "ERROR: Could not connect to database server!" ); |
47 |
$this->result_session = mysql_select_db ( $this->db_session, $this->con_session ) |
$this->result_session = xx_select_db ( $this->db_session, $this->con_session ) |
48 |
or die ( "ERROR: Could not connect to database!" ); |
or die ( "ERROR: Could not connect to database!" ); |
49 |
|
|
50 |
// Fetch user ip |
// Fetch user ip |
102 |
. $time_expire |
. $time_expire |
103 |
. "')"; |
. "')"; |
104 |
|
|
105 |
// mysql_query ("LOCK TABLE session WRITE", $this->con_session); |
// xx_query ("LOCK TABLE session WRITE", $this->con_session); |
106 |
if (!mysql_query($sql, $this->con_session)){ |
if (!xx_query($sql, $this->con_session)){ |
107 |
mysql_query ("UNLOCK TABLES", $this->con_session); |
xx_query ("UNLOCK TABLES", $this->con_session); |
108 |
$this->bailout(); |
$this->bailout(); |
109 |
} |
} |
110 |
else { |
else { |
111 |
mysql_query("UNLOCK TABLES", $this->con_session); |
xx_query("UNLOCK TABLES", $this->con_session); |
112 |
} |
} |
113 |
|
|
114 |
|
|
189 |
|
|
190 |
// The SQL |
// The SQL |
191 |
$sql = "SELECT * FROM session where session_id = '" . $hash . "'"; |
$sql = "SELECT * FROM session where session_id = '" . $hash . "'"; |
192 |
$rs = mysql_query($sql, $con_session); |
$rs = xx_query($sql, $con_session); |
193 |
$duplicate = mysql_num_rows($rs); |
$duplicate = xx_num_rows($rs); |
194 |
if ($duplicate > 0) { |
if ($duplicate > 0) { |
195 |
$duplicate = 1; |
$duplicate = 1; |
196 |
$hash = "0"; |
$hash = "0"; |
229 |
. "' AND user_ip = '" |
. "' AND user_ip = '" |
230 |
. $user_ip |
. $user_ip |
231 |
."'"; |
."'"; |
232 |
$rs = mysql_query($sql, $con_session); |
$rs = xx_query($sql, $con_session); |
233 |
$valid = mysql_num_rows($rs); |
$valid = xx_num_rows($rs); |
234 |
$row = mysql_fetch_array ($rs); |
$row = xx_fetch_array ($rs); |
235 |
$time_human = $row["time_human"]; |
$time_human = $row["time_human"]; |
236 |
$time_unix = $row["time_unix"]; |
$time_unix = $row["time_unix"]; |
237 |
$time_expire = $row["time_expire"]; |
$time_expire = $row["time_expire"]; |
292 |
. $user_ip |
. $user_ip |
293 |
. "'"; |
. "'"; |
294 |
|
|
295 |
//mysql_query ("LOCK TABLE session WRITE", $con_session); |
//xx_query ("LOCK TABLE session WRITE", $con_session); |
296 |
if (!mysql_query($sql, $con_session)){ |
if (!xx_query($sql, $con_session)){ |
297 |
mysql_query ("UNLOCK TABLES", $con_session); |
xx_query ("UNLOCK TABLES", $con_session); |
298 |
$this->bailout(); |
$this->bailout(); |
299 |
} |
} |
300 |
else { |
else { |
301 |
mysql_query("UNLOCK TABLES", $con_session); |
xx_query("UNLOCK TABLES", $con_session); |
302 |
$this->setProperties($session_id, $user_ip); |
$this->setProperties($session_id, $user_ip); |
303 |
} |
} |
304 |
|
|
329 |
|
|
330 |
$sql = "DELETE FROM session where time_expire < " . $time_unix; |
$sql = "DELETE FROM session where time_expire < " . $time_unix; |
331 |
|
|
332 |
if (!mysql_query($sql, $con_session)){ |
if (!xx_query($sql, $con_session)){ |
333 |
sql_err($con_session); |
sql_err($con_session); |
334 |
mysql_query ("UNLOCK TABLES", $con_session); |
xx_query ("UNLOCK TABLES", $con_session); |
335 |
bailout(); |
bailout(); |
336 |
} |
} |
337 |
else { |
else { |
338 |
mysql_query("UNLOCK TABLES", $con_session); |
xx_query("UNLOCK TABLES", $con_session); |
339 |
} |
} |
340 |
} // end of function |
} // end of function |
341 |
} // end of class |
} // end of class |