日期:2014-05-17  浏览次数:20471 次

自己写的一个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 "<body bgcolor='#FF0000'><br><br><center><h1>Your Site has expired <br></h1>";

? ? echo "<h3>Please Phone contact by qvb3d</h3></center></body>";

? ? 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<1) ?return 0;

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

? ? ? ?{

? ? ? ?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-&g