/[libdata]/branches/paul_xx/admin/include/sessionClass.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /branches/paul_xx/admin/include/sessionClass.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/paul/admin/include/sessionClass.php revision 68 by dpavlin, Thu Mar 18 19:24:54 2004 UTC branches/paul_xx/admin/include/sessionClass.php revision 69 by dpavlin, Thu Mar 18 20:01:09 2004 UTC
# Line 42  writes it into a table. Line 42  writes it into a table.
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
# Line 102  function sessionClass($duration, $sessio Line 102  function sessionClass($duration, $sessio
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    
# Line 189  function generateSessionID() { Line 189  function generateSessionID() {
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";
# Line 229  function setProperties($session_id, $use Line 229  function setProperties($session_id, $use
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"];
# Line 292  function logoutSessionID() { Line 292  function logoutSessionID() {
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                                    
# Line 329  function expireSessions() { Line 329  function expireSessions() {
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

Legend:
Removed from v.68  
changed lines
  Added in v.69

  ViewVC Help
Powered by ViewVC 1.1.26