/[libdata]/branches/paul_xx/admin/include/accessClass.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

Annotation of /branches/paul_xx/admin/include/accessClass.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 67 - (hide annotations)
Thu Mar 18 19:24:54 2004 UTC (20 years, 2 months ago) by dpavlin
Original Path: branches/paul/admin/include/accessClass.php
File size: 3915 byte(s)
updated to libdata 2.00

1 dpavlin 31 <?php
2     class accessClass {
3    
4     /**********************************************************
5     accessClass Properties
6     Author: Paul Bramscher
7     Last Modified: 05.05.2003
8     ***********************************************************
9     Comments:
10     For documentation, see separate Word-format .DOC file.
11     **********************************************************/
12     var $access_level;
13     var $access;
14     var $first_name;
15     var $last_name;
16     var $staff_id;
17    
18    
19     // Database variables
20     var $db_ac = "libdata";
21 dpavlin 67 var $db_ac_srv = "yourlibrary.edu";
22 dpavlin 31 var $db_ac_usr = "libdata";
23 dpavlin 67 var $db_ac_pwd = "changEth1s";
24 dpavlin 31
25 dpavlin 67
26 dpavlin 31 /**********************************************************
27     Constructor Method: accessClass
28     Author: Paul Bramscher
29     Last Modified: 10.09.2002
30     ***********************************************************
31     Comments:
32     Sets the properties.
33     **********************************************************/
34     function accessClass($sessionClass) {
35    
36     // Set the database connection variables
37     $this->con_ac = @mysql_connect ( $this->db_ac_srv, $this->db_ac_usr, $this->db_ac_pwd )
38     or die ( "ERROR: Could not connect to database server!" );
39     $this->result_ac = mysql_select_db ( $this->db_ac, $this->con_ac )
40     or die ( "ERROR: Could not connect to database!" );
41    
42    
43     // Initialize for security purposes
44     $valid = 0;
45     $access_level = 0;
46     $access = "";
47     $current_ip = "";
48     $user_ip = "";
49     $first_name = "";
50     $last_name = "";
51     $staff_id = 0;
52    
53     // Fetch current user ip
54     $current_ip = $GLOBALS["REMOTE_ADDR"];
55    
56     // Pull out some properties from the incoming sessionClass object
57     $valid = $sessionClass->valid;
58     $staff_account = $sessionClass->staff_account;
59     $user_ip = $sessionClass->user_ip;
60    
61     // Look the user up in staff table
62     if ($valid > 0 && strlen($staff_account) > 0 && $current_ip == $user_ip) {
63     $sql = "SELECT a.access_level, a.access, s.staff_id, s.last_name, s.first_name
64     FROM staff s, access a WHERE s.access_id = a.access_id AND s.staff_account = '"
65     . $staff_account
66     . "'";
67     $rs = mysql_query($sql, $this->con_ac);
68     $row = mysql_fetch_array ($rs);
69     $access_level = $row["access_level"];
70     $access = $row["access"];
71     $first_name = $row["first_name"];
72     $last_name = $row["last_name"];
73     $staff_id = $row["staff_id"];
74    
75     // Set valid equal to the access level
76     $valid = $access_level;
77    
78     }
79    
80    
81     // Set the object properties
82     $this->setProperties($access, $first_name, $last_name, $staff_id, $valid);
83    
84     }
85    
86    
87     /**********************************************************
88     Method: bailout
89     Author: Paul Bramscher
90     Last Modified: 10.04.2001
91     ***********************************************************
92     Comments:
93     Attempt to gracefully finish out HTML in the event of a
94     severe mySQL database problem.
95     **********************************************************/
96     function bailout() {
97     die ( "Bailing Out!<br>\n</body></html>\n" );
98     }
99    
100    
101     /**********************************************************
102     Method: setProperties
103     Author: Paul Bramscher
104     Last Modified: 10.09.2002
105     ***********************************************************
106     Comments:
107     This member function sets the $access_level, $time_human,
108     $user_up, and $staff_account properties of an instantiation of the
109     credentialsClass object. It is called whenever the class is
110     instantiated.
111     **********************************************************/
112     function setProperties($access, $first_name, $last_name, $staff_id, $valid) {
113    
114     // Valid session, load all of the member properties.
115     if ($valid > 0) {
116     $this->access_level = $valid;
117     $this->access = $access;
118     $this->first_name = $first_name;
119     $this->last_name = $last_name;
120     $this->staff_id = $staff_id;
121     }
122     // Expired or invalid. Reset all of the member properties.
123     else {
124     $this->access_level = 0;
125     $this->access = "";
126     $this->first_name = "";
127     $this->last_name = "";
128     $this->staff_id = 0;
129     }
130     }
131    
132     } // end of class
133     ?>

  ViewVC Help
Powered by ViewVC 1.1.26