Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function PreSearch($nick,$chan,$arg){
- //DB creds
- $dbHost = '***';
- $dbUser = '***';
- $dbPass = '***';
- $dbDatabase = '***';
- $dbTable = '***';
- $link = mysql_connect($dbHost, $dbUser, $dbPass) or die("Failed to connect to MySQL Server. Error: " . mysql_error());
- mysql_select_db($dbDatabase) or die("Failed to connect to database {$dbDatabase}. Error: " . mysql_error());
- $get_id = "select id FROM predb WHERE rlsname LIKE '%{$arg}%' ORDER BY FROM_UNIXTIME(ctime) DESC LIMIT 1";
- $query_id = mysql_query($get_id);
- $result_id = mysql_result($query_id,id);
- if ($result_id == NULL) {
- send("PRIVMSG",$chan,"[b][c]2,0PRE[b][c] Result [c]12,0::[c] Nothing found...\n");
- }
- else {
- $get = "select FROM_UNIXTIME(ctime) FROM predb WHERE id =".$result_id." ORDER BY FROM_UNIXTIME(ctime) DESC LIMIT 1";
- $get2 = "select rlsname FROM predb WHERE id =".$result_id." ORDER BY FROM_UNIXTIME(ctime) DESC LIMIT 1";
- $get3 = "select section FROM predb WHERE id =".$result_id." ORDER BY FROM_UNIXTIME(ctime) DESC LIMIT 1";
- $get4 = "select size FROM predb WHERE id =".$result_id." ORDER BY FROM_UNIXTIME(ctime) DESC LIMIT 1";
- $get5 = "select files FROM predb WHERE id =".$result_id." ORDER BY FROM_UNIXTIME(ctime) DESC LIMIT 1";
- $query = mysql_query($get);
- $query2 = mysql_query($get2);
- $query3 = mysql_query($get3);
- $query4 = mysql_query($get4);
- $query5 = mysql_query($get5);
- $result = mysql_result($query,id);
- $result2 = mysql_result($query2,id);
- $result3 = mysql_result($query3,id);
- $result4 = mysql_result($query4,id);
- $result5 = mysql_result($query5,id);
- $time = duration_time($result);
- if( ($result == NULL) || ($result2 == NULL) || ($result3 == NULL) ) {
- send("PRIVMSG",$chan,"[b][c]2,0PRE[b][c] Result [c]12,0::[c] Nothing found...\n");
- }
- elseif ( ($result5 == NULL) && ($result4 == NULL) ) {
- send("PRIVMSG",$chan,"[b][c]2,0PRE[b][c] Result [c]12,0::[c] $result2 pre'd in $result3 $time ago. [b][c]12,0[[c][b] $result [b][c]12,0][b][c]\n");
- }
- elseif ( ($result5 == NULL) && ($result4 != NULL ) ) {
- send("PRIVMSG",$chan,"[b][c]2,0PRE[b][c] Result [c]12,0::[c] $result2 pre'd in $result3 $time ago. [b][c]12,0[[c][b] $result [b][c]12,0][b][c] [b][c]12,0[[c][b] $result4 MB [b][c]12,0][b][c]\n");
- }
- elseif ( ($result5 != NULL) && ($result4 == NULL ) ) {
- send("PRIVMSG",$chan,"[b][c]2,0PRE[b][c] Result [c]12,0::[c] $result2 pre'd in $result3 $time ago. [b][c]12,0[[c][b] $result [b][c]12,0][b][c] [b][c]12,0[[c][b] $result5 Files [b][c]12,0][b][c]\n");
- }
- else {
- send("PRIVMSG",$chan,"[b][c]2,0PRE[b][c] Result [c]12,0::[c] $result2 pre'd in $result3 $time ago. [b][c]12,0[[c][b] $result [b][c]12,0][b][c] [b][c]12,0[[c][b] $result4 MB in $result5 files. [b][c]12,0][b][c]\n");
- }
- }
- mysql_close($link);
- }
- //////////////// how it's passed
- if($word[0] == ".pre") {
- if($chan == "#pre.admin") {
- PreSearch($nick,$chan,$word[1]);
- }
- elseif($chan == "#pre.search") {
- PreSearch($nick,$chan,$word[1]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement