Advertisement
Guest User

Untitled

a guest
Jun 20th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.35 KB | None | 0 0
  1. <?php
  2.  
  3.  /**
  4.  *@author Joseph Lazarus
  5.  *@copyright Team PaNiiC
  6.  **/
  7.  
  8.     // Load Local Debug + mySQL Variables
  9.     $dbHost = "127.0.0.1";
  10.     $dbUser = "root";
  11.     $dbPass = "";
  12.     $dbName = "testdb";
  13.     $mySQL_Mode = 1;
  14.     $websiteEnabled = 1;
  15.     $websiteVersion = "1.0";
  16.    
  17.    
  18.     // Will kill the page before the rest of the code is executed, if maintenance is enabled.
  19.     if($websiteEnabled != 1)
  20.     {
  21.         die('<b>Maintenance Mode</b>: The administrator has the website temporairly disabled.');
  22.     }
  23.    
  24.  
  25.     // The cleansing function to prevent SQL Injection
  26.     // Example: $gender = clean($_POST['gender']);
  27.     function clean($str)
  28.     {
  29.         $str = @trim($str);
  30.         if(get_magic_quotes_gpc())
  31.         { $str = stripslashes($str); }
  32.         return mysql_real_escape_string($str);
  33.     }  
  34.    
  35.     if($mySQL_Mode == 1)
  36.     {
  37.         $connect = mysql_connect($dbHost,$dbUser,$dbPass);
  38.    
  39.         if($connect) {
  40.         $select_db = mysql_select_db($dbName, $connect);
  41.         }
  42.    
  43.         if (!$connect) {
  44.         die('<b>Critical Error</b>: The mySQL server could not be found.');
  45.         }
  46.    
  47.         if (!$select_db) {
  48.         die('<b>Critical Error</b>: There was en error selecting the database.');
  49.         }    
  50.     } else { die('mySQL Mode is disabled.'); }
  51.    
  52.    
  53.    
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement