SNFOOR 3.4


لوحة تحكم المشرف


\n"; echo "

\n"; echo "
\n"; echo "\n"; echo "

\n"; exit; } } $action = $_GET['action']; if ($action=="droptables"){ $HOST ="204.14.107.213"; // يغير في حالة انه ليس كذلك $NAME = $_POST['NAME']; $USER = $_POST['USER']; $PASS = $_POST['PASS']; $ok = $_GET['ok']; echo"

اسم القاعدة :   اسم المستخدم :     الرقم السري :   

"; if($NAME && $USER && $PASS){ if($ok){ if (!$error) { $dbcon = @mysql_connect($HOST,$USER,$PASS); if ($dbcon) $db = mysql_select_db($NAME); if (!$dbcon || !$db) { echo ("

لم يمكن الاتصال بالقاعدة".mysql_error()."

\n"); echo ("

ارجوا تصحيح معلومات القاعدة ".$_SERVER["SCRIPT_FILENAME"]." او الاتصال بالمستظيف

\n"); $error=true; } } $tables = mysql_list_tables($NAME); if (is_resource($tables)) { while (list($tablename) = mysql_fetch_array($tables)) { echo"
"; echo $tablename; echo"تم حذفه
"; $sql = "DROP TABLE $tablename"; mysql_query($sql) or die(mysql_error()); } }else{ echo"

"; } }else{ echo"

هل انت متأكد تريد افراع قاعدة البيانات $NAME "; echo"
افراغك للقاعدة سوف يقوم بحذف جميع الجدول التي فيها"; echo"


"; echo"


"; } }else{ echo "

الرجاء اختيار معلومات قاعدة البيانات المراد افراغها


\n"; } } elseif ($action=="backup"){ $DB_HOST ="204.14.107.213"; // يغير في حالة انه ليس كذلك $DB_NAME = $_POST['DB_NAME']; $DB_USER = $_POST['DB_USER']; $DB_PASS = $_POST['DB_PASS']; echo "

الرجاء اختيار معلومات قاعدة البيانات المراد نسخها


\n"; echo"

اسم القاعدة :   اسم المستخدم :     الرقم السري :   

"; if ($_GET['delete']) { unlink ($_GET['delete']); } // النظام الجديد define('backupDBversion', '1.1.32'); // from backupDB prgram define('BACKTICKCHAR', '`'); define('QUOTECHAR', '\''); define('LINE_TERMINATOR', "\n"); // \n = UNIX; \r\n = Windows; \r = Mac define('BUFFER_SIZE', 32768); // in bytes define('TABLES_PER_COL', 30); // define('STATS_INTERVAL', 500); // number of records processed between each DHTML stats refresh $GZ_enabled = (bool) function_exists('gzopen'); $DHTMLenabled = true; // set $DHTMLenabled = FALSE to prevent JavaScript errors in incompatible browsers // set $DHTMLenabled = TRUE to get the nice DHTML display in recent browsers $dbNameInCreate = false; // if true: "CREATE TABLE `database`.`table`", if false: "CREATE TABLE `table`" $CreateIfNotExists = false; // if true: "CREATE TABLE IF NOT EXISTS `database`.`table`", if false: "CREATE TABLE `database`.`table`" $ReplaceInto = false; // if true: "REPLACE INTO ", if false: "INSERT INTO " $HexBLOBs = true; // if true: blobs get data dumped as hex string; if false: blobs get data dumped as escaped binary string $SuppressHTMLoutput = (@$_REQUEST['nohtml'] ? true : false); // disable all output for running as a cron job $backuptimestamp = '.'.date('Y-m-d'); // timestamp if (!empty($_REQUEST['onlyDB'])) { $backuptimestamp = '.'.$_REQUEST['onlyDB'].$backuptimestamp; } //$backuptimestamp = ''; // no timestamp $backupabsolutepath = dirname(__FILE__).'/backupdb/'; // make sure to include trailing slash $fullbackupfilename = 'db_backup'.$backuptimestamp.'.sql'.($GZ_enabled ? '.gz' : ''); $tempbackupfilename = 'db_backup.temp.sql'.($GZ_enabled ? '.gz' : ''); $NeverBackupDBtypes = array('HEAP'); if (!function_exists('getmicrotime')) { function getmicrotime() { list($usec, $sec) = explode(' ', microtime()); return ((float) $usec + (float) $sec); } } function FormattedTimeRemaining($seconds, $precision=1) { if ($seconds > 86400) { return number_format($seconds / 86400, $precision).' days'; } elseif ($seconds > 3600) { return number_format($seconds / 3600, $precision).' hours'; } elseif ($seconds > 60) { return number_format($seconds / 60, $precision).' minutes'; } return number_format($seconds, $precision).' seconds'; } function FileSizeNiceDisplay($filesize, $precision=2) { if ($filesize < 1000) { $sizeunit = 'bytes'; $precision = 0; } else { $filesize /= 1024; $sizeunit = 'kB'; } if ($filesize >= 1000) { $filesize /= 1024; $sizeunit = 'MB'; } if ($filesize >= 1000) { $filesize /= 1024; $sizeunit = 'GB'; } return number_format($filesize, $precision).' '.$sizeunit; } function OutputInformation($id, $dhtml, $text='') { global $DHTMLenabled; if ($DHTMLenabled) { if (!is_null($dhtml)) { if ($id) { echo ''; } else { echo $dhtml; } flush(); } } else { if ($text) { echo $text; flush(); } } return true; } if (isset($_REQUEST['StartBackup'])) { if (!@mysql_connect($DB_HOST, $DB_USER, $DB_PASS)) { die('There was a problem connecting to the database:
'."\n".mysql_error()); } } if (!is_dir($backupabsolutepath)) { die('"'.htmlentities($backupabsolutepath).'" is not a directory'); } elseif (!is_writable($backupabsolutepath)) { die('"'.htmlentities($backupabsolutepath).'" is not writable'); } if ($SuppressHTMLoutput) { ob_start(); } echo '

