| Current Path : /var/www/cesa.co.za/members/inc/ |
| Current File : /var/www/cesa.co.za/members/inc/dont-click.prefs.inc |
<?php
// User Preferences
// This file should contain all User Preference Variables that should
// be populated per user from the database pref table
// to allow for speedier processing, cookies should be considered
// i.e. check cookies, no cookies, check database for preference, set variables = values, update cookie.
// It is recommended that we use a eval string as a single cookie rather than multiple cookies to prevent users having to accept many
// Where numeric, 0 (zero) represents 'off' and the value represents the number of records to show.
// negative 1 means 'show last 7 days'
//Check to see if cookie exists. If yes, do nothing. If not, create cookie from prefs database.
/*
if (!isset($SaaceMprefs) || $forcecookie==1) {
//echo "Cookie not set";
include('inc/conf.inc');
$dbc = mysql_connect($server,$user,$pass);
mysql_select_db($db,$dbc);
// Built sql statement
$sql="SELECT
prefs.calendar AS calendar,
prefs.docs AS docs,
prefs.work AS work,
prefs.press AS press,
user.firstname AS firstname,
user.lastname AS lastname,
user.email AS email,
user.type AS type
FROM prefs, user WHERE prefs.userid = user.userid AND user.userid = '$loginid'";
//echo $sql;
// Get Result returned
$result = mysql_query($sql);
if ($result_rows = mysql_num_rows($result)> 0) {
while ($row = mysql_fetch_array($result)) {
$calendar = $row["calendar"];
//echo $calendar."<br>\n";
$documentaccess = $row["docs"];
//echo $documentaccess."<br>\n";
$workopps = $row["work"];
//echo $workopps."<br>\n";
$pressrowlimit = $row["press"];
//echo $pressrowlimit."<br>\n";
$firstname = $row["firstname"];
//echo $firstname."<br>\n";
$lastname = $row["lastname"];
//echo $lastname."<br>\n";
$email = $row["email"];
//echo $email."<br>\n";
$type = $row["type"];
//echo $type."<br>\n";
// Text to use for cookie in the follwing order:
// firstname, lastname, email, type, calendar, documentaccess, workopps, pressrowlimit
// seperated by question mark (?).
$encode = base64_encode($firstname."?".$lastname."?".$email."?".$type."?".$calendar."?".$documentaccess."?".$workopps."?".$pressrowlimit);
setcookie ("SaaceMprefs", "", time()-30);
setcookie ("SaaceMprefs", $encode,time()+3600);
$redir = "http://". getenv("SERVER_NAME"). getenv("REQUEST_URI");
list ($redirect) = split ('[?]', $redir);
//echo $redirect;
//echo phpinfo();
header ("Location: $redirect");
}
} else {
systemerror("No Matching User.", "There is no preferences data for your user", getenv ("PATH_INFO"), "Please contact SAACE.");
}
mysql_free_result($result);
} else {
//echo "Cookie already set";
$decode = base64_decode($SaaceMprefs);
//echo $decode;
list ($firstname, $lastname, $email, $type, $calendar, $documentaccess, $workopps, $pressrowlimit) = split ('[?]', $decode);
/*echo $calendar."<br>\n";
echo $documentaccess."<br>\n";
echo $workopps."<br>\n";
echo $pressrowlimit."<br>\n";
echo $firstname."<br>\n";
echo $lastname."<br>\n";
echo $email."<br>\n";
echo $type."<br>\n";*/
/*
// Note, the following is purely a variable for the navigation menu in showing the link to the documents.
// Document access should NOT be based on this alone and access must be checked at time of document retrieval.
//$groupname = "friends";
//$groupadmin = "y";
}
*/
?>