-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathauth.php
93 lines (83 loc) · 2.53 KB
/
auth.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
//this file contains the wrapper functions for the database connection
$path="../../";
require($path."server/library/configuration.php");
function db_connect($host, $dbname, $user, $password)
{
$conn = mysql_connect($host, $user, $password);
$db = mysql_select_db($dbname, $conn);
if ($db && $conn)
{
return $conn;
}
else
{
return false;
}
}
//$conn=db_connect($host, $dbname, $user, $password);
if (!($conn = db_connect($host, $dbname, $dbuser, $dbpass)))
{
$error= "Hello webmaster.\n\nUnable to connect to the database. Following variable values used\n\n host=$host dbname=$dbname user=$dbuser password=$dbpass";
@mail(webmaster, "Unable to connect to database", $error, "From: <webadmin>");
echo("Unable to connect to database. Sorry for the inconvinience. The webmaster has been informed");
}
//db_query("select * from email_users", $conn);
function db_query($sql, $fatal=true)
{
global $user;
global $conn;
$status=mysql_query($sql, $conn);
if (!$status AND $fatal)
{
$error= "Hello webmaster.\n\nUnable to execute the following sql query. \n $sql by $user";
@mail(webmaster, "Unable to execute db_query", $error, "From: <webadmin>");
// echo("Unable to execute the required query. The webmaster has been informed.");
}
return $status;
}
function db_numrows($result)
{
$status=@mysql_num_rows($result);
// echo "no. of rows $status";
if (!isset($status))
{
$error= "Hello webmaster.\n\nUnable to execute db_numrows. Following is the resource id \n $result";
@mail(webmaster, "Unable to execute db_numrows", $error, "From: <webadmin@temp.edu>");
//message("Unable to execute pg_numrows. The webmaster has been informed.");
}
else
{
return $status;
}
}
function db_fetch_row($result)
{
$status=mysql_fetch_row($result);
if (!$status)
{
$error= "Hello webmaster.\n\nUnable to execute pg_fetch_row. Following is the resource id and row number \n $result \n $row";
@mail(webmaster, "Unable to execute pg_fetch_row", $error, "From: <webadmin@temp.edu>");
// message("Unable to execute pg_fetch_row. The webmaster has been informed.");
}
else
{
return $status;
}
}
function db_affected_rows()
{
global $conn;
$status=mysql_affected_rows($conn );
if (!isset($status))
{
$error= "Hello webmaster.\n\nUnable to execute pg_affected_rows. Following is the resource id \n $result";
@mail(webmaster, "Unable to execute pg_affected_row", $error, "From: <webadmin@temp.edu>");
// message("Unable to execute pg_affected_rows. The webmaster has been informed.");
}
else
{
return $status;
}
}
?>