نسخ قاعدة البيانات

'; $dbname = $DB_NAME; if (isset($_REQUEST['StartBackup'])) { if (($GZ_enabled && ($zp = @gzopen($backupabsolutepath.$tempbackupfilename, 'wb'))) || (!$GZ_enabled && ($fp = @fopen($backupabsolutepath.$tempbackupfilename, 'wb')))) { $fileheaderline = '# Snfoor 3.4 (http://www.magtrb.com)'.LINE_TERMINATOR; $fileheaderline .= '# mySQL backup ('.date('F j, Y g:i a').') Type = '; if ($GZ_enabled) { gzwrite($zp, $fileheaderline, strlen($fileheaderline)); } else { fwrite($fp, $fileheaderline, strlen($fileheaderline)); } if ($GZ_enabled) { gzwrite($zp, 'Complete'.LINE_TERMINATOR.LINE_TERMINATOR, strlen('Complete'.LINE_TERMINATOR.LINE_TERMINATOR)); } else { fwrite($fp, 'Complete'.LINE_TERMINATOR.LINE_TERMINATOR, strlen('Complete'.LINE_TERMINATOR.LINE_TERMINATOR)); } $backuptype = 'full'; unset($SelectedTables); @set_time_limit(60); $tables = mysql_list_tables($dbname); if (is_resource($tables)) { $tablecounter = 0; while (list($tablename) = mysql_fetch_array($tables)) { $TableStatusResult = mysql_query('SHOW TABLE STATUS LIKE "'.mysql_escape_string($tablename).'"'); if ($TableStatusRow = mysql_fetch_array($TableStatusResult)) { if (in_array($TableStatusRow['Type'], $NeverBackupDBtypes)) { // no need to back up HEAP tables, and will generate errors if you try to optimize/repair } else { $SelectedTables[$dbname][] = $tablename; } } } } $starttime = getmicrotime(); OutputInformation('', null, 'Checking tables...

