很简短的
分类:热门新闻

php 文件安装方法

提供一款可以保存用户登陆的信息来做了,这里就是一个简单的php 登陆并设置cookie代码哦,很简单的。

require_once('inc.php');if(!file_exists($l_file)){echo getstop();if(!file_exists($c_file)){if($_SERVER['REQUEST_METHOD']=='POST' $_POST['hostname']!='' $_POST['database']!='' $_POST['username']!=''){if(@mysql_connect($_POST['hostname'], $_POST['username'], $_POST['password'])){if(mysql_select_db($_POST['database']) || mysql_query('CREATE DATABASE '.$_POST['database'])){$c_content=?phpn$hostname_conn='.$_POST['hostname'].';n$database_conn='.$_POST['database'].';n$username_conn='.$_POST['username'].';n$password_conn='.$_POST['password'].';n$dbprefix='.$_POST['dbprefix'].';n$conn=mysql_connect($hostname_conn, $username_conn, $password_conn) or die('');nmysql_select_db($database_conn, $conn);.(chksqlv()?nmysql_query(SET NAMES 'gb2312', $conn);n$charset_conn=1;:'').n?;writeText($c_file,$c_content);}else{$e=1;}}else{$e=2;}echo 'script type=text/JavaScript'.(isset($e)?'location.href='?e='.$e:'location.href='mysql.php').'';/script';}else{if(isset($_GET['e']))$msg=$_GET[威尼斯登录首页,'e']==2?'无法连接数据库!':'无法建立数据库!';if(isset($msg))echo 'div class=msg_v'.$msg.'/div';?div class=title第1步:配置MySQL/divdiv class=lcontentform method=post onsubmit=if(document.form1.hostname.value=='' || document.form1.database.value=='' || document.form1.username.value==''){alert('请输入主机名、数据库名、用户名。');return false;} name=form1div class=formlinelabel for=formhostname主机名:/labelinput name=hostname id=formhostname size=32 value=localhost//divdiv class=formlinelabel for=formdatabase数据库名:/labelinput name=database id=formdatabase size=32//divdiv class=formlinelabel for=formusername用户名:/labelinput name=username id=formusername size=32 value=root//divdiv class=formlinelabel for=formpassword密码:/labelinput name=password id=formpassword size=32//divdiv class=formlinelabel for=formdbprefix表前缀:/labelinput name=dbprefix id=formdbprefix size=32 value=alu_//divdiv class=formlineinput type=submit value=下一步 id=formsubmit class=button / input type=reset value=重置 class=button //div/form/div?php}}else{echo 'div class=gcontent要安装'.$app_n.',请先删除'.$b_file.'。/div';}echo getsfoot();}else{header('Location:../');

if(!$c_log){
 $title.='登陆';
 if($_SERVER['REQUEST_METHOD']=='POST'){
  if(isset($_POST['username']) && trim($_POST['username'])!='' && isset($_POST['password']) && trim($_POST['password'])!=''){
   $username=trim($_POST['username']);
   $password=enc_p(trim($_POST['password']));
   $q_author=sprintf('select * from %s where username=%s and password=%s', $dbprefix.'member', SQLString($username, 'text'), SQLString($password, 'text'));
   $author=mysql_query($q_author) or die('');
   $r_author=mysql_fetch_assoc($author);
   if(mysql_num_rows($author)>0){
    if($r_author['status']==0 || $r_main['veri']>0){
     $uSQL=sprintf('update %s set visit=visit+1, visitdate=%s where id=%s', $dbprefix.'member', time(), $r_author['id']);
     $result=mysql_query($uSQL) or die('');
     session_unset();
     session_start();
     $_SESSION['palu_id']=$r_author['id'];
     if(isset($_POST['remember']) && $_POST['remember']=='1'){
      setcookie('palu_u', $username, time()+86400*30);
      setcookie('palu_p', $password, time()+86400*30);
     }else{
      setcookie('palu_u','',time());
      setcookie('palu_p','',time());
     }
    }else{
     $e=1;
    }
   }else{
    $e=2;
   }
   mysql_free_result($author);
  }
  if(isset($_GET['m']))$u[]='m='.$_GET['m'];
  if(isset($_GET['t']))$u[]='t='.$_GET['t'];
  if(isset($_GET['page']))$u[]='page='.$_GET['page'];
  if(isset($e))$u[]='e='.$e;
  $topinfo.='<script type="text/JavaScript">location.href=''.(isset($u)?'?'.join('&', $u):'./').'';</script>';
 }else{
  if(isset($_GET['e'])){
   if($_GET['e']==2){
    $msg='用户名/密码错误!';
   }elseif($_GET['e']==3){
    $msg='注册成功!请'.($r_main['veri']>0?'登陆':'等待管理员审核').'。';
   }else{
    $msg='您的帐号还没有通过审核,请稍候再试。';
   }
  }
  $content.='<div class="tcontent">'.(isset($msg)?'<div class="msg_v">'.$msg.'</div>':'').'<div class="title">登陆</div><div class="lcontent"><form method="post" action="" onsubmit="return chklog();"><div class="formline"><label for="formname">用户名:</label><input name="username" id="formname" size="32" maxlength="20" /></div><div class="formline"><label for="formpw">密 码:</label><input name="password" id="formpw" size="32" maxlength="20" type="password" /></div><div class="formline"><label></label><input name="remember" value="1" type="checkbox" title="为了确保信息安全,请不要在网吧或者公共机房选择此项!如果今后要取消此选项,只需点击“退出登陆”即可。" />记住我</div><div class="formline"><input type="submit" value="登陆" id="formsubmit" class="button" /> <input type="reset" value="取消" class="button" /><br/>'.($r_main['openreg']==0?'<a href="?m=reg">加入本班</a> | ':'').'<a href="?m=lostpw">忘记密码</a></div></form></div></div>';
 }
}else{
 $topinfo.='<script type="text/JavaScript">location.href='./';</script>';
}
?>

本文由威尼斯在线注册平台发布于热门新闻,转载请注明出处:很简短的

上一篇:php创设文件夹 下一篇:没有了
猜你喜欢
热门排行
精彩图文