Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
crutchy
committed
Feb 28, 2015
1 parent
23d0517
commit e49451a
Showing
12 changed files
with
279 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
##################################################################################################### | ||
|
||
$pdo=new PDO("mysql:host=localhost","www",trim(file_get_contents("../pwd/mysql_www"))); | ||
if ($pdo===False) | ||
{ | ||
die("ERROR CONNECTING TO DATABASE"); | ||
} | ||
|
||
##################################################################################################### | ||
|
||
function fetch_query($sql) | ||
{ | ||
global $pdo; | ||
$statement=$pdo->query($sql); | ||
if ($statement===False) | ||
{ | ||
die("SQL QUERY ERROR\n\n$sql"); | ||
} | ||
return $statement->fetchAll(PDO::FETCH_ASSOC); | ||
} | ||
|
||
##################################################################################################### | ||
|
||
function execute_prepare($sql,$params) | ||
{ | ||
global $pdo; | ||
$statement=$pdo->prepare($sql); | ||
if ($statement===False) | ||
{ | ||
die("SQL PREPARE ERROR\n\n$sql"); | ||
} | ||
foreach ($params as $key => $value) | ||
{ | ||
if (ctype_digit(strval($value))==True) | ||
{ | ||
$statement->bindParam(":$key",$params[$key],PDO::PARAM_INT); | ||
} | ||
else | ||
{ | ||
$statement->bindParam(":$key",$params[$key],PDO::PARAM_STR); | ||
} | ||
} | ||
if ($statement->execute()===False) | ||
{ | ||
die("SQL EXECUTE ERROR\n\n$sql"); | ||
} | ||
} | ||
|
||
##################################################################################################### | ||
|
||
function fetch_prepare($sql,$params) | ||
{ | ||
global $pdo; | ||
$statement=$pdo->prepare($sql); | ||
if ($statement===False) | ||
{ | ||
die("SQL PREPARE ERROR\n\n$sql"); | ||
} | ||
foreach ($params as $key => $value) | ||
{ | ||
if (ctype_digit(strval($value))==True) | ||
{ | ||
$statement->bindParam(":$key",$value,PDO::PARAM_INT); | ||
} | ||
else | ||
{ | ||
$statement->bindParam(":$key",$value,PDO::PARAM_STR); | ||
} | ||
} | ||
if ($statement->execute()===False) | ||
{ | ||
die("SQL EXECUTE ERROR\n\n$sql"); | ||
} | ||
return $statement->fetchAll(PDO::FETCH_ASSOC); | ||
} | ||
|
||
##################################################################################################### | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
DROP DATABASE IF EXISTS exec_log; | ||
CREATE DATABASE IF NOT EXISTS exec_log DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; | ||
|
||
CREATE TABLE `exec_log`.`irc.sylnt.us` ( | ||
`id` integer unsigned NOT NULL AUTO_INCREMENT, | ||
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
`data` varchar(1000) NOT NULL, | ||
`prefix` varchar(255) NOT NULL, | ||
`params` varchar(255) NOT NULL, | ||
`trailing` varchar(500) NOT NULL, | ||
`user` varchar(255) NOT NULL, | ||
`nick` varchar(100) NOT NULL, | ||
`hostname` varchar(255) NOT NULL, | ||
`destination` varchar(100) NOT NULL, | ||
`cmd` varchar(20) NOT NULL, | ||
PRIMARY KEY (`id`), | ||
INDEX `timestamp` (`timestamp` ASC), | ||
INDEX `params` (`params` ASC), | ||
INDEX `trailing` (`trailing` ASC), | ||
INDEX `nick` (`nick` ASC), | ||
INDEX `cmd` (`cmd` ASC), | ||
INDEX `hostname` (`hostname` ASC), | ||
INDEX `destination` (`destination` ASC) | ||
) ENGINE=InnoDB AUTO_INCREMENT=1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
define("DB_HOST","localhost"); | ||
define("DB_USER","root"); | ||
define("DB_PASSWORD",trim(file_get_contents("../../../pwd/mysql_root_cs"))); | ||
|
||
$pdo=new PDO("mysql:host=".DB_HOST,DB_USER,DB_PASSWORD); | ||
if ($pdo===False) | ||
{ | ||
die("ERROR CONNECTING TO MYSQL SERVER\n"); | ||
} | ||
else | ||
{ | ||
echo "CONNECTED\n"; | ||
} | ||
$sql=file_get_contents("schema_log.sql"); | ||
$result=$pdo->exec($sql); | ||
if ($result===False) | ||
{ | ||
die("ERROR CREATING DATABASE\n"); | ||
} | ||
else | ||
{ | ||
echo "DATABASE CREATED\n"; | ||
} | ||
$result=$pdo->exec("GRANT SELECT, INSERT, UPDATE, DELETE ON news_my_to.* TO www@'%';"); | ||
if ($result===False) | ||
{ | ||
die("ERROR GRANTING PRIVILEGES\n"); | ||
} | ||
else | ||
{ | ||
die("PRIVILEGES GRANTED\n"); | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.