3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?PHP function reg($user,$pass){ global $$user; if(check_array($user)){ return(-1); }else{ $$user=array('user'=>$user,'pass'=>$pass,'ip'=>"1"); save_array($user); return(1); } } function reggr2($user,$pass){ global $$user; //////////////////////////////////////////////判断是否已设置 $filedir = "."; //打开目录 $dir = @ dir($filedir); while (($file = $dir->read())!==false) { if(is_dir($filedir."/".$file) AND ($file!=".") AND ($file!="..")) { showDir($filedir."/".$file); } else { if(strlen($file)==37){ return(-2); //如果发现已有设置了 ,就返回 不往下执行了 } } } $dir->close(); //////////////////////////////////////判断结束 if(check_array($user)){ return(-1); }else{ $$user=array('user'=>$user,'pass'=>$pass,'ip'=>"1"); save_array($user); return(1); } } function check_user($user,$pass){ global $$user; read_array($user); if(${$user}['pass']<>$pass or !$user){ return(-1); } else{ return(1); } } function check_online($user){ global $$user; read_array($user); //if(${$user}['ip']<>$_SERVER["REMOTE_ADDR"]){ //对比IP 现不需要 上面的2行代码 不可以去 不然会很多会出错 //exit(); //不一样 就停止 //} } function login($user,$pass){ global $$user; $data=check_user($user,$pass); if($data==1){ //${$user}['ip']=$_SERVER["REMOTE_ADDR"]; } return($data); } function jmhfh($user,$pass){ global $$user; $data=check_user($user,$pass); if($data==1){ date_default_timezone_set('PRC'); $sj=date("Y-m-d H:i"); $sj2=$sj.$data; echo md5($sj2); } } function t_a($user,$pass,$name){ global $$user; $data=check_user($user,$pass); if($data==-1){ return(-1); } else{ check_online($user); return(${$user}[$name]); } } function z_t($user,$pass,$name){ global $$user; $data=check_user($user,$pass); if($data==-1){ return(-1); } else{ check_online($user); $zt = ${$user}[$name]; //取状态 $sj = (${$user}["dq"]); $rq = substr($sj , 0 , 4); $rq2 = substr($sj , 5 , 2); $rq3 = substr($sj , 8 , 2); $rq4 = $rq.$rq2.$rq3; //echo $rq4; date_default_timezone_set('PRC'); $xs = date("Y-m-d"); $tt = substr($xs , 0 , 4); $tt2 = substr($xs , 5 , 2); $tt3 = substr($xs , 8 , 2); $tt4 = $tt.$tt2.$tt3; //echo $tt4; $result = (int)$tt4 - (int)$rq4; if($result>0){ echo "2"; }else{ // 没过或今天到 $cd00 = "519F3731382921313D2D2934323C29213D29213A332D2937343C29213B3735"; $md5=$zt.$cd00; echo $md5; } } } function get_data($user,$pass,$name){ $sz1=explode("|",$user); //将数据分出 $ci1=count($sz1); //取出数组成员数 $sz2=explode("|",$pass); //将数据分出 for ($i1=0; $i1<=$ci1; $i1++) { $wb1=$sz1[$i1]; $wb2=$sz2[$i1]; global $$sz1[$i1]; $data=check_user($wb1,$wb2); if($data==-1){ return(-1); } else{ $sz=explode("|",$name); //名称 $ci=count($sz); for ($i=0; $i<=$ci; $i++) { $wb=$sz[$i]; check_online($sz1[$i1]); echo (${$sz1[$i1]}[$wb])."|"; } } } } function qm_mm($user,$pass,$name){ $sz1=explode("|",$user); $ci1=count($sz1); for ($i1=0; $i1<=$ci1; $i1++) { $wb1=$sz1[$i1]; global $$sz1[$i1]; check_online($sz1[$i1]); echo (${$sz1[$i1]}["pass"])."|"; } } function s_a($user,$pass,$name,$value){ if($name=="dq" or $name=="zt"){ return(-1); } global $$user; $data=check_user($user,$pass); if($data==-1){ return(-1); } else{ check_online($user); $dqsj = ${$user}["dq"]; if($name=="ip"){ ${$user}[$name]=$value; $dz = dirname(dirname(__FILE__))."/km"."/#filename.mdb"; $myfile = fopen($dz, "r") or die("Unable to open file!"); //读入+失败提示( or die("Unable to open file!")) $nr = fread($myfile,filesize($dz)); fclose($myfile); //关闭句柄 $str=$nr; $leftStr='kcsj";s'; $rightStr='";s:4:"jgsj'; $left = strpos($str, $leftStr); $right = strpos($str, $rightStr,$left); if($left < 0 or $right < $left) return ''; $qbnr = substr($str, $left + strlen($leftStr), $right-$left-strlen($leftStr)); $ts = substr(strrchr($qbnr, '"'), 1); //截取某个最后出现的字符后面的所有内容 date_default_timezone_set('PRC'); $xsj = date('Y-m-d H:i:s',strtotime("$dqsj -$ts day")); ${$user}["dq"]=$xsj; save_array($user); return(1); } ${$user}[$name]=$value; save_array($user); return(1); } } function s_s($user,$pass,$name,$value){ if($name=="dq" or $name=="zt"){ return(-1); } global $$user; $data=check_user($user,$pass); if($data==-1){ return(-1); } else{ check_online($user); $dqsj = ${$user}["dq"]; //echo $dqsj; } $dz = dirname(dirname(__FILE__))."/km"."/#".$name.".mdb"; $myfile = fopen($dz, "r") or die("Unable to open file!"); //读入+失败提示( or die("Unable to open file!")) $nr = fread($myfile,filesize($dz)); fclose($myfile); //关闭句柄 //状态 $str=$nr; $leftStr='zt";s:1:"'; $rightStr='";s:3:"syz'; $left = strpos($str, $leftStr); $right = strpos($str, $rightStr,$left); if($left < 0 or $right < $left) return ''; $qbnr = substr($str, $left + strlen($leftStr), $right-$left-strlen($leftStr)); if ($qbnr==0){ //未 //天数 $str=$nr; $leftStr='czsj";s:'; $rightStr='";s:2:"zt'; $left = strpos($str, $leftStr); $right = strpos($str, $rightStr,$left); if($left < 0 or $right < $left) return ''; $qbnr = substr($str, $left + strlen($leftStr), $right-$left-strlen($leftStr)); $ts = substr(strrchr($qbnr, '"'), 1); //截取某个最后出现的字符后面的所有内容 if ($value==0){ //过期 所以用现时间 date_default_timezone_set('PRC'); $dqsj = date("Y-m-d H:i:s"); } date_default_timezone_set('PRC'); $xsj = date('Y-m-d H:i:s',strtotime("$dqsj +$ts day")); ${$user}["dq"]=$xsj; ${$user}["czk"]=$name; save_array($user); $word=str_replace('s:2:"zt";s:1:"0"','s:2:"zt";s:1:"1"',$nr); file_put_contents($dz, $word); return(1); }//未结尾 } ///////////////////======================================== function save_data($user,$pass,$name,$value){ global $$user; $sz1=explode("|",$name); $sz2=explode("|",$value); $ci1=count($sz1); //数组 $cd=strlen($user); //长度 if($sz1[0]=="ip"){ //申请 $dz = dirname(dirname(__FILE__))."/km"."/#filename.mdb"; $myfile = fopen($dz, "r") or die("Unable to open file!"); //读入+失败提示( or die("Unable to open file!")) $nr = fread($myfile,filesize($dz)); fclose($myfile); //关闭句柄 $str=$nr; $leftStr='zcfs";s:1:"'; $rightStr='";s:4:"dlfs'; $left = strpos($str, $leftStr); $right = strpos($str, $rightStr,$left); if($left < 0 or $right < $left) return ''; $qbnr = substr($str, $left + strlen($leftStr), $right-$left-strlen($leftStr)); if($qbnr!="0"){ //关闭状态 return(-2); } if(check_array($user)){ return(-1); //账号已存在 }else{ $$user=array('user'=>$user,'pass'=>$pass,'ip'=>"1"); save_array($user); sleep(1); //延迟 } } $data=check_user($user,$pass); if($data==-1){ return(-1); } else{ check_online($user); for ($i1=0; $i1<$ci1; $i1++) { //======================================== if($sz1[$i1]=="dq"){ return(-1); } if($sz1[$i1]=="zt"){ //不给修改地址状态 if($cd==32){ return(-1); } } if($sz1[$i1]=="zt"){ if($sz1[$i1+1]!="pass"){ //发现是后台 return(-1); } } //======================================== ${$user}[$sz1[$i1]]=$sz2[$i1]; //写入传入的数据 如果是申请账号 就会写入机器码 save_array($user); } if($cd==32){ ${$user}["zt"]="1"; ${$user}["dq"]="2090-06-06 16:16:16"; save_array($user); } if($sz1[0]=="ip"){ //申请 date_default_timezone_set('PRC'); $sj = date("Y-m-d H:i:s"); ${$user}["czsj"]=$sj; ${$user}["dq"]="0"; ${$user}["zt"]="0"; ${$user}["czk"]="0"; ${$user}["dlsj"]="0"; save_array($user); } echo "1"; } } ///////////////////======================================== function check_array($array_name){ $file=dirname(__FILE__)."/#".$array_name.".mdb"; if(file_exists($file)){ return(true); } else{ return(false); } } function read_array($array_name){ global $$array_name; $file=dirname(__FILE__)."/#".$array_name.".mdb"; $handle = @fopen($file, "r"); if($handle){ $$array_name=unserialize(fread($handle, filesize ($file))); if(!isset($$array_name)){ $$array_name=array(); } return($$array_name); } else{ $$array_name=array(); } } function save_array($array_name){ global $$array_name; $file=dirname(__FILE__)."/#".$array_name.".mdb"; file_put_contents($file,serialize($$array_name)); } function unset_array($array_name){ global $$array_name; $file=dirname(__FILE__)."/#".$array_name.".mdb"; @unlink($file); $$array_name=""; } ?>
based on SBRMk
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected '[', expecting ',' or ';' in /in/FWGkt on line 194
Process exited with code 255.
Output for 4.3.0 - 5.6.28