// GLOBAL VARIABLES (use only when necessary, change to fit each install) */
$site_title = "Mr Bounds' Teaching Site";
$allow_reg = false;
$dbhost = 'localhost';
$dbuser = 'crehubfi_php';
$dbpass = '*Sud0ku*';
$dbname = 'crehubfi_3bounds';
$con = connect();
function connect() {
global $dbhost, $dbuser, $dbpass, $dbname;
$con=mysql_connect($dbhost,$dbuser,$dbpass) or die('Could not connect: ' . mysql_error());
mysql_select_db($dbname) or die('Could not select database');
// Check connection
return $con;
}
function mysql_auth_user($user,$pass,$table) {
$user = mysql_real_escape_string($user); // ALWAYS sanitize user input
$pass = mysql_real_escape_string(md5($pass));
$table = mysql_real_escape_string($table);
return (mysql_num_rows(mysql_query("SELECT * from `$table` where username = '$user' and password = '$pass'"))>=1);
}
function mysql_exists($var,$val,$table) {
$var = mysql_real_escape_string($var); // ALWAYS sanitize user input
$val = mysql_real_escape_string($val);
$table = mysql_real_escape_string($table);
return (mysql_num_rows(mysql_query("SELECT * from `$table` where $var = '$val'"))>=1);
}
function redirect($r) {
header("Location: $r");
exit();
}
function login($user,$pass,$ip,$destination) {
if(mysql_auth_user($user,$pass,"authentication")) { // success
$_SESSION["username"] = $user;
$_SESSION["password"] = $pass;
redirect($destination);
}
}
function logout() {
unset($_SESSION["username"]);
unset($_SESSION["password"]);
notify("You have been logged out","secure");
}
function logout_silent() {
unset($_SESSION["username"]);
unset($_SESSION["password"]);
//notify("You have been logged out","secure");
}
function send_email($to,$subject="Notification",$message="") {
$from = 'no-reply@'.$_SERVER['HTTP_HOST'];
$return_path = '-f '.$from;
mail($to,$subject,$message,"From: $from\n This email was sent using X-Mailer: PHP/ . $phpversion()");
}
function download($file) {
header("Content-disposition: attachment; filename=$file");
header("Content-type: application/pdf");
readfile($file);
exit;
}
function notify($msg,$class) {
if(isset($msg)) { // NOTIFICATION IS A GO!
?>
}
}
function addSubFolder($str,$sub) {
$str = explode("/",$str);
array_splice($str, count($str) - 1, 0, array($sub));
$str = implode("/",$str);
return $str;
}
function addExt($str,$ext) {
$str = explode(".",$str);
$str[count($str) -1] += $ext;
return implode(".",$str);
}
function replaceExt($str,$ext) {
$str = explode(".",$str);
$str[count($str) -1] = $ext;
return implode(".",$str);
}
?>
if(!isset($_GET['grade_level']) && $_GET['type'] != 'parent') { ?>
} ?>
if($getstarted) { ?>
} else {?>
}
if($allow_testimonials) {
$result = mysql_query("SELECT * from `testimonials`");
if(mysql_num_rows($result) > 0) { ?>
while($row = mysql_fetch_array($result)) { ?>
""
–
}
?>
}
}
?>