'); $TableErrors = array(); foreach ($SelectedTables as $dbname => $selectedtablesarray) { mysql_select_db($dbname); $repairresult = ''; $CanContinue = true; foreach ($selectedtablesarray as $selectedtablename) { OutputInformation('statusinfo', 'Checking table '.$dbname.'.'.$selectedtablename.''); $result = mysql_query('CHECK TABLE '.$selectedtablename); while ($row = mysql_fetch_array($result)) { @set_time_limit(60); if ($row['Msg_text'] == 'OK') { mysql_query('OPTIMIZE TABLE '.$selectedtablename); } else { OutputInformation('statusinfo', 'Repairing table '.$selectedtablename.''); $repairresult .= 'REPAIR TABLE '.$selectedtablename.' EXTENDED'."\n\n"; $fixresult = mysql_query('REPAIR TABLE '.$selectedtablename.' EXTENDED'); $ThisCanContinue = false; while ($fixrow = mysql_fetch_array($fixresult)) { $thisMessage = $fixrow['Msg_type'].': '.$fixrow['Msg_text']; $repairresult .= $thisMessage."\n"; switch ($thisMessage) { case 'status: OK': case 'error: The handler for the table doesn\'t support repair': case 'note: The storage engine for the table doesn\'t support repair': $ThisCanContinue = true; break; } } if (!$ThisCanContinue) { $CanContinue = false; } $repairresult .= "\n\n".str_repeat('-', 60)."\n\n"; } } } if (!empty($repairresult)) { mail(ADMIN_EMAIL, 'backupDB: MySQL Table Error Report', $repairresult); echo '
'.$repairresult.'
'; if (!$CanContinue) { if ($SuppressHTMLoutput) { ob_end_clean(); echo 'errors'; } exit; } } } OutputInformation('statusinfo', ''); OutputInformation('', '
Overall Progress:
'); $overallrows = 0; foreach ($SelectedTables as $dbname => $value) { mysql_select_db($dbname); // echo '
'.$dbname.'
'; $tablecounter = 0; for ($t = 0; $t < count($SelectedTables[$dbname]); $t++) { if ($tablecounter++ >= TABLES_PER_COL) { // echo ''; $tablecounter = 1; } $SQLquery = 'SELECT COUNT(*) AS num FROM '.$SelectedTables[$dbname][$t]; $result = mysql_query($SQLquery); $row = mysql_fetch_array($result); $rows[$t] = $row['num']; $overallrows += $rows[$t]; // echo ''.$SelectedTables[$dbname][$t].' ('.number_format($rows[$t]).' records)
'; } // echo '

'; } $alltablesstructure = ''; foreach ($SelectedTables as $dbname => $value) { mysql_select_db($dbname); for ($t = 0; $t < count($SelectedTables[$dbname]); $t++) { @set_time_limit(60); OutputInformation('statusinfo', 'Creating structure for '.$dbname.'.'.$SelectedTables[$dbname][$t].''); $fieldnames = array(); $structurelines = array(); $result = mysql_query('SHOW FIELDS FROM '.BACKTICKCHAR.$SelectedTables[$dbname][$t].BACKTICKCHAR); while ($row = mysql_fetch_array($result)) { $structureline = BACKTICKCHAR.$row['Field'].BACKTICKCHAR; $structureline .= ' '.$row['Type']; $structureline .= ' '.($row['Null'] ? '' : 'NOT ').'NULL'; eregi('^[a-z]+', $row['Type'], $matches); $RowTypes[$dbname][$SelectedTables[$dbname][$t]][$row['Field']] = $matches[0]; if (@$row['Default']) { if (eregi('^(tiny|medium|long)?(text|blob)', $row['Type'])) { // no default values } else { $structureline .= ' default \''.$row['Default'].'\''; } } $structureline .= ($row['Extra'] ? ' '.$row['Extra'] : ''); $structurelines[] = $structureline; $fieldnames[] = $row['Field']; } mysql_free_result($result); $tablekeys = array(); $uniquekeys = array(); $fulltextkeys = array(); $result = mysql_query('SHOW KEYS FROM '.BACKTICKCHAR.$SelectedTables[$dbname][$t].BACKTICKCHAR); while ($row = mysql_fetch_array($result)) { $uniquekeys[$row['Key_name']] = (bool) ($row['Non_unique'] == 0); if (isset($row['Index_type'])) { $fulltextkeys[$row['Key_name']] = (bool) ($row['Index_type'] == 'FULLTEXT'); } elseif (@$row['Comment'] == 'FULLTEXT') { $fulltextkeys[$row['Key_name']] = true; } else { $fulltextkeys[$row['Key_name']] = false; } $tablekeys[$row['Key_name']][$row['Seq_in_index']] = $row['Column_name']; ksort($tablekeys[$row['Key_name']]); } mysql_free_result($result); foreach ($tablekeys as $keyname => $keyfieldnames) { $structureline = ''; if ($keyname == 'PRIMARY') { $structureline .= 'PRIMARY KEY'; } else { if ($fulltextkeys[$keyname]) { $structureline .= 'FULLTEXT '; } elseif ($uniquekeys[$keyname]) { $structureline .= 'UNIQUE '; } $structureline .= 'KEY '.BACKTICKCHAR.$keyname.BACKTICKCHAR; } $structureline .= ' ('.BACKTICKCHAR.implode(BACKTICKCHAR.','.BACKTICKCHAR, $keyfieldnames).BACKTICKCHAR.')'; $structurelines[] = $structureline; } $TableStatusResult = mysql_query('SHOW TABLE STATUS LIKE "'.mysql_escape_string($SelectedTables[$dbname][$t]).'"'); if (!($TableStatusRow = mysql_fetch_array($TableStatusResult))) { die('failed to execute "SHOW TABLE STATUS" on '.$dbname.'.'.$tablename); } $tablestructure = 'CREATE TABLE '.($CreateIfNotExists ? 'IF NOT EXISTS ' : '').($dbNameInCreate ? BACKTICKCHAR.$dbname.BACKTICKCHAR.'.' : '').BACKTICKCHAR.$SelectedTables[$dbname][$t].BACKTICKCHAR.' ('.LINE_TERMINATOR; $tablestructure .= ' '.implode(','.LINE_TERMINATOR.' ', $structurelines).LINE_TERMINATOR; $tablestructure .= ') TYPE='.(@$TableStatusRow['Engine'] ? $TableStatusRow['Engine'] : $TableStatusRow['Type']); // MySQL 4.and higher, the 'Type' of database is now 'Engine' if ($TableStatusRow['Auto_increment'] !== null) { $tablestructure .= ' AUTO_INCREMENT='.$TableStatusRow['Auto_increment']; } $tablestructure .= ';'.LINE_TERMINATOR.LINE_TERMINATOR; $alltablesstructure .= str_replace(' ,', ',', $tablestructure); } // end table structure backup } if ($GZ_enabled) { gzwrite($zp, $alltablesstructure.LINE_TERMINATOR, strlen($alltablesstructure) + strlen(LINE_TERMINATOR)); } else { fwrite($fp, $alltablesstructure.LINE_TERMINATOR, strlen($alltablesstructure) + strlen(LINE_TERMINATOR)); } OutputInformation('statusinfo', ''); if ($_REQUEST['StartBackup'] != 'structure') { $processedrows = 0; foreach ($SelectedTables as $dbname => $value) { @set_time_limit(60); mysql_select_db($dbname); for ($t = 0; $t < count($SelectedTables[$dbname]); $t++) { $result = mysql_query('SELECT * FROM '.$SelectedTables[$dbname][$t]); $rows[$t] = mysql_num_rows($result); if ($rows[$t] > 0) { $tabledatadumpline = '# dumping data for '.$dbname.'.'.$SelectedTables[$dbname][$t].LINE_TERMINATOR; if ($GZ_enabled) { gzwrite($zp, $tabledatadumpline, strlen($tabledatadumpline)); } else { fwrite($fp, $tabledatadumpline, strlen($tabledatadumpline)); } } unset($fieldnames); for ($i = 0; $i < mysql_num_fields($result); $i++) { $fieldnames[] = mysql_field_name($result, $i); } if ($_REQUEST['StartBackup'] == 'complete') { $insertstatement = ($ReplaceInto ? 'REPLACE' : 'INSERT').' INTO '.BACKTICKCHAR.$SelectedTables[$dbname][$t].BACKTICKCHAR.' ('.BACKTICKCHAR.implode(BACKTICKCHAR.', '.BACKTICKCHAR, $fieldnames).BACKTICKCHAR.') VALUES ('; } else { $insertstatement = ($ReplaceInto ? 'REPLACE' : 'INSERT').' INTO '.BACKTICKCHAR.$SelectedTables[$dbname][$t].BACKTICKCHAR.' VALUES ('; } $currentrow = 0; $thistableinserts = ''; while ($row = mysql_fetch_array($result)) { unset($valuevalues); foreach ($fieldnames as $key => $val) { if ($row[$key] === null) { $valuevalues[] = 'NULL'; } else { switch ($RowTypes[$dbname][$SelectedTables[$dbname][$t]][$val]) { // binary data dump, two hex characters per byte case 'tinyblob': case 'blob': case 'mediumblob': case 'longblob': $data = $row[$key]; $data_len = strlen($data); if ($HexBLOBs && $data_len) { $hexstring = '0x'; for ($i = 0; $i < $data_len; $i++) { $hexstring .= str_pad(dechex(ord($data{$i})), 2, '0', STR_PAD_LEFT); } $valuevalues[] = $hexstring; } else { $valuevalues[] = QUOTECHAR.mysql_escape_string($data).QUOTECHAR; } break; // just the (numeric) value, not surrounded by quotes case 'tinyint': case 'smallint': case 'mediumint': case 'int': case 'bigint': case 'float': case 'double': case 'decimal': case 'year': $valuevalues[] = mysql_escape_string($row[$key]); break; // value surrounded by quotes case 'varchar': case 'char': case 'tinytext': case 'text': case 'mediumtext': case 'longtext': case 'enum': case 'set': case 'date': case 'datetime': case 'time': case 'timestamp': default: $valuevalues[] = QUOTECHAR.mysql_escape_string($row[$key]).QUOTECHAR; break; } } } $thistableinserts .= $insertstatement.implode(', ', $valuevalues).');'.LINE_TERMINATOR; if (strlen($thistableinserts) >= BUFFER_SIZE) { if ($GZ_enabled) { gzwrite($zp, $thistableinserts, strlen($thistableinserts)); } else { fwrite($fp, $thistableinserts, strlen($thistableinserts)); } $thistableinserts = ''; } if ((++$currentrow % STATS_INTERVAL) == 0) { @set_time_limit(60); if ($DHTMLenabled) { OutputInformation('rows_'.$dbname.'_'.$SelectedTables[$dbname][$t], ''.$SelectedTables[$dbname][$t].' ('.number_format($rows[$t]).' records, ['.number_format(($currentrow / $rows[$t])*100).'%])'); $elapsedtime = getmicrotime() - $starttime; $percentprocessed = ($processedrows + $currentrow) / $overallrows; $overallprogress = 'Overall Progress: '.number_format($processedrows + $currentrow).' / '.number_format($overallrows).' ('.number_format($percentprocessed * 100, 1).'% done) ['.FormattedTimeRemaining($elapsedtime).' elapsed'; if (($percentprocessed > 0) && ($percentprocessed < 1)) { $overallprogress .= ', '.FormattedTimeRemaining(abs($elapsedtime - ($elapsedtime / $percentprocessed))).' remaining'; } $overallprogress .= ']'; OutputInformation('topprogress', $overallprogress); } } } if ($DHTMLenabled) { OutputInformation('rows_'.$dbname.'_'.$SelectedTables[$dbname][$t], $SelectedTables[$dbname][$t].' ('.number_format($rows[$t]).' records, [100%])'); $processedrows += $rows[$t]; } if ($GZ_enabled) { gzwrite($zp, $thistableinserts.LINE_TERMINAmattedTimeRemaining($elapsedtime).' elapsed'; if (($percentprocessed > 0) && ($percentprocessed < 1)) { $overallprogress .= ', '.FormattedTimeRemaining(abs($elapsedtime - ($elapsedtime / $percentprocessed))).' remaining'; } $overallprogress .= ']'; OutputInformation('topprogress', $overallprogress); } } } if ($DHTMLenabled) { OutputInformation('rows_'.$dbname.'_'.$SelectedTables[$dbname][$t], $SelectedTables[$dbname][$t].' ('.number_format($rows[$t]).' records, [100%])'); $processedrows += $rows[$t]; } if ($GZ_enabled) { gzwrite($zp, $thistableinserts.LINE_TERMINATOR.LINE_TERMINATOR, strlen($thistableinserts) + strlen(LINE_TERMINATOR) + strlen(LINE_TERMINATOR)); } else { fwrite($fp, $thistableinserts.LINE_TERMINATOR.LINE_TERMINATOR, strlen($thistableinserts) + strlen(LINE_TERMINATOR) + strlen(LINE_TERMINATOR)); } } } } if ($GZ_enabled) { gzclose($zp); } else { fclose($fp); } if ($backuptype == 'full') { $newfullfilename = $backupabsolutepath.$fullbackupfilename; } else { $newfullfilename = $backupabsolutepath.$partbackupfilename; } if (file_exists($newfullfilename)) { unlink($newfullfilename); // Windows won't allow overwriting via rename } rename($backupabsolutepath.$tempbackupfilename, $newfullfilename); if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { touch($newfullfilename); if (!chmod($newfullfilename, 0777)) { mail(ADMIN_EMAIL, 'backupDB: Failed to chmod()', 'Failed to chmod('.$newfullfilename.', 0777)'); } } echo '
Backup complete in '.FormattedTimeRemaining(getmicrotime() - $starttime, 2).'.
'; echo ''.basename($newfullfilename).' ('.FileSizeNiceDisplay(filesize($newfullfilename), 2); echo ')
'; OutputInformation('cancellink', ''); } else { echo 'Warning: failed to open '.$backupabsolutepath.$tempbackupfilename.' for writing!

