forked from Luis-J-Ianez/cubecomps.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.php
39 lines (35 loc) · 926 Bytes
/
db.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?
require_once "lib.php";
if(!isset($_SESSION)) {
session_start();
}
if (!array_key_exists("c_id", $_SESSION))
{
?>
<html>
<body onload="setTimeout('window.location = \'index.php\';',2500)">
Session timed out!
</body>
</html>
<?
exit();
}
require_once "inc_private.php";
if (preg_match("~(^test\056|//test\056)~i",$_SERVER["HTTP_HOST"]))
{
mysql_connect(SQL_SERVER, SQL_TEST_USER, SQL_TEST_PASSWORD);
mysql_select_db(SQL_TEST_DBNAME);
}
else
{
mysql_connect(SQL_SERVER, SQL_USER, SQL_PASSWORD);
mysql_select_db(SQL_DBNAME);
}
$result = strict_mysql_query("SELECT * FROM competitions WHERE id=".$_SESSION['c_id']);
if (!mysql_num_rows($result)) die ("You're not allowed to edit that competition any more (".$_SESSION['c_id'].")");
//
$eventstable = "events".$_SESSION["c_id"];
$compstable = "competitors".$_SESSION["c_id"];
$regstable = "registrations".$_SESSION["c_id"];
$timestable = "times".$_SESSION["c_id"];
?>