include("/home/httpd/common/p.php");
//> redirect to "/"
$uri = $_SERVER['REQUEST_URI'];
$uri_ch=strpos($uri, '?');
if ($uri_ch!==false) {
$uri_reminder=substr($uri,$uri_ch);
$uri=substr($uri,0,$uri_ch);
}
$last_level_name=substr($uri,strrpos($uri, "/")+1);
if (($uri{strlen($uri)-1} !== '/')) {
if (strpos($last_level_name, ".")===false) {
header("HTTP/1.1 301");
header("Location: http://".getenv('HTTP_HOST')."$uri/$uri_reminder");
exit();
}
}
//<
if (substr($uri, -1) == "/" || substr($uri, -10) == "index.html") {
$levels += 1;
$lastlevelname = "level".($levels-1);
$$lastlevelname = "index.html";
}
foreach ($GLOBALS as $var=>$val) {
global $$var;
if (substr($var, 0, 5) == 'post_') {
if (is_array($$var)) {
$arr = array();
foreach($$var as $name=>$value) {
$arr[$name] = stripslashes($value);
}
$$var = $arr;
} else {
$$var = stripslashes($val);
}
}
}
//>> temp log ip addresses
$ipp = $_SERVER['REMOTE_ADDR'];
$urr = $_SERVER['REQUEST_URI'];
syslog(LOG_INFO, "pregpool.com ip=$ipp, url=$urr");
//<<
include("db_connect.php");
include("homelink.php");
include_once("functions.php");
//> init
$level0 = str_replace(" ", "+",$level0);
if (empty($level0)) $level0="index.html";
$title = "Preg Pool: Free Online Guessing Pool. ";
session_start();
$sess_userid = GetUserId();
$sess_user = GetUser($sess_userid);
if (empty($sess_user)) $sess_userid = 0;
setcookie("bptrycook", '3289076503', 0, "/");
//<
// goto lower levels
switch ($level0) {
case 'games' :
$samples_on = 0;
include('games.php');
break;
case 'samples' :
$samples_on = 1;
include('games.php');
exit(0);
break;
case 'search' :
$samples_on = 2;
include('games.php');
exit(0);
break;
case 'taketour' :
include('taketour/index.php');
exit(0);
break;
case 'homepage' :
if (!$sess_userid) {
include('loginfailed.php');
exit(0);
} else {
$arr = current(SelectDB("bp_user", "firstname, lastname", "id='$sess_userid'", 0));
$sess_firstname = $arr[firstname];
$sess_lastname = $arr[lastname];
include('homepage/index.php');
exit(0);
}
break;
case 'online' :
if ($level1 == 'index.html') {
$error_game = 1;
} else {
$arr = current(SelectDB("bp_user_game",
"id, gamename, date_format(duedate, '%M %e, %Y') as duedate, mother_firstname, mother_lastname,
(unix_timestamp(closed_date) <= unix_timestamp()) as isclosed, cost, is_pound, winner_procent,
date_format(closed_date, '%e %M %Y') as closed_date,
date_format(birthday, '%e %M %Y') as birthday, is_boy, welcomenote",
"gamename='".qu($level1)."'", 0));
if (empty($arr))
$error_game=1;
}
if ($error_game) {
include('online/error_game.php');
} else {
$online_isclosed = $arr[isclosed];
$online_closedate = $arr[closed_date];
$online_gameid = $arr[id];
$online_game = $arr[gamename];
$online_mother_firstname = $arr[mother_firstname];
$online_mother_lastname = $arr[mother_lastname];
$online_duedate = $arr[duedate];
$online_cost = $arr[cost];
$online_ispound = $arr[is_pound];
$online_winproc = $arr[winner_procent];
$online_isboy = $arr[is_boy];
$online_welcomenote = $arr[welcomenote];
$online_birthday = $arr[birthday];
include('online/index.php');
exit(0);
}
break;
}
// goto page error
if ($level1 && $level1 != 'index.html') {
include('error.php');
}
# goto contents
switch ($level0) {
case 'index.html' :
include('welcome.php');
break;
case 'logout' :
Logout();
$sess_userid = 0;
$sess_user = "";
include('games.php');
break;
case 'signup.html' :
include('signup.php');
break;
case 'loginfailed.html' :
include('loginfailed.php');
break;
case 'forgotpass.html' :
include('forgotpass.php');
break;
case 'rules.html':
include('rules.php');
break;
case 'rules_win.html' :
include('rules_win.php');
exit(0);
break;
case 'terms.html' :
include('terms.php');
break;
case 'terms_win.html' :
include('terms_win.php');
exit(0);
break;
case 'privacy.html' :
include('privacy.php');
break;
case 'privacy_win.html' :
include('privacy_win.php');
exit(0);
break;
case 'contactus.html' :
$title .= 'Contact Us.';
include("header_top.php");
include("contact.php");
break;
case 'aboutus.html' :
include('aboutus.php');
break;
case 'paypal_done.html' :
include('paypal_done.php');
break;
case 'paypal_canceled.html' :
include('paypal_canceled.php');
break;
case 'finish_game.html' :
global $get_game;
global $get_email;
global $get_pass;
//check
$arr = current(SelectDB("bp_user_game as g left join bp_user as u on u.id=g.user_id", "u.firstname, u.lastname, gamename, is_pound, g.id, (unix_timestamp(closed_date) <= unix_timestamp()) as isclosed, winner_id", "gamename='$get_game'", 0));
$sess_firstname = $arr[firstname];
$sess_lastname = $arr[lastname];
$sess_game = $arr[gamename];
$sess_ispound = $arr[is_pound];
$sess_gameid = $arr[id];
$sess_isclosed = $arr[isclosed];
if (empty($arr)) {
include('online/error_game.php');
}
if ($arr[winner_id] != 0) {
echo "";
exit(0);
}
$unsub = (crypt($get_email.$get_game, 'bfazpy42nbxd5lq25kj') == $get_pass);
if (empty($unsub)) {
echo "Provided information is wrong. Check it and try again.";
exit(0);
}
include('homepage/game/finish.php');
break;
default:
include('error.php');
}
include("footer.php");
# end of content
?>