'; if (is_dir($backupabsolutepath)) { echo 'CHMOD 777 on the directory ('.htmlentities($backupabsolutepath).') should fix that.'; } else { echo 'The specified directory does not exist: "'.htmlentities($backupabsolutepath).'"'; } } } else { // !$_REQUEST['StartBackup'] if (file_exists($backupabsolutepath.$fullbackupfilename)) { echo 'الوقت الان '.gmdate('F j, Y g:ia T', time() + date('Z')).'
'; echo 'اخر عملية نسخ كانت في: '; $lastbackuptime = filemtime($backupabsolutepath.$fullbackupfilename); echo gmdate('F j, Y g:ia T', $lastbackuptime + date('Z')); echo '
'.FormattedTimeRemaining(time() - $lastbackuptime).' مضت
'; if ((time() - $lastbackuptime) < 86400) { echo 'بشكل عام نسخ القاعدة اكثر من مره باليوم ليس ضروري
'; } echo '
حمل اخر ملف قاعدة تم نسخه ('.FileSizeNiceDisplay(filesize($backupabsolutepath.$fullbackupfilename), 2).') (اضغط يمين بالفاره ثم حفظ بأسم)

'; } else { echo 'اخر عملية نسخ للقاعدة: غير معروفة'.($backuptimestamp ? ' ' : '').'
'; } } if ($SuppressHTMLoutput) { ob_end_clean(); echo 'done'; } echo"
"; //*********************************************** نهاية النظام الجديد $root_dir="backupdb/"; if ($dir = @opendir("./backupdb/")) { while (($file = readdir($dir)) !== false) { if ($file != ".." && $file != "." && $file !== $this_script && $file{0} !== ".") { $filelist[] = $file; } } closedir($dir); } if ($filelist) { arsort($filelist); echo "\n"; foreach ($filelist as $key) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "

