File $filename opened
"; echo "
Please wait, database createst may take up to 30 minutes..."; flush(); $sql_query = fread($dbf_handle, filesize($db_file)); fclose($dbf_handle); $dejaLance=0; $li = 0; foreach ( explode(";", "$sql_query") as $sql_line) { $li++; if(!mysql_query($sql_line)) { if( mysql_errno()==1062 || mysql_errno()==1061 || mysql_errno()==1044 || mysql_errno()==1065 || mysql_errno()==1060 || mysql_errno()==1054 || mysql_errno()==1091 || mysql_errno()==1061) continue; if( mysql_errno()==1071 ) { echo "
ERROR: line $li: query:[$sql_line] failed, KEY was too long
You need to redo this query later or you will experience severe performance issues.

"; continue; } if(mysql_errno()==1007 || mysql_errno()==1050) { $dejaLance = 1; continue; } echo "
ERROR: line $li: query:[$sql_line] failed
"; echo "mysql error: ".mysql_error()." (err:".mysql_errno().")
"; $nberr++; } echo "."; flush(); } echo "
"; if(!$nberr&&!$dejaLance) echo "
Database successfully generated
"; } else { echo "
ERROR: $db_file needed
"; die(); } } if(isset($_GET["hostname"])) $hostname=$_GET["hostname"]; if(isset($_GET["username"])) $username=$_GET["username"]; if(isset($_GET["pass"])) $pass=$_GET["pass"]; if(isset($_GET["action"])) $action=$_GET["action"]; if(isset($_GET["muser"])) $muser=$_GET["muser"]; if(isset($_GET["mpass"])) $mpass=$_GET["mpass"]; if(isset($_GET["create"])) $create=$_GET["create"]; print(""); print("SAMS (Squid Account Management System)"); print(""); print("
"); print("
SAMS installations
"); if(!function_exists('mysql_connect')) { echo "
ERROR: MySql for PHP is not properly installed.
Try installing mysql for php package
"; die(); } if(!function_exists('gzopen')) { echo "
ERROR: Zlib for PHP is not properly installed.
Try installing Zlib for php package
"; die(); } if(!function_exists('imagecreatetruecolor')) { echo "
ERROR: GD for PHP is not properly installed.
Try installing GD for php package
"; die(); } if (function_exists('ini_get')) { $safe_switch = @ini_get("safe_mode") ? 1 : 0; } if($safe_switch==0) { echo "
ERROR:safe_mode = off Switch php into safe_mode = on


"; } if($action=="createdatabase") { $link=@mysql_connect($hostname,$username,$pass) || die (mysql_error()); $result=mysql_select_db("squidctrl"); if($result==TRUE) { echo "
DB squidctrl connected. Installation script stopped.
Remove base squidctrl and start a script again"; exit(0); } $result=mysql_select_db("squidlog"); if($result==TRUE) { echo "
DB squidlog connected. Installation script stopped.
Remove base squidlog and start a script again"; exit(0); } CreateDatabase("squid_db.sql"); CreateDatabase("sams_db.sql"); echo "

SAMS databases created

"; if($create=="on") { $link=@mysql_connect($hostname,$username,$pass) || die (mysql_error()); echo "
Please wait, create SAMS MySQL user..."; if(!mysql_query("GRANT ALL ON squidctrl.* TO $muser IDENTIFIED BY '$mpass';")) { if( mysql_errno()==1062 || mysql_errno()==1061 || mysql_errno()==1044 || mysql_errno()==1065 || mysql_errno()==1060 || mysql_errno()==1054 || mysql_errno()==1091 || mysql_errno()==1061) continue; if( mysql_errno()==1071 ) { echo "
ERROR: line $li: query:[$sql_line] failed, KEY was too long
You need to redo this query later or you will experience severe performance issues.

"; continue; } } if(!mysql_query("GRANT ALL ON squidlog.* TO $muser IDENTIFIED BY '$mpass';")) { if( mysql_errno()==1062 || mysql_errno()==1061 || mysql_errno()==1044 || mysql_errno()==1065 || mysql_errno()==1060 || mysql_errno()==1054 || mysql_errno()==1091 || mysql_errno()==1061) continue; if( mysql_errno()==1071 ) { echo "
ERROR: line $li: query:[$sql_line] failed, KEY was too long
You need to redo this query later or you will experience severe performance issues.

"; continue; } } echo "
SAMS MySQL user created
"; } print("
\n"); printf("
"); print("
\n"); print("\n"); exit(0); } else { print(""); print("
\n"); print("\n"); print("\n"); print("
MySQL Hostname: \n"); print("
MySQL login: \n"); print("
MySQL password: \n"); print("

Create SAMS MySQL user

\n"); print("

SAMS MySQL user:

\n"); print("
SAMS MySQL user password: \n"); print("
\n"); printf("
"); print("
\n"); print("\n"); print("

SAMS documentation
\n"); print("english
\n"); print("
russian
\n"); } print(""); ?>