// (re)store the user name for other (non-php) pages.
setcookie ("DEMOUser", getenv("REMOTE_USER"));
// connect to the DEMO database
$dbh=mysql_connect("localhost","","") or die("Could not connect: " .mysql_error());
mysql_select_db("db") or die("Select failed: " .mysql_error());
// see if centre record exists for this user
$query="select * from bscentres where user_name='" . getenv("REMOTE_USER") . "'";
$sth=mysql_query($query) or die("Query failed: " . mysql_error() . "
SQL = " . $query);
$num_rows = mysql_num_rows($sth);
# if there is a centre record, display the details
if ($num_rows>0) {
$row=mysql_fetch_array($sth, MYSQL_ASSOC) or die("fetch failed: " . mysql_error());
$centre=$row["centre_name"];
$centrenum=$row["centre_no"];
$usertype=$row["user_type"];
// (re)store the centre details for other (non-php) pages.
setcookie ("DEMOCentreName", $centre);
setcookie ("DEMOCentreNo", $centrenum);
setcookie ("DEMOUserType", $usertype);
} else { # else set vars to blank
$centre="";
$centrenum="";
$usertype="";
setcookie ("DEMOCentreName", "");
setcookie ("DEMOCentreNo", "");
setcookie ("DEMOUserType", "");
}
// close the database connection
mysql_close($dbh) or die("Couldn't close db connection: " . mysql_error());
?>
Hello =getenv("REMOTE_USER")?>, welcome to the PHP Demos members area
// display centre details, if there are any if ($centre != "") { print ("Centre name: $centre Centre number: $centrenum User type: $usertype
\n"); } ?>Online forms and documents - Save your centre information in our database.
Interactive resources - Self-assessment pages, interactive excercises, quizzes, etc.
Level 2 resources for Site and Key Skills training. (Literacy, Numeracy and Information Technology.)
Level 1 resources for Site and Key Skills training. (Literacy, Numeracy and Information Technology.)
Entry Level 3 resources for Site training. (Literacy and Numeracy.)
Entry Level 2 resources for Site training. (Literacy and Numeracy.)
Entry Level 1 resources for Site training. (Literacy and Numeracy.)