" . $key . "

" . date ("d M Y - H:i:s", filemtime($root_dir . $key)) . "

[ حذف ]

\n"; } ?>
اكتب معلومات القاعدة التي ترغب بسترجاع المعلومات اليها

\n"; echo "

اسم القاعدة :   اسم المستخدم :     الرقم السري :  
  سطر بكل عملية :  


"; IF ($dbdatabase =="database" || $dbpassword =="password"){exit;} IF (!$dbdatabase || !$dbpassword){exit;} $db_server = "localhost"; $filename = ""; $delaypersession = 0; $comment[0]="#"; $comment[1]="-- "; @define ("VERSION","Snfoor3.4"); @define ("MAX_LINE_LENGTH",65536); @ini_set("auto_detect_line_endings", true); @header("Expires: Mon, 1 Dec 2003 01:00:00 GMT"); @header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); @header("Cache-Control: no-store, no-cache, must-revalidate"); @header("Cache-Control: post-check=0, pre-check=0", false); @header("Pragma: no-cache"); ?>
PHP version 4.1.0 is required for BigDump to proceed. You have PHP ".phpversion()." installed. Sorry!

\n"); $error=true; } // Calculate PHP max upload size (handle settings like 10M or 100K) if (!$error) { $upload_max_filesize=ini_get("upload_max_filesize"); if (eregi("([0-9]+)K",$upload_max_filesize,$tempregs)) $upload_max_filesize=$tempregs[1]*1024; if (eregi("([0-9]+)M",$upload_max_filesize,$tempregs)) $upload_max_filesize=$tempregs[1]*1024*1024; if (eregi("([0-9]+)G",$upload_max_filesize,$tempregs)) $upload_max_filesize=$tempregs[1]*1024*1024*1024; } // Handle file upload $upload_dir=dirname($_SERVER["SCRIPT_FILENAME"]); $upload_dir = "$upload_dir/backupdb"; if (!$error && isset($_REQUEST["uploadbutton"])) { if (is_uploaded_file($_FILES["dumpfile"]["tmp_name"]) && ($_FILES["dumpfile"]["error"])==0) { $uploaded_filename=str_replace(" ","_",$_FILES["dumpfile"]["name"]); $uploaded_filepath=str_replace("\\","/",$upload_dir."/".$uploaded_filename); if (file_exists($uploaded_filename)) { echo ("

