webproger > cheat sheets > PHP
 
Songs in Easy English
 
copy
copy($_SERVER["DOCUMENT_ROOT"].'/Q_strg/kallery/'.$arry['nm_tmpry'],$_SERVER["DOCUMENT_ROOT"].'/Q_strg/kallery_/'.$arry['nm_tmpry']);
259#2619 SIBLINGS CHILDREN 2619
 
file
$a = file($_SERVER["DOCUMENT_ROOT"].'/folder/file');
for($i=0; $i<sizeof($a); $i++) {
    echo $a[$i]."<br>";
}
259#19323 SIBLINGS CHILDREN 19323
 
filesize
if(filesize($_SERVER["DOCUMENT_ROOT"].'/Q_strg/kallery/'.$arry['img'])>10000) {  }
259#2616 SIBLINGS CHILDREN 2616
 
file_exists
if(file_exists($_SERVER['DOCUMENT_ROOT']."/Q_img/flags/".$arry['cntry'].".png")) {  }
259#2617 SIBLINGS CHILDREN 2617
 
header
header("Location: ".preg_replace("/g_brd=77/","g_brd=113&g_field_1=photograph",$_SERVER['REQUEST_URI']));
259#94 SIBLINGS CHILDREN 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)) {
}
259#2609 SIBLINGS CHILDREN 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)) {
    }
}
259#2440 SIBLINGS CHILDREN 2440
 
mysql_real_escape_string
$s= mysql_real_escape_string($s);
259#2635 SIBLINGS CHILDREN 2635
 
ob_start(), ob_get_contents()
Preventing from repeating F5
259#3515 SIBLINGS CHILDREN 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 ...
259#2663 SIBLINGS CHILDREN 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];
259#2608 SIBLINGS CHILDREN 2608
 
preg_match_all
int preg_match_all ( string $pattern , string $subject [, array &$matches [, int $flags = PREG_PATTERN_ORDER [, int $offset = 0 ]]] )
259#2439 SIBLINGS CHILDREN 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 ...
259#2637 SIBLINGS CHILDREN 2637
 
rawurlencode
header("Location: http://qindex.info/Q_get.php?g_clss=mmbr_login&g_back=".rawurlencode($_SERVER["REQUEST_URI"]));
259#98 SIBLINGS CHILDREN 98

-