webproger > cheat sheets > PHP
 
copy
copy($_SERVER["DOCUMENT_ROOT"].'/Q_strg/kallery/'.$arry['nm_tmpry'],$_SERVER["DOCUMENT_ROOT"].'/Q_strg/kallery_/'.$arry['nm_tmpry']);
2619
 
file
$a = file($_SERVER["DOCUMENT_ROOT"].'/folder/file');
for($i=0; $i<sizeof($a); $i++) {
    echo $a[$i]."<br>";
}
19323
 
ΕͷցlιЅΞΛ
On the sides are 2 _____s that kind of look like antlers.
 
filesize
if(filesize($_SERVER["DOCUMENT_ROOT"].'/Q_strg/kallery/'.$arry['img'])>10000) {  }
2616
 
file_exists
if(file_exists($_SERVER['DOCUMENT_ROOT']."/Q_img/flags/".$arry['cntry'].".png")) {  }
2617
 
header
header("Location: ".preg_replace("/g_brd=77/","g_brd=113&g_field_1=photograph",$_SERVER['REQUEST_URI']));
94
 
mysql_fetch_array
$q1 = "";
if(!$r1=mysql_query($q1,$d_id_lnk)) { header("Location: http://kallery.net/Q/quiz.php"); }
while($a1=mysql_fetch_array($r1)) {
}
2609
 
mysql_num_rows
$q1 = "";
if(!$r1=mysql_query($q1,$d_id_lnk)) { header("Location: http://kallery.net/Q/quiz.php"); }
if(mysql_num_rows($r1)<5) {
    while($a1=mysql_fetch_array($r1)) {
    }
}
2440
 
mysql_real_escape_string
$s= mysql_real_escape_string($s);
2635
 
ob_start(), ob_get_contents()
Preventing from repeating F5
3515
 
ob_start,ob_clean
<?php
if(   $_GET['time']
  AND $_SESSION['time']
  AND $_SESSION['bffr']
  AND $_GET['time']==$_SESSION['time']
  ) {
    echo $_SESSION['bffr'];
    exit();
}
ob_start();
?>
<a href='<?php echo '&time='.time(); ?>'>A</a>
<?php
$_SESSION['bffr'] = ob_get ...
2663
 
preg_match
if(preg_match('/:\/\/(www\.)?kallery\.net/',$_SERVER['HTTP_REFERER'])) {  }

preg_match('/quiz=([a-z0-9]+)/',$_SERVER['HTTP_REFERER'],$a);
echo $a[0];
2608
 
preg_match_all
int preg_match_all ( string $pattern , string $subject [, array &$matches [, int $flags = PREG_PATTERN_ORDER [, int $offset = 0 ]]] )
2439
 
preg_replace
$q = "SELECT * FROM Q_brd_thrd_0 WHERE cntnt LIKE '%qindex.info/drctry.php?ctgry=%'";
$c = preg_replace("/qindex\.info\/drctry\.php\?(id=Silla&amp;)?ctgry=/i","qindex.info/d.php?c=",$a['cntnt']);


$q = "SELECT * FROM uri WHERE ui LIKE '%info/e.php%'";
$r ...
2637
 
rawurlencode
header("Location: http://qindex.info/Q_get.php?g_clss=mmbr_login&g_back=".rawurlencode($_SERVER["REQUEST_URI"]));
98

-