1. C:\xampplite\apache\conf\extra
1. download pclzip.lib.php di http://www.phpconcept.net/pclzip/pclzip-downloads
2. untuk bakcup 1 create folder backup dan create file archive.zip
<?php
// Include the PclZip library
require_once(’pclzip.lib.php’);
// Set the arhive filename
$archive = new PclZip(’backup/archive.zip’);
// Set the dir to archive
$v_dir = dirname(getcwd()); // or dirname(__FILE__);
$v_remove = $v_dir;
// Create the archive
$v_list = $archive->create($v_dir, PCLZIP_OPT_REMOVE_PATH, $v_remove);
if ($v_list == 0) {
die("Error : ".$archive->errorInfo(true));
}
?>
sumber http://campstamba.com/2010/12/create-your-own-php-backup-solution-complete-tutorial-with-source-files/
(read more ...)
<?php
echo "backup progress";
backup_tables(’localhost’,’root’,’’,’db_ci’);
//$host=’localhost’; $user=’root’; $pass=’’ ;$name=’db_ci’; $tables = ’*’;
/* backup the db OR just a table */
function backup_tables($host,$user,$pass,$name,$tables = ’*’)
{
$link = mysql_connect($host,$user,$pass);
mysql_select_db($name,$link);
//get all of the tables
if($tables == ’*’)
{
$tables = array();
$result = mysql_query(’SHOW TABLES’);
while($row = mysql_fetch_row($result))
{
$tables[] = $row[0];
}
}
else
{
$tables = is_array($tables) ? $tables : explode(’,’,$tables);
}
//cycle through
foreach($tables as $table)
{
$result = mysql_query(’SELECT * FROM ’.$table);
$num_fields = mysql_num_fields($result);
$return.= ’DROP TABLE ’.$table.’;’;
$row2 = mysql_fetch_row(mysql_query(’SHOW CREATE TABLE ’.$table));
$return.= "\n\n".$row2[1].";\n\n";
for ($i = 0; $i < $num_fields; $i++)
{
while($row = mysql_fetch_row($result))
{
$return.= ’INSERT INTO ’.$table.’ VALUES(’;
for($j=0; $j<$num_fields; $j++)
{
$row[$j] = addslashes($row[$j]);
$row[$j] = ereg_replace("\n","\\n",$row[$j]);
if (isset($row[$j])) { $return.= ’"’.$row[$j].’"’ ; } else { $return.= ’""’; }
if ($j<($num_fields-1)) { $return.= ’,’; }
}
$return.= ");\n";
}
}
$return.="\n\n\n";
}
$today = date("dmY");
//save file
//$handle = fopen(’db-backup-’.time().’-’.(md5(implode(’,’,$tables))).’.sql’,’w+’);
$handle = fopen(’db-backup-’.$today.’.backup’,’w+’);
fwrite($handle,$return);
fclose($handle);
echo "<META HTTP-EQUIV=’Refresh’
CONTENT=’1; URL=db-backup-$today.backup’>";
}
?>
(read more ...)<table align="center" width="90%">
<tr>
<td align="left" valign="top"><br><strong><font color="#000033" size="3" face="Verdana">VESSEL SCHEDULE</font></strong></td>
</tr>
</table>
<hr>
<form name="vessel" action="<?php $PHP_SELF; ?>" method="post">
<table align="left">
<tr>
<td><font color="#330000" size="2" face="Verdana">Vessel Name</font></td>
<td>:<input type="text" name="ves"></td>
<td><input type="submit" name="submit" value="Search"></td>
</tr>
</table>
</form>
<?php
if($submit)
{
$conn=ocilogon(’db_name’,’pass’,’sid’);
$f5=’db_name’;
$no=1;
$non=0;
$ves = strtoupper($ves);
$que1 = "SELECT TO_CHAR(VV.BERTHING_DATE,’MM/DD/YYYY HH24:MI:SS’) AS BERTHING_DATE,
TO_CHAR(VV.DEPARTURE_DATE,’MM/DD/YYYY HH24:MI:SS’) AS DEPARTURE_DATE,
VM.VES_NAME
FROM $f5.vessel_voyage VV, $f5.vessel_master VM
WHERE VV.ves_code IN
(SELECT ves_code FROM $f5.vessel_master WHERE ves_name LIKE UPPER (’%$ves%’) )
AND VV.VES_CODE=VM.VES_CODE AND ROWNUM<=50
ORDER BY berthing_date DESC";
$sta2 = ociparse($conn,$que1);
ociexecute($sta2);
?>
<table align="center" cellspacing="1" bgcolor=’#d3ecff’ width="98%">
<tr bgcolor="#000066">
<td align="center" height="27"><font color=’yellow’ size=’2’ face=’verdana’>No.</font></td>
<td align="center"><font color=’yellow’ size=’2’ face=’verdana’>Ves. Code</font></td>
<td align="center"><font color="yellow" size="2" face="Verdana">Ves. Id</font></td>
<td align="center"><font color="yellow" size="2" face="Verdana">Voy. Out</font></td>
<td align="center"><font color="yellow" size="2" face="Verdana">Voy. In</font></td>
<td align="center"><font color="yellow" size="2" face="Verdana">Ves. Name</font></td>
<td align="center"><font color="yellow" size="2" face="Verdana">Agent</font></td>
<td align="center"><font color="yellow" size="2" face="Verdana, Arial, Helvetica, sans-serif">Berthing Date</font></td>
<td align="center"><font color="yellow" size="2" face="Verdana, Arial, Helvetica, sans-serif">Departure Date</font></td>
</tr>
<?PHP
while(@ocifetch($sta2))
{
if ($no%2 == 1) { $style = "row1"; }
else { $style = "row2"; }
echo "<tr class=’".$style."’>";
?>
<td align="center" height="15"><?php echo$no;?></td>
<td align="center"><?php echo ociresult($sta2,"BERTHING_DATE")?></td>
<td align="center"><?php echo ociresult($sta2,"DEPARTURE_DATE")?></td>
</tr>
<?
$no++;
$non++;
}//END WHILE
}
?>
</table>
1. copy isi folder instant client oracle atau oci.dll ke dalam folder F:\xampp\apache\bin
2. ubah isi file F:\xampp\php\php.ini dengan menghilangkan comment untuk baris yang berisi
extension=php_oracle.dll
extension=php_oci8.dll
contoh file: koneksi :
$f5=’dbname’;
$db="(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA = (SID = sidname))
)";
if (!$conn) {
$m = oci_error();
echo $m["message"];
exit;
}
tips untuk register global
banyak kasus pemakai apache 2 pada kelabakan karena script nya mengalami error. Dengan pertimbangan security yang lebih baik, memang register global sebaiknya di set off.
Untuk coding yang memakai index follow, seperti phpnuke, postnuke, mambo, dan sebagian besar cms, tambahkan di paling atas pada file index.php, module.php, atau mod.php, pokoknya script yg manggil module :
extract($_GET);
extract($_POST);
jadi gak usah capek2 ganti semua variable, misalnya:
asal => $variabel
menjadi => $_GET[’variable’];
Tapi kalau coding nya berdiri sendiri, ya... tiap file php, atasnya harus ditambahin extract seperti yang di atas.
Untuk yang coding sendiri, ada baiknya jika set environment developing nya dengan:
register_global = off
safe_mode = on
so, coding kita bisa dipake dalam environment apapun...



