webproger > cheat sheets > PHP
 
 copy
copy($_SERVER["DOCUMENT_ROOT"].'/Q_strg/kallery/'.$arry['nm_tmpry'],$_SERVER["DOCUMENT_ROOT"].'/Q_strg/kallery_/'.$arry['nm_tmpry']); ...
http://qindex.info/i.php?f=259#2619
 
 filesize
if(filesize($_SERVER["DOCUMENT_ROOT"].'/Q_strg/kallery/'.$arry['img'])>10000) {  } ...
http://qindex.info/i.php?f=259#2616
 
 file_exists
if(file_exists($_SERVER['DOCUMENT_ROOT']."/Q_img/flags/".$arry['cntry'].".png")) {  } ...
http://qindex.info/i.php?f=259#2617
 
 header
header("Location: ".preg_replace("/g_brd=77/","g_brd=113&g_field_1=photograph",$_SERVER['REQUEST_URI'])); ...
http://qindex.info/i.php?f=259#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)) {
} ...
http://qindex.info/i.php?f=259#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)) {
    }
} ...
http://qindex.info/i.php?f=259#2440
 
 mysql_real_escape_string
$s= mysql_real_escape_string($s); ...
http://qindex.info/i.php?f=259#2635
 
 ob_start(), ob_get_contents()
Preventing from repeating F5
http://qindex.info/i.php?f=259#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 ...
http://qindex.info/i.php?f=259#2663
 
 preg_match
if(preg_match('/:\/\/(www\.)?kallery\.net/',$_SERVER['HTTP_REFERER'])) {  } ...
http://qindex.info/i.php?f=259#2608
 
 preg_match_all
int preg_match_all ( string $pattern , string $subject [, array &$matches [, int $flags = PREG_PATTERN_ORDER [, int $offset = 0 ]]] ) ...
http://qindex.info/i.php?f=259#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']); ...
http://qindex.info/i.php?f=259#2637
 
 rawurlencode
header("Location: http://qindex.info/Q_get.php?g_clss=mmbr_login&g_back=".rawurlencode($_SERVER["REQUEST_URI"])); ...
http://qindex.info/i.php?f=259#98

-