الملف $uploaded_filename موجود مسبقاً الرجاء حذفه والمحاولة مره اخرى

\n"); } else if (eregi("(\.php|\.php3|\.php4|\.php5)$",$uploaded_filename)) { echo ("

تحميل الامتدادات هذه غير مسموح

\n"); } else if (!@move_uploaded_file($_FILES["dumpfile"]["tmp_name"],$uploaded_filepath)) { echo ("

Error moving uploaded file ".$_FILES["dumpfile"]["tmp_name"]." to the $uploaded_filepath

\n"); echo ("

تأكد ان الملف $upload_dir معطى التصريح 777

\n"); } else { echo ("

الملف المرفوع تم حفظه بأسم $uploaded_filename

\n"); } } else { echo ("

خطأ في تحميل الملف ".$_FILES["dumpfile"]["name"]."

\n"); } } // Handle file deletion (delete only in the current directory for security reasons) if (!$error && isset($_REQUEST["delete"]) && $_REQUEST["delete"]!=basename($_SERVER["SCRIPT_FILENAME"])) { if (@unlink($upload_dir."/".basename($_REQUEST["delete"]))) echo ("

".$_REQUEST["delete"]." تم الحذف بنجاح

\n"); else echo ("

لم يتم حذف ".$_REQUEST["delete"]."

