webproger's home > PHP | 19 | T
in webproger's webmarks all the webmarks

manual | R
PHP manual in English. - PHP Documentation Group -
http://qindex.info/d.php?c=2681#2687

AUTO LOGIN | R
2017-12-27 13:50
http://qindex.info/d.php?c=2681#38
CREATE TABLE Q_mmbr_auto (
  cphr   varchar(32),
  idntty varchar(32),
  tmstmp int(10),
  PRIMARY KEY (cphr)
);


// after session_start();
// include "/Q_incld/mmbr_auto.php";
// in header
// class Q_encrypt required
if(!$_SESSION['s_login'] AND $_COOKIE['auto']) {
  $q = "SELECT * FROM Q_mmbr_auto WHERE cphr='"
       .$_COOKIE['auto']."'";
  $r = mysql_query($q,$d_id_lnk);
  if($a=mysql_fetch_array($r)) {
    $t = time();
    $p = 60*60*24*7;
    if($a['tmstmp']>($t-$p)) {
      $o = new Q_encrypt($a['idntty']);
      $c = $o->encrpt($t);
      $q = "INSERT INTO Q_mmbr_auto SET cphr='"
           .$c."', idntty='".$a['idntty']
           ."', tmstmp=".$t;
      if(mysql_query($q,$d_id_lnk)) {
        $q = "DELETE FROM Q_mmbr_auto WHERE"
             ." cphr='".$_COOKIE['auto']."'"
             ." OR tmstmp<".($t-$p);
        mysql_query($q,$d_id_lnk);
        $q = "UPDATE Q_mmbr SET lst_vstd=".time()
           . " WHERE idntty='".$a['idntty']."'";
        mysql_query($q,$d_id_lnk);
        $_SESSION['s_login'] = $a['idntty'];
        setcookie('auto',$c,$t+$p,'/');
      } else setcookie('auto','',0,'/');
    } else setcookie('auto','',0,'/');
  } else setcookie('auto','',0,'/');
}

ob_start(), ob_get_contents() | R
Preventing from repeating F5
http://qindex.info/d.php?c=2681#3515
<?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_contents();
ob_clean();
$_SESSION['time'] = $_GET['time'];
echo $_SESSION['bffr'];
?>
execute:0.063 sec, load: sec http://qindex.info/d.php?c=2681 [ refresh ] [ Email to webproger ]
Qindex.info 2004,   Introduction | 소개 | 介绍 | 導入 | qindex.info@gmail.com