forked from joshf/Indication
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplay.php
More file actions
40 lines (31 loc) · 1.04 KB
/
display.php
File metadata and controls
40 lines (31 loc) · 1.04 KB
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
40
<?php
//Indication, Copyright Josh Fradley (http://github.com/joshf/Indication)
if (!file_exists("config.php")) {
die("Error: Config file not found! Please contact the site administrator.");
}
require_once("config.php");
//Connect to database
@$con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$con) {
die("Error: Could not connect to database (" . mysql_error() . "). Check your database settings are correct.");
}
//Check database exists
$does_db_exist = mysql_select_db(DB_NAME, $con);
if (!$does_db_exist) {
die("Error: Database does not exist (" . mysql_error() . "). Check your database settings are correct.");
}
if (isset($_GET["id"])) {
$id = mysql_real_escape_string($_GET["id"]);
} else {
die("Error: ID cannot be blank.");
}
//If ID exists, show count or else die
$showinfo = mysql_query("SELECT count FROM Data WHERE id = \"$id\"");
$showinforesult = mysql_fetch_assoc($showinfo);
if ($showinforesult != 0) {
echo $showinforesult["count"];
} else {
die("Error: ID does not exist.");
}
mysql_close($con);
?>