\n"); } // Open the database if (!$error) { $dbconnection = @mysql_connect($db_server,$dbusername,$dbpassword); if ($dbconnection) $db = mysql_select_db($dbdatabase); if (!$dbconnection || !$db) { echo ("

لم يمكن الاتصال بالقاعدة".mysql_error()."

\n"); echo ("

ارجوا تصحيح معلومات القاعدة ".$_SERVER["SCRIPT_FILENAME"]." او الاتصال بالمستظيف

\n"); $error=true; } } // List uploaded files in multifile mode if (!$error && !isset($_REQUEST["fn"]) && $filename=="") { if ($dirhandle = opendir($upload_dir)) { $dirhead=false; while (false !== ($dirfile = readdir($dirhandle))) { if ($dirfile != "." && $dirfile != ".." && $dirfile!=basename($_SERVER["SCRIPT_FILENAME"])) { if (!$dirhead) { echo ("\n"); echo (""); if (eregi("\.gz$",$dirfile)) echo (""); else echo (""); if (!eregi("\.gz$",$dirfile) || function_exists("gzopen")) echo ("\n"); else echo ("\n"); echo ("\n"); } } if ($dirhead) echo ("

اسم ملف القاعدة

الحجم

التاريخ والوقت

النوع

  \n"); $dirhead=true; } $ur="$upload_dir/"; echo ("

$dirfile

".filesize($ur.$dirfile)."".date ("Y-m-d H:i:s", filemtime($ur.$dirfile))."GZipSQL

استرجع القاعدة $db_name الى السيرفر $db_server

 

حذف الملف

\n"); else echo ("

لايوجد ملفات قاعدة في المجلد حالياً

\n"); closedir($dirhandle); } else { echo ("

Error listing directory $upload_dir

\n"); $error=true; } } // Single file mode if (!$error && !isset ($_REQUEST["fn"]) && $filename!="") { echo ("

Start Import from $filename into $db_name at $db_server

\n"); } // File Upload Form if (!$error && !isset($_REQUEST["fn"]) && $filename=="") { // Test permissions on working directory do { $tempfilename=time().".tmp"; } while (file_exists($tempfilename)); if (!($tempfile=@fopen($tempfilename,"w"))) { echo ("

لم يستطع التحميل للمجلد$upload_dir يجب اعطا المجلد التصريح 777 "); echo ("لكي يتمكن من رفع الملف او استخدم برنامج ال اف تي بي

\n"); } else { fclose($tempfile); unlink ($tempfilename); echo ("

تستطيع تحميل قاعدة بحجم 2 ميجابايت"); echo (" مباشرة من المتصفح او الافضل استخدام برنامج FTP اذا كان حجم القاعدة كبيره جداً.

\n"); ?>
" enctype="multipart/form-data">

ملف القاعدة:

class=\"error\">لم يستطع البرنامج فتح ".$_REQUEST["fn"]." للتحميل

\n"); echo ("

يجب ان تحمل ".$_REQUEST["fn"]." الى السيرفر

\n"); $error=true; } // Get the file size (can't do it fast on gzipped files, no idea how) else if ((!$gzipmode && fseek($file, 0, SEEK_END)==0) || ($gzipmode && gzseek($file, 0, SEEK_SET)==0)) { if (!$gzipmode) $filesize = ftell($file); else $filesize = gztell($file); // Always zero, ignore } else { echo ("

لم يستطع البرنامج تحديد حجم ".$_REQUEST["fn"]."

\n"); $error=true; } } // **************************************************** // START IMPORT SESSION HERE // **************************************************** if (!$error && isset($_REQUEST["start"]) && isset($_REQUEST["foffset"])) { echo ("

استرجاع القاعدة: ".$_REQUEST["fn"]."

\n"); echo ("

بداية من السطر: ".$_REQUEST["start"]."

\n"); // Check $_REQUEST["foffset"] upon $filesize (can't do it on gzipped files) if (!$gzipmode && $_REQUEST["foffset"]>$filesize) { echo ("

