-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfunctions.php.default
executable file
·63 lines (45 loc) · 1.64 KB
/
functions.php.default
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
<?php
function sqlconnect()
{
$dbhost="DBNAME";
$dbuser="USER";
$dbpassword="PASS";
$dbname="DBNAME";
$db = mysql_connect($dbhost,$dbuser,$dbpassword) or die("Couldn't connect to the database.");
mysql_select_db($dbname) or die("Couldn't select the database");
}
function generatepassword()
{
// *************************
// Random Password Generator
// *************************
$totalChar = 32; // number of chars in the password
$salt = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789"; // salt to select chars from
srand((double)microtime()*1000000); // start the random generator
$password=""; // set the inital variable
for ($i=0;$i<$totalChar;$i++) // loop and create password
$password = $password . substr ($salt, rand() % strlen($salt), 1);
return $password;
}
function togoto ($loca)
{
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
header("Location: http://$host$uri/$loca");
exit;
}
function writelog($result){
sqlconnect();
# $handle=fopen("/data/webroot/autox.ggcbmwcca.org/html/axlogs/axlog.txt", "a");
$datenow = date("Y-m-d");
$timenow = date("G:i:s");
$result = mysql_query("INSERT INTO logs VALUES ('$datenow', '$timenow', '$_SERVER[REMOTE_ADDR]', '$result')") or die("Error: " . mysql_error());
# fwrite($handle, $now . "$_SERVER[REMOTE_ADDR] - " . $result . "\n");
# fclose($handle);
}
function echoActiveClassIfRequestMatches($requestUri)
{
$current_file_name = basename($_SERVER['REQUEST_URI'], ".php");
if ($current_file_name == $requestUri)
echo 'class="active"';
}