SHARE
TWEET

Untitled

a guest Jun 14th, 2017 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /////////////// site 4 db /////////////////
  2. if($sitenr==4 && isset($_POST["check4"])) {
  3.     $_SESSION["dbcheck"]=false;
  4.     $dbhost=trim($_POST["dbhost"]);
  5.     $dbuser=trim($_POST["dbuser"]);
  6.     $dbpass=trim($_POST["dbpass"]);
  7.     $dbdb=trim($_POST["dbdb"]);
  8.     $dbprefix=trim($_POST["dbprefix"]);
  9.    
  10.     $_SESSION["dbhost"]=$dbhost;
  11.     $_SESSION["dbuser"]=$dbuser;
  12.     $_SESSION["dbpass"]=$dbpass;
  13.     $_SESSION["dbdb"]=$dbdb;
  14.     $_SESSION["dbprefix"]=$dbprefix;
  15.    
  16.     $smarty->assign("db",array($dbhost,$dbuser,$dbpass,$dbdb,$dbprefix));
  17.    
  18.     if($dbhost=="" || $dbuser=="" || $dbdb=="" || $dbprefix=="") {
  19.         $msg="_NOREQUIREDFIELDS";
  20.     }
  21.    
  22.     $mysql=@mysql_connect($dbhost,$dbuser,$dbpass) or $msg="_CANTCONNECT";
  23.     if(!$msg) $ressource=@mysql_select_db($dbdb) or $msg="_CANTSELECTDB";
  24.    
  25.     //get user privileges
  26.     if(!$msg) {
  27.         $previleges=sql_get_privilege();
  28.         $prev[]=array("name"=>"SELECT","value"=>in_array("SELECT",$previleges));
  29.         $prev[]=array("name"=>"INSERT","value"=>in_array("INSERT",$previleges));
  30.         $prev[]=array("name"=>"UPDATE","value"=>in_array("UPDATE",$previleges));
  31.         $prev[]=array("name"=>"DELETE","value"=>in_array("DELETE",$previleges));
  32.         $prev[]=array("name"=>"CREATE","value"=>in_array("CREATE",$previleges));
  33.         //search for all needed previleges
  34.         foreach($prev as $k => $v) {
  35.             if(in_array(false,$v)) {$msg="_NOTALLPREVILEGES";break;}
  36.         }
  37.     }
  38.     //check for existing tables
  39.     if(!$msg) {
  40.         $ressource=@mysql_select_db($dbdb);
  41.         //search for existing dbprefix
  42.         if( mysql_num_rows( @mysql_query("SHOW TABLES FROM `".$dbdb."` LIKE '".$dbprefix."\_%'"))) {
  43.             $prefix_exists=true;
  44.             //search for field "imported" in bans table, added since 6.0
  45.             if( mysql_num_rows( @mysql_query("SHOW COLUMNS FROM `".$dbprefix."_bans` WHERE Field LIKE 'imported'"))) {
  46.                 $prefix_isnew=true;
  47.             }
  48.         }
  49.     }
  50.    
  51.     $smarty->assign("prevs",$prev);
  52.    
  53.     if(!$msg) {
  54.         if($prefix_exists) {
  55.             if($prefix_isnew) {
  56.                 $msg="_PREFIXEXISTSV6";
  57.                 $_SESSION["dbcheck"]=true;
  58.                 $smarty->assign("next",true);
  59.             } else {
  60.                 $msg="_PREFIXEXISTSV5";
  61.             }
  62.         } else {
  63.             $msg="_DBOK";
  64.             $_SESSION["dbcheck"]=true;
  65.             $smarty->assign("next",true);
  66.         }
  67.     }
  68. }
  69. if($sitenr==4) $smarty->assign("checkvalue","_DBCHECK");
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top