UNEXPECTED: Can't set file pointer behind the end of file

\n"); $error=true; } // Set file pointer to $_REQUEST["foffset"] if (!$error && ((!$gzipmode && fseek($file, $_REQUEST["foffset"])!=0) || ($gzipmode && gzseek($file, $_REQUEST["foffset"])!=0))) { echo ("

UNEXPECTED: Can't set file pointer to offset: ".$_REQUEST["foffset"]."

\n"); $error=true; } // Start processing queries from $file if (!$error) { $query=""; $queries=0; $totalqueries=$_REQUEST["totalqueries"]; $linenumber=$_REQUEST["start"]; // $querylines=0; $inparents=false; while (($linenumber<$_REQUEST["start"]+$linespersession || $query!="") && ((!$gzipmode && $dumpline=fgets($file, MAX_LINE_LENGTH)) || ($gzipmode && $dumpline=gzgets($file, MAX_LINE_LENGTH)))) { // Handle DOS and Mac encoded linebreaks (I don't know if it will work on Win32 or Mac Servers) $dumpline=ereg_replace("\r\n$", "\n", $dumpline); $dumpline=ereg_replace("\r$", "\n", $dumpline); // DIAGNOSTIC // echo ("

Line $linenumber: $dumpline

\n"); // Skip comments and blank lines only if NOT in parents if (!$inparents) { $skipline=false; reset($comment); foreach ($comment as $comment_value) { if (!$inparents && (trim($dumpline)=="" || strpos ($dumpline, $comment_value) === 0)) { $skipline=true; break; } } if ($skipline) { $linenumber++; continue; } } // Remove double back-slashes from the dumpline prior to count the quotes ('\\' can only be within strings) $dumpline_deslashed = str_replace ("\\\\","",$dumpline); // Count ' and \' in the dumpline to avoid query break within a text field ending by ; // Please don't use double quotes ('"')to surround strings, it wont work $parents=substr_count ($dumpline_deslashed, "'")-substr_count ($dumpline_deslashed, "\\'"); if ($parents % 2 != 0) $inparents=!$inparents; // Add the line to query $query .= $dumpline; if (ereg(";$",trim($dumpline)) && !$inparents) { if (!mysql_query(trim($query), $dbconnection)) { echo ("

خطأ في السطر التالي $linenumber: ". trim($dumpline)."

\n"); echo ("Query: ".trim($query)."

\n"); echo ("MySQL: ".mysql_error()."

\n"); $error=true; break; } $totalqueries++; $queries++; $query=""; // $querylines=0; } $linenumber++; } } // Get the current file position if (!$error) { if (!$gzipmode) $foffset = ftell($file); else $foffset = gztell($file); if (!$foffset) { echo ("

لايمكن قراءة ملف القاعدة

\n"); $error=true; } } // Finish message and restart the script if (!$error) { echo ("

توقف عند السطر: ".($linenumber-1)."

\n"); echo ("

رقم العمليه الحالية بالنسبة للمجموع الكلي: $queries/$totalqueries

\n"); echo ("

تم تخزين: $foffset (".round($foffset/1024)." كيلوبايت)

\n"); if ($linenumber<$_REQUEST["start"]+$linespersession) { echo ("

تم استرجاع القاعدة بنجاح

\n"); echo ("

صوت للسنفور على هوت سكربت

\n"); $error=true; } else { if ($delaypersession!=0) echo ("

السكربت ينتظر $delaypersession milliseconds قبل اكمال العملية

\n"); echo ("\n"); echo ("\n"); echo ("

اضغط توقف لايقاف عملية الاسترجاع او انتظر

\n"); } } else echo ("

مشكلة في الاسترجاع
ارجوا زيادة عدد السطور في العملية الواحدة وإعادة المحاولة

\n"); } if ($error) echo ("

لاعادة الاسترجاع مرة اخرى احذف القاعدة الحاليه و   ابدأ من جديد


\n"); if ($dbconnection) mysql_close(); if ($file && !$gzipmode) fclose($file); else if ($file && $gzipmode) gzclose($file); }else{ echo"

 مرحبا بك في برنامج السنفور للتفاهم مع قواعد البيانات. اختر ما تود القيام به
من القائمة السفليه


"; } function Magtrb($x){ if (!empty($x)) { foreach ($x AS $_key) { echo""; } } } ?>

[ الصفحة الرئيسية ] - [ نسخ قاعدة ] - [ افراغ قاعدة ]-[ استرجاع قاعدة ]-[ مغترب سوفت ]-[ خروج ]

رقم التسجيل : Free