Table of Contents
Please Phone contact by qvb3d
Home Backend Development PHP Tutorial 自个儿写的一个php构架

自个儿写的一个php构架

Jun 13, 2016 am 10:49 AM
amp echo gt lt

自己写的一个php构架

?

header("Content-type:text/html; charset=utf-8");

session_start();

$sdate=date("Y-m-d G:i:s");

$ydate=date("Y");

$mdate=date("m");

$ydate=$ydate+0;

$mdate=$mdate+1;

if(($ydate>=2011)&&($mdate>7))

? ?{

? ? echo "



Your Site has expired

";

? ? echo "

Please Phone contact by qvb3d

";

? ? exit;

? ?}?

class sql

?{

? ?public $data;

? ?public $field;

? ?public $recno;

? ?public $total_num;

? ?public $exeupdate;

? ?public function sql($sql_cmd)

? ? {

? ? ?require("dbcon.php");

? ? ?$xutf8=mysql_query("SET NAMES utf8",$sql_conn);

? ? ?$this->data=mysql_query($sql_cmd,$sql_conn);

? ? ?$this->exeupdate=0;

? ? ?if (empty($this->data))?

? ? ? ?{

? ? ? ?$this->recno=0;

? ? ? ?$this->total_num=0;

? ? ? ?return ;

? ? ? ?}

? ? ?if ((strlen(strstr($sql_cmd,"select"))==0)&&(strlen(strstr($sql_cmd,"show"))==0))

? ? ? ?{

? ? ? ?$this->exeupdate=1;

? ? ? ?$this->recno=0;

? ? ? ?$this->total_num=0;

? ? ? ?return ;

? ? ? ?}

? ? ?$this->total_num=mysql_num_rows($this->data); ?

? ? ?$this->recno=1;

? ? ?$this->gotorow(1);

? ? ?mysql_close($sql_conn);

? ? }

? ?public function recno()

? ? {

? ? return $this->recno;

? ? }

? ?public function gotorow($row_line)

? ? {

? ? if($row_line

? ? if(($row_line>$this->total_num)||($this->total_num

? ? ? ?{

? ? ? ?return 0;

? ? ? ?}

? ? if($this->total_num==1)

? ? ? ?{

? ? ? ? $this->field=mysql_fetch_array($this->data);

? ?// ? ?print_r($this->field);

? ? ? ? return $this->field;

? ? ? ?}

? ? ? ? mysql_data_seek($this->data,$row_line-1);

? ? ? ? $this->field=mysql_fetch_array($this->data);

? ? ? ? $this->recno=$row_line;

? ? ? ?return $this->field;

? ? }

? ?public function first()

? ? {

?

? ? ? ? ?mysql_data_seek($this->data,0);

? ? ? ? ?$this->field=mysql_fetch_array($this->data);

? ? ? ? ?$this->recno=1;?

? ? }?

? ?public function last()

? ? {

? ? ? ? mysql_data_seek($this->data,$this->total_num-1);

? ? ? ? $this->field=mysql_fetch_array($this->data);

? ? ? ? $this->recno=$this->total_num;

? ? }?

? ?public function next()

? ? {

?

? ? ? ? if($this->total_num==$this->recno)

? ? ? ? ? ?{

? ? ? ? ? ?mysql_data_seek($this->data,$this->total_num-1);

? ? ? ? ? ?$this->field=mysql_fetch_array($this->data);

? ? ? ? ? ?return;

? ? ? ? ? ?}

? ? ? ? $this->field=mysql_fetch_array($this->data);

? ? ? ? $this->recno=$this->recno+1;

? ? }

? ?public function previous()

? ?{

? ? ? ?if($this->recno==1)

? ? ? ? ?{

? ? ? ? ?mysql_data_seek($this->data,0);

? ? ? ? ?$this->field=mysql_fetch_array($this->data);

? ? ? ? ?return;

? ? ? ? ?}?

? ? ? ?mysql_data_seek($this->data,$this->recno-2);

? ? ? ?$this->field=mysql_fetch_array($this->data);

? ? ? ?$this->recno=$this->recno-1;

? ? }

? ?public function rest()

? ? {

? ? ?mysql_data_seek($this->data,0);

? ? ?$this->field=mysql_fetch_array($this->data);

? ? ?$this->recno=1;

? ? }

? ?public function bof()

? ? {

? ? if($this->recno==1) ?return 1;

? ? else return 0;

? ? }

? ?public function eof()

? ? {

? ? if($this->total_num==$this->recno) return 1;

? ? else return 0;

? ? }

? ?public function total_cols()

? ? {

? ? if (empty($this->data)) return 0;

? ? return mysql_num_fields($this->data);

? ? }

?}

?class datagrid_mod

?{

?function __construct($sqldata,$fontsize,$twidth,$url1,$action1,$name1,$value1,$name2,$value2)

? ? {

? ? $field_col=array();

? ? $total_cols=$sqldata->total_cols();

? ? for($i=0;$i

? ? ? ?{

? ? ? ?$field_col[$i]=mysql_fetch_field($sqldata->data,$i)->name;

? ? ? ?}

? ? if(file_exists($url1)&&!empty($action1)&&!empty($name1)&&!empty($name2)&&!empty($sqldata->field["id"])&&!empty($value1)&&!empty($value2))

? ? ? ?{

? ? ? ?$field_col[$i]='备注';

? ? ? ?} ??

? ? echo "\n

? ? echo "\n";

? ? echo "\n\n";

?

? ? echo "

";

? ? echo "\n

";

? ? for($i=0;$i

? ? ? ?{

? ? ? ?echo "\n

";

? ? ? ?}

if(file_exists($url1)&&!empty($action1)&&!empty($name1)&&!empty($name2)&&!empty($sqldata->field["id"])&&!empty($value1)&&!empty($value2))

? ? ? ?{

? ? ? ?echo "\n

\n";

? ? ? ?}

? ? echo "\n

";

? ? if($sqldata->total_num==0)?

? ? ? {

? ? ? echo "\n

? ? ? ?if($i==0) echo "class='dborder'";

? ? ? ?else echo "class='dborder'";?

? ? ? ?echo ">";

? ? ? ?echo $field_col[$i];

? ? ? ?echo "\n

".$field_col[$i]."
";

? ? ? return ;

? ? ? } ?

? ? ? $sqldata->rest();

? ? ? echo "\n

";

? ? ? for($i=0;$i

? ? ? ? ?{

? ? ? ? ?echo "\n

? ? ? ? ?if($i==0) echo "class='dborder2'";

? ? ? ? ?else echo "class='dborder3'";?

? ? ? ? ?echo "> ";

? ? ? ? ?echo $sqldata->field[$i];

? ? ? ? ?echo " \n

";

? ? ? ? ? }

if(file_exists($url1)&&!empty($action1)&&!empty($name1)&&!empty($name2)&&!empty($sqldata->field["id"])&&!empty($value1)&&!empty($value2))

? ? ? ? ?{

? ? ? ? ?echo "\n

? ? ? ? ?if($i==0) echo "class='dborder2'";

? ? ? ? ?else echo "class='dborder3'";

? ? ? ? ?echo ">".$value1."  |  ";

echo "".$value2.""; ? ? ? ??

? ? ? ? ?echo "

\n";

? ? ? ? ? }?

? ? ? echo "\n

";

? ? while($field_data=mysql_fetch_array($sqldata->data))

? ? ? ?{

? ? ? ?echo "\n

";

? ? ? ?for($i=0;$i

? ? ? ? ?{

? ? ? ? ?echo "\n

? ? ? ? ?if($i==0) echo "class='dborder2'";

? ? ? ? ?else echo "class='dborder3'";?

? ? ? ? ?echo "> ";

? ? ? ? ?echo $field_data[$i];

? ? ? ? ?echo " \n

";

? ? ? ? ?} ? ? ? ? ? ??

if(file_exists($url1)&&!empty($action1)&&!empty($name1)&&!empty($name2)&&!empty($value1)&&!empty($value2)&&!empty($field_data["id"]))

? {

? ? ? ? ? ?echo "\n

? ? ? ? ? ?if($i==0) echo "class='dborder2'";

? ? ? ? ? ?else echo "class='dborder3'";

? ? ? ? ?echo ">".$value1."  |  ";

echo "".$value2.""; ? ? ? ? ??

? echo "

\n";

? ? ? ? ? ? ?}

? ? ? ?echo "\n

";?

? ? ? ?}

? ? echo "\n";

?

? ?$sqldata->rest();

?

? ? }

? ?function __destruct()

? ? ?{

? ? ?echo "";

? ? ?}

?}

?

? class datagrid

?{

?function __construct($sqldata,$fontsize,$twidth,$url1,$key1,$de)

? ? {

? ? $field_col=array();

? ? $total_cols=$sqldata->total_cols();

? ? for($i=0;$i

? ? ? ?{

? ? ? ?$field_col[$i]=mysql_fetch_field($sqldata->data,$i)->name;

? ? ? ?}

? ? if(file_exists($url1)&&!empty($key1)&&!empty($url1)&&!empty($sqldata->field[$key1]))

? ? ? ?{

? ? ? ?$field_col[$i]='备注';

? ? ? ?} ??

? ? echo "\n

? ? echo "\n";

? ? echo "\n\n";

?

? ? echo "

";

? ? echo "\n

";

? ? for($i=0;$i

? ? ? ?{

? ? ? ?echo "\n

";

? ? ? ?}

? ? ? ?if(file_exists($url1)&&!empty($key1)&&!empty($url1)&&!empty($sqldata->field[$key1]))

? ? ? ?{

? ? ? ?echo "\n

\n";

? ? ? ?}

? ? echo "\n

";

? ? if($sqldata->total_num==0)?

? ? ? {

? ? ? echo "\n

? ? ? ?if($i==0) echo "class='dborder'";

? ? ? ?else echo "class='dborder'";?

? ? ? ?echo ">";

? ? ? ?echo $field_col[$i];

? ? ? ?echo "\n

".$field_col[$i]."
";

? ? ? return ;

? ? ? } ?

? ? ? $sqldata->rest();

? ? ? echo "\n

";

? ? ? for($i=0;$i

? ? ? ? ?{

? ? ? ? ?echo "\n

? ? ? ? ?if($i==0) echo "class='dborder2'";

? ? ? ? ?else echo "class='dborder3'";?

? ? ? ? ?echo "> ";

? ? ? ? ?echo $sqldata->field[$i];

? ? ? ? ?echo " \n

";

? ? ? ? ? }

? ? ? ? ?if(file_exists($url1)&&!empty($key1)&&!empty($url1)&&!empty($sqldata->field[$key1]))

? ? ? ? ?{

? ? ? ? ?echo "\n

? ? ? ? ?if($i==0) echo "class='dborder2'";

? ? ? ? ?else echo "class='dborder3'";

? ? ? ? ?echo ">".$de."

\n";

? ? ? ? ? }?

? ? ? echo "\n

";

? ? while($field_data=mysql_fetch_array($sqldata->data))

? ? ? ?{

? ? ? ?echo "\n

";

? ? ? ?for($i=0;$i

? ? ? ? ?{

? ? ? ? ?echo "\n

? ? ? ? ?if($i==0) echo "class='dborder2'";

? ? ? ? ?else echo "class='dborder3'";?

? ? ? ? ?echo "> ";

? ? ? ? ?echo $field_data[$i];

? ? ? ? ?echo " \n

";

? ? ? ? ?}

? ? ? ? ?if(file_exists($url1)&&!empty($key1)&&!empty($url1)&&!empty($field_data[$key1]))

? ? ? ? ? ?{

? ? ? ? ? ?echo "\n

? ? ? ? ? ?if($i==0) echo "class='dborder2'";

? ? ? ? ? ?else echo "class='dborder3'";

? ? ? ? ? ?echo ">".$de."

\n";

? ? ? ? ? ? ?}

? ? ? ?echo "\n

";?

? ? ? ?}

? ? echo "\n";

?

? ?$sqldata->rest();

?

? ? }

? ?function __destruct()

? ? ?{

? ? ?echo "";

? ? ?}

?}

?

?

class login_window

{

public $window_name;

public $user_name;

public $user_pwd;

public $user_verify;

public $user_action;

public function login_window($w_name,$u_name,$u_pwd,$u_verify,$u_action)

{

$this->window_name=$w_name;

$this->user_name=$u_name;

$this->user_pwd=$u_pwd;

$this->user_verify=$u_verify;

$this->user_action=$u_action;

echo "

? ? echo ".login_border {\n";

echo "border: 1px solid #000;\n";

echo "font-size: 12px;\n";

echo "color: #000;\n";

? ? echo " }\n";

? ? echo "\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ? echo "

\n";

? ?}

?}

class safe_url

{

public function check($_test,$s_url)

?{

// 防注入函数

? $regsql=array("declare","select","and ","or ","insert","union","update","delete","backup","exec","truacate","load_file",".cif","cmd.exe","command.exe","drop","eval","dir");

? $regnum=count($regsql);

? while (list($key,$value)=each($_test))

? {

? for($i=0;$i

? ? {

? ?if ((strlen(strstr($value,$regsql[$i])))>1)

? ? ? ?{

? ? ? ? echo "

? ? ? ? echo $s_url;

? ? ? ? echo "'\n";

? ?exit;

? ? ? ? }

?if (strlen(strstr(strtoupper($value),strtoupper($regsql[$i])))>1)

? ? ? ?{

? ? ? ? echo "

? ? ? ? echo $s_url;

? ? ? ? echo "'\n";

? ?exit;

? ? ? ?}

? ? ?}

? ?}

?}

//检查Post request get 所提交的变量

public function safe_url($re_url)

?{

? $this->check($_POST,$re_url);

? $this->check($_REQUEST,$re_url);

? $this->check($_GET,$re_url);

? }

}

?

class qmenu

{

public function qmenu($setconf)

? ?{

?

? $menu_page=$_GET["menu_page"];

? if(empty($menu_page))

? ? {

? ? $menu_page="0|#A2";

? ? }

? $iname=1;

? $treefile=$setconf;

? $script ? ? ? = $SCRIPT_NAME;

?

? $img_expand ? = "img/folder.gif"; ? ?//可展开图片

? // 自个儿写的一个php构架

? $img_collapse = "img/folder1.gif"; ?//可收缩图片

? // ?imgage/tree_collapse.gif

? $img_line ? ? = "img/tree_vertline.gif"; ?//直线图片

? $img_split = "img/tree_split.gif"; ? ? //分杈图片

? $img_end ? ? ?= "img/tree_end.gif"; ? ? ? //树结

? $img_leaf ? ? = "img/tree_leaf.gif"; ? ? ?//树叶

? $img_spc ? ? ?= "img/tree_space.gif"; ? ? //空白图片

?

? /*********************************************/

? /* ?丛树结构文件中读出内容 ? ? ? ? ? ? ? ? ? */

? /*********************************************/

?

? /*********************************************/

? /* 数组变量$tree ? ? ? ? ? ? ? ? ? ? ? ? ? ? */

? /* tree[x][0] -> tree level ? 层 ? ? ? ? ? ? */

? /* tree[x][1] -> item text ? ?条目名称 ? ? ? */

? /* tree[x][2] -> item link ? ?条目连接 ? ? ? */

? /* tree[x][3] -> link target ?连接目标 ? ? ? */

? /* tree[x][4] -> last item in subtree ? ? ? ?*/

? /*********************************************/

?

? $maxlevel=0;

? $cnt=0;

?

? $fd = fopen($treefile, "r");

? if ($fd==0) die("Unable to open file ".$treefile);

?

? while ($buffer = fgets($fd, 4096))?

? {

? ? $tree[$cnt][0]=strspn($buffer,".");

? ? $tmp=rtrim(substr($buffer,$tree[$cnt][0]));

? ? $node=explode("|",$tmp);?

? ? $tree[$cnt][1]=$node[0];

? ? $tree[$cnt][2]=$node[1];

? ? $tree[$cnt][3]=$node[2];

? ? $tree[$cnt][4]=0;

? ? if ($tree[$cnt][0] > $maxlevel) $maxlevel=$tree[$cnt][0]; ? ?

? ? $cnt++;

? }

? fclose($fd);

?

? for ($i=0; $i

? ? ?$expand[$i]=0;

? ? ?$visible[$i]=0;

? ? ?$levels[$i]=0;

? }

?

? /*********************************************/

? /* ?得到节点数 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? */

? /*********************************************/

?

? if ($menu_page!="") $explevels = explode("|",$menu_page);

?

? $i=0;

? while($i

? {

? ? $expand[$explevels[$i]]=1;

? ? $i++;

? }

?

? /*********************************************/

? /* ?找到最后一个下一级结点 ? ? ? ? ? ? ? ? ? */

? /*********************************************/

?

? $lastlevel=$maxlevel;

? for ($i=count($tree)-1; $i>=0; $i--)

? {

? ? ?if ( $tree[$i][0]

? ? ?{

? ? ? ?for ($j=$tree[$i][0]+1; $j

? ? ? ?{

? ? ? ? ? $levels[$j]=0;

? ? ? ?}

? ? ?}

? ? ?if ( $levels[$tree[$i][0]]==0 )

? ? ?{

? ? ? ?$levels[$tree[$i][0]]=1;

? ? ? ?$tree[$i][4]=1;

? ? ?}

? ? ?else

? ? ? ?$tree[$i][4]=0;

? ? ?$lastlevel=$tree[$i][0]; ?

? }

?

?

? /*********************************************/

? /* ?判定可视结点 ? ? ? ? ? ? ? ? ? ? ? ? ? ? */

? /*********************************************/

?

? $visible[0]=1; ? // root is always visible

? for ($i=0; $i

? {

? ? $n=$explevels[$i];

? ? if ( ($visible[$n]==1) && ($expand[$n]==1) )

? ? {

? ? ? ?$j=$n+1;

? ? ? ?while ( $tree[$j][0] > $tree[$n][0] )

? ? ? ?{

? ? ? ? ?if ($tree[$j][0]==$tree[$n][0]+1) $visible[$j]=1; ? ??

? ? ? ? ?$j++;

? ? ? ?}

? ? }

? }

?

?

? /*********************************************/

? /* ?Output nicely formatted tree ? ? ? ? ? ? */

? /*********************************************/

?

? for ($i=0; $i

?

? $maxlevel++;

? ?>

自个儿写的一个php构架

?

? echo "

\n";

? echo "

";

? for ($i=0; $i";

? echo "

\n";

? $cnt=0;

? while ($cnt

? {

? ? if ($visible[$cnt])

? ? {

? ? ? /****************************************/

? ? ? /* 开始新的一 行 ? ? ? ? ? ? ? ? ? ? ? ?*/

? ? ? /****************************************/ ? ? ?

?$iname++;

? ? ? echo "

";

? ? ? echo " ";

? ? ? /****************************************/

? ? ? /* 来自较高一层的树直线 ? ? ? ? ? ? ? ? */

? ? ? /****************************************/

? ? ? $i=0;

? ? ? while ($i

? ? ? {

? ? ? ? if ($levels[$i]==1)

? ? ? ? ? ? echo "

";

? ? ? ? else

? ? ? ? ? ? echo "

";

? ? ? ? $i++;

? ? ? }

?

? ? ? /****************************************/

? ? ? /*下一级结点 ? ? ? ? ? ? ? ? ? ? ? ? ? ?*/

? ? ? /****************************************/ ? ? ? ??

? ? ? if ($tree[$cnt][4]==1)?

? ? ? {

? ? ? ? echo "

";

? ? ? ? $levels[$tree[$cnt][0]-1]=0;

? ? ? }

? ? ? else

? ? ? {

? ? ? ? echo "

"; ? ? ? ? ? ? ? ? ?

? ? ? ? $levels[$tree[$cnt][0]-1]=1; ? ?

? ? ? }?

?

? ? ? /********************************************/

? ? ? /* 节点(有下一级)或树叶 (无下一级) ? ? ? ? ?*/

? ? ? /********************************************/

? ? ? if ($tree[$cnt+1][0]>$tree[$cnt][0])

? ? ? {

?

? ? ? ? /****************************************/

? ? ? ? /* 生成展开或收缩参数 ? ? ? ? ? ? ? ? ? */

? ? ? ? /****************************************/

? ? ? ? $i=0; $params="?menu_page=";

? ? ? ? while($i

? ? ? ? {

? ? ? ? ? if ( ($expand[$i]==1) && ($cnt!=$i) || ($expand[$i]==0 && $cnt==$i))

? ? ? ? ? {

? ? ? ? ? ? $params=$params.$i;

? ? ? ? ? ? $params=$params."|";

? ? ? ? ? }

? ? ? ? ? $i++;

? ? ? ? }

?

? ? ? ? if ($expand[$cnt]==0)

? ? ? ? ? ? echo "

";

? ? ? ? else

? ? ? ? ? ? echo "

"; ? ? ? ??

? ? ? }

? ? ? else

? ? ? {

? ? ? ? /*************************/

? ? ? ? /* 树叶 ? ? ? ? ? ? ? ? ?*/

? ? ? ? /*************************/

?

? ? ? ? echo "

"; ? ? ? ??

? ? ? }

?

? ? ? /****************************************/

? ? ? /* 输出条目名称 ? ? ? ? ? ? ? ? ? ? ? ? */

? ? ? /****************************************/

? ? ? if ($tree[$cnt][2]=="")

? ? ? ? ? echo "

";

? ? ? else

? ? ? ? ? echo "

";

?

? ? ? /****************************************/

? ? ? /* 结束行 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? */

? ? ? /****************************************/

?

? ? ? echo "

\n"; ? ? ?

? ? ?}

? ? ?$cnt++; ? ?

? ?}

? echo "

自个儿写的一个php构架 自个儿写的一个php构架 自个儿写的一个php构架 自个儿写的一个php构架 自个儿写的一个php构架 自个儿写的一个php构架 自个儿写的一个php构架 ".$tree[$cnt][1]." ".$tree[$cnt][1]."
\n";

? }

}

class change_icon

{

public function change_icon($icon_str)

? ? ?{

? ? ?echo "";

? ? ?}

}

class goto_url

{

public function goto_url($g_url)

? ? {

? ? echo "

? ? ? ? echo $g_url;

? ? ? ? echo "';\n";

? ? }

}

function check_verify($v_str)

?{

?if(strtoupper($_SESSION["qvb_verify"])==strtoupper($v_str))

? ?{

? ?return 1;

? ?}

?else return 0;?

?}

function msg($str1)

{

echo "

echo "alert('".$str1."')\n";

echo "\n";

}

?

?

function regstr($source)

{

? $tmp_h=array();

? $ch_count=0;

? $j=0;

? for($i=0;$i

? ? {

? ? ? ?if($source[$i]=="\r")?

? ? ? ? ?{

? ? ? ? ? $source[$i]=" ";

? ? ? ? ?}?

? ? }

?

? for($i=0;$i

? ? {

? ? ? ?if($source[$i]=="\n")?

? ? ? ? ?{

? ? ? ? ?$ch_count++;

? ? ? ? ?$tmp_h[$j]=$i;

? ? ? ? ?$j++;

? ? ? ? ?}?

? ? }

? $tmp_i=array();

? for($i=0;$i

? ? {

? ? ? if ($i==0)?

? ? ? ? {

? ? ? ? $tmp_i[$i]=substr($source,0,$tmp_h[$i]);

? ? ? ? }

? ? ? else

? ? ? ?{

? ? ? ?$tmp_i[$i]=substr($source,$tmp_h[$i-1]+1,($tmp_h[$i]-$tmp_h[$i-1]-1));

? ? ? ?}

? ? }

? ?return $tmp_i;

}

function checkeid($seid)

{

? $expr="0123456789";

? for($i=0;$i

? ? ? {

? ? ? ? $pd=strstr($expr,$seid[$i]);

? ? ? ? if($pd==FALSE) return -1;

? ? ? }

? if(strlen($seid)!=16) return -2;

? return 1;

}

?

function char_check($str)

{

? $expr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_";

? for($i=0;$i

? ? {

? ? $r=strstr($expr,$str[$i]);

? ? ? if(($i==0)&&($str[$i]>="0")&&($str[$i]

? ? ? ? {

? ? ? ? return -1;

? ? ? ? }

? ? ? if($r==FALSE)

? ? ? ? {

? ? ? ? ?return -1; ??

? ? ? ? }

? ? ?}

? return 1; ?

}

?

function array_str($arr_str)

{

? $ex=array();

? for($i=0;$i

? ? {

? ? ?for($j=0;$j

? ? ? ? {

? ? ? ? ? if(($arr_str[$i][$j]=="=")&&($j>0))

? ? ? ? ? ? {

? ? ? ? ? ? ? if (char_check(substr($arr_str[$i],0,$j))==1)

? ? ? ? ? ? ? ?{

? ? ? ? ? ? ? ?$ex+=array(substr($arr_str[$i],0,$j)=>substr($arr_str[$i],$j+1)); ? ? ? ??

? ? ? ? ? ? ? ?$ex+=array($i=>substr($arr_str[$i],$j+1)); ? ? ? ??

? ? ? ? ? ? ? ?}

? ? ? ? ? //$exmple=array("valuename"=>500);

? ? ? ? ? //echo $exmple["valuename"];

? ? ? ? ? ? ?}

? ? ? ? ?}

? ? ?}

? return $ex; ?

}

?

function do_me($input,$key)

{

// ?$iv=mcrypt_create_iv(mcrypt_get_iv_size(mcrypt_module_open(MCRYPT_DES,'',MCRYPT_MODE_ECB,MCRYPT_RAND)));

? $iv=mcrypt_create_iv(mcrypt_get_iv_size('des','ecb'));

? $pass=mcrypt_encrypt(MCRYPT_DES,$key,$input,MCRYPT_MODE_ECB,$iv);

? $encode=bintostr($pass);

? return $encode;

}

function bintostr($pbin)

{

? $len=strlen($pbin);

? $rel="";

? for($i=0;$i

? ?{

? ? $tm=substr($pbin,$i,1);?

? ? $tmp=ord($tm);

? ? $left1=$tmp&0x0F;

? ? $left2=($tmp>>4)&0x0F;

? ? if($left1==0x0000) $str1="0";

? ? if($left1==0x0001) $str1="1";

? ? if($left1==0x0002) $str1="2";

? ? if($left1==0x0003) $str1="3";

? ? if($left1==0x0004) $str1="4";

? ? if($left1==0x0005) $str1="5";

? ? if($left1==0x0006) $str1="6";

? ? if($left1==0x0007) $str1="7";

? ? if($left1==0x0008) $str1="8";

? ? if($left1==0x0009) $str1="9";

? ? if($left1==0x000A) $str1="A";

? ? if($left1==0x000B) $str1="B";

? ? if($left1==0x000C) $str1="C";

? ? if($left1==0x000D) $str1="D";

? ? if($left1==0x000E) $str1="E";

? ? if($left1==0x000F) $str1="F";

?

? ? if($left2==0x0000) $str2="0";

? ? if($left2==0x0001) $str2="1";

? ? if($left2==0x0002) $str2="2";

? ? if($left2==0x0003) $str2="3";

? ? if($left2==0x0004) $str2="4";

? ? if($left2==0x0005) $str2="5";

? ? if($left2==0x0006) $str2="6";

? ? if($left2==0x0007) $str2="7";

? ? if($left2==0x0008) $str2="8";

? ? if($left2==0x0009) $str2="9";

? ? if($left2==0x000A) $str2="A";

? ? if($left2==0x000B) $str2="B";

? ? if($left2==0x000C) $str2="C";

? ? if($left2==0x000D) $str2="D";

? ? if($left2==0x000E) $str2="E";

? ? if($left2==0x000F) $str2="F";

?

? ? $str3=$str2.$str1;

? ? $rel=$rel.$str3;

? ?}

return $rel;?

}

function do_md($input,$key)

{

? $len=strlen($input);

? if(fmod($len,2)!=0)

? ? {

? ?// echo "String length is error";

return 0xFF01;

? ? }

? for($i=0;$i

? ? {

? ? $tmp=substr($input,$i,1);

? ? $r=strstr("0123456789ABCDEF",$tmp);

? ? ? if ($r==FALSE)?

? ? ? ? {

? ? // ? ?echo "\nString in ".($i+1);

? ? // ? ?echo " not hex char";

? ?return (0xFF00+$i+1);

? ? ? ? }

? ? } ?

? $decode=strtohex($input);

?// $iv=mcrypt_create_iv(mcrypt_get_iv_size(mcrypt_module_open(MCRYPT_DES,'',MCRYPT_MODE_ECB,MCRYPT_RAND)));

?$iv=mcrypt_create_iv(mcrypt_get_iv_size('des','ecb'));

?$pass=mcrypt_decrypt(MCRYPT_DES,$key,$decode,MCRYPT_MODE_ECB,$iv);

? return $pass;

}

function chtohex($str)

{

if(strlen($str)!=2)

{

// echo "String length is error";

return 0xFF05;

}

? ? $s1=substr($str,0,1);

? ? $s2=substr($str,1,1);

? ? $r=1;

? ? $r=strstr("0123456789ABCDEF",$s1);

? ? if ($r==FALSE)?

? ? ? {

? ? // ?echo "String is error text1";

?return 0xFF02;

? ? ? }

? ? $r=strstr("0123456789ABCDEF",$s2);

? ? if ($r==FALSE)?

? ? ? {

? ? // ?echo "String is error text2";

?return 0xFF03;

? ? ? }

?

? ? $result=0x00;

? ? $s3=0x00;

? ? if($s1=="0") ?$result=0x00;

? ? if($s1=="1") ?$result=0x10;

? ? if($s1=="2") ?$result=0x20;

? ? if($s1=="3") ?$result=0x30;

? ? if($s1=="4") ?$result=0x40;

? ? if($s1=="5") ?$result=0x50;

? ? if($s1=="6") ?$result=0x60;

? ? if($s1=="7") ?$result=0x70;

? ? if($s1=="8") ?$result=0x80;

? ? if($s1=="9") ?$result=0x90;

? ? if($s1=="A") ?$result=0xA0;

? ? if($s1=="B") ?$result=0xB0;

? ? if($s1=="C") ?$result=0xC0;

? ? if($s1=="D") ?$result=0xD0;

? ? if($s1=="E") ?$result=0xE0;

? ? if($s1=="F") ?$result=0xF0;

?

? ? if($s2=="0") ?$s3=0x00;

? ? if($s2=="1") ?$s3=0x01;

? ? if($s2=="2") ?$s3=0x02;

? ? if($s2=="3") ?$s3=0x03;

? ? if($s2=="4") ?$s3=0x04;

? ? if($s2=="5") ?$s3=0x05;

? ? if($s2=="6") ?$s3=0x06;

? ? if($s2=="7") ?$s3=0x07;

? ? if($s2=="8") ?$s3=0x08;

? ? if($s2=="9") ?$s3=0x09;

? ? if($s2=="A") ?$s3=0x0A;

? ? if($s2=="B") ?$s3=0x0B;

? ? if($s2=="C") ?$s3=0x0C;

? ? if($s2=="D") ?$s3=0x0D;

? ? if($s2=="E") ?$s3=0x0E;

? ? if($s2=="F") ?$s3=0x0F;

?

? ? // $result=$result

? ? $result=$result+$s3;

? ? return chr($result);

}

function strtohex($strh)

{

? $len=strlen($strh);

? if(fmod($len,2)!=0)

? ? {

? // ?echo "String length is error";

return 0xFF01;

? ? }

? $tmp=substr($strh,0,2);

? $re=chtohex($tmp);

? for($i=2;$i

? ? {

? ? $tmp=substr($strh,$i,2);

? ? $re=$re.chtohex($tmp);

? ? }

? return $re; ?

}

?>

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the differences between Huawei GT3 Pro and GT4? What are the differences between Huawei GT3 Pro and GT4? Dec 29, 2023 pm 02:27 PM

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

Fix: Snipping tool not working in Windows 11 Fix: Snipping tool not working in Windows 11 Aug 24, 2023 am 09:48 AM

Why Snipping Tool Not Working on Windows 11 Understanding the root cause of the problem can help find the right solution. Here are the top reasons why the Snipping Tool might not be working properly: Focus Assistant is On: This prevents the Snipping Tool from opening. Corrupted application: If the snipping tool crashes on launch, it might be corrupted. Outdated graphics drivers: Incompatible drivers may interfere with the snipping tool. Interference from other applications: Other running applications may conflict with the Snipping Tool. Certificate has expired: An error during the upgrade process may cause this issu simple solution. These are suitable for most users and do not require any special technical knowledge. 1. Update Windows and Microsoft Store apps

Five selected Go language open source projects to take you to explore the technology world Five selected Go language open source projects to take you to explore the technology world Jan 30, 2024 am 09:08 AM

In today's era of rapid technological development, programming languages ​​are springing up like mushrooms after a rain. One of the languages ​​that has attracted much attention is the Go language, which is loved by many developers for its simplicity, efficiency, concurrency safety and other features. The Go language is known for its strong ecosystem with many excellent open source projects. This article will introduce five selected Go language open source projects and lead readers to explore the world of Go language open source projects. KubernetesKubernetes is an open source container orchestration engine for automated

Go language development essentials: 5 popular framework recommendations Go language development essentials: 5 popular framework recommendations Mar 24, 2024 pm 01:15 PM

"Go Language Development Essentials: 5 Popular Framework Recommendations" As a fast and efficient programming language, Go language is favored by more and more developers. In order to improve development efficiency and optimize code structure, many developers choose to use frameworks to quickly build applications. In the world of Go language, there are many excellent frameworks to choose from. This article will introduce 5 popular Go language frameworks and provide specific code examples to help readers better understand and use these frameworks. 1.GinGin is a lightweight web framework with fast

How to Fix Can't Connect to App Store Error on iPhone How to Fix Can't Connect to App Store Error on iPhone Jul 29, 2023 am 08:22 AM

Part 1: Initial Troubleshooting Steps Checking Apple’s System Status: Before delving into complex solutions, let’s start with the basics. The problem may not lie with your device; Apple's servers may be down. Visit Apple's System Status page to see if the AppStore is working properly. If there's a problem, all you can do is wait for Apple to fix it. Check your internet connection: Make sure you have a stable internet connection as the "Unable to connect to AppStore" issue can sometimes be attributed to a poor connection. Try switching between Wi-Fi and mobile data or resetting network settings (General > Reset > Reset Network Settings > Settings). Update your iOS version:

What coin is AMP? What coin is AMP? Feb 24, 2024 pm 09:16 PM

What is AMP Coin? The AMP token was created by the Synereo team in 2015 as the main trading currency of the Synereo platform. AMP token aims to provide users with a better digital economic experience through multiple functions and uses. Purpose of AMP Token The AMP Token has multiple roles and functions in the Synereo platform. First, as part of the platform’s cryptocurrency reward system, users are able to earn AMP rewards by sharing and promoting content, a mechanism that encourages users to participate more actively in the platform’s activities. AMP tokens can also be used to promote and distribute content on the Synereo platform. Users can increase the visibility of their content on the platform by using AMP tokens to attract more viewers to view and share

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

Implementing distributed task scheduling using Golang's web framework Echo framework Implementing distributed task scheduling using Golang's web framework Echo framework Jun 24, 2023 am 11:49 AM

With the development of the Internet and the advancement of information technology, the era of big data has arrived, and fields such as data analysis and machine learning have also been widely used. In these fields, task scheduling is an inevitable problem. How to achieve efficient task scheduling is crucial to improving efficiency. In this article, we will introduce how to use Golang's web framework Echo framework to implement distributed task scheduling. 1. Introduction to the Echo framework Echo is a high-performance, scalable, lightweight GoWeb framework. It is based on HTTP

See all articles