php简单用户登陆程序代码

这些教程很对初学者来讲是很有用的哦,这款就下面这一点点代码了哦。

<center>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <form name="form1" method="post" action="login_cl.php">
    <table width="500" height="241" border="0" cellpadding="0" cellspacing="0">
      <tr align="center">
        <td colspan="2" bgcolor="#999999">会员登陆界面 (login.php)|<a href="index.php">返回</a> </td>
      </tr>
      <tr bgcolor="#CCCCCC">
        <td width="137" align="center">用户:</td>
        <td width="363"><input name="yd631_name" type="text" id="yd631_name"></td>
      </tr>
      <tr bgcolor="#D9D9D9">
        <td align="center">密码:</td>
        <td><input name="yd631_pws" type="password" id="yd631_pws"></td>
      </tr>
      <tr align="center" bgcolor="#CCCCCC">
        <td colspan="2"><input type="submit" name="Submit" value="提交">   
          <input type="reset" name="submit" value="重置">
   
          </td>
      </tr>
    </table>
  </form>
  <p>&nbsp;</p>
  </center>

登陆的php处理代码

include("config.php");
?>
<?php
if(empty($_POST["yd631_name"])){
echo ("<script type='text/javascript'> alert('用户名怎么能是空的呢!');history.go(-1);</script>");
}
if(empty($_POST["yd631_pws"])){
echo ("<script type='text/javascript'> alert('密码也不能是空的!');history.go(-1);</script>");
}
$yd631_name= $_POST["yd631_name"]; //用户名已经记录了
$yd631_pws= $_POST["yd631_pws"]; //密码已经记录了
$db=mysql_connect($servername,$sqlservername,$sqlserverpws);
mysql_select_db($sqlname,$db);
$sql="select * from $sqltable where yd631_name='$yd631_name' and yd631_pws='$yd631_pws'";
$result=mysql_fetch_array(mysql_query($sql));
if(!$result){
echo ("<script type='text/javascript'> alert('用户名或密码不正确!');history.go(-1);</script>");
mysql_close();
exit;
}
if($result["yd631_pass"]=="no"){
 //验证会员是不是被审核通过了
echo ("<script type='text/javascript'> alert('您还没有被审核呢!');history.go(-1);</script>");
}
session_start();
$_SESSION["name"]="$yd631_name";
echo "<script>location.href='yd631.php';</script>";
?>

config文件。

<?php
//常规参数设置

$servername="localhost";  //主机名
$sqlservername="root"; //mysql数据库用户名
$sqlserverpws="yd631"; //mysql数据库密码

$sqlname="yd631_user"; //数据库名
$sqltable="yd631_users"; //username表名

$admin_name="yd631";  //管理员用户名
$admin_pws="yd631";   //管理员密码
?>

时间: 2024-07-30 10:10:02

php简单用户登陆程序代码的相关文章

php入门用户登陆实例代码与教程

第一步 /* 先创建数据表 直接复制到你的phpmyadmin 直接运行就OK了.1 CREATE TABLE IF NOT EXISTS `useradmin` (   `id` int(4) NOT NULL auto_increment,   `username` varchar(20) default NULL,   `userpass` varchar(40) default NULL,   `logins` int(4) NOT NULL default '0' COMMENT '登

JSP实现的简单Web投票程序代码_JSP编程

本文实例讲述了JSP实现的简单Web投票程序.分享给大家供大家参考.具体如下: 这里使用文本文件作为数据存储的投票系统. 1. vote.java: package vote; import java.io.*; import java.util.*; public class vote { public String filePath = ""; public int n; private File voteFile; private BufferedReader fileRead;

一个简单的用户登陆程序……

Content-Type: Text/Plain; charset="gb2312" Content-Transfer-Encoding: 8bit 以下程序是用来验证用户登录的共有两个按钮,一个是用来提交的,一个是用来重填的,页面部分就很简单了,两个文本框,两个按钮,这里页面的代码就不写了:) Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bu

asp简单用户登陆代码

<!-- #include file="../inc/conn1.asp"--> <!-- #include file="../inc/md5.asp"--> <%   if cstr(request("code"))<>cstr(session("getcode")) then     response.write"<SCRIPT language=JavaScrip

c#+mysql的用户登陆程序出问题了,有没有朋友能帮忙看看

问题描述 boolpass=falseMySQLCommandDBComm;stringsql="select*fromlogon";DBComm=newMySQLCommand(sql,DBConn);MySQLDataAdaptermsda=newMySQLDataAdapter();msda.SelectCommand=newMySQLCommand(sql,DBConn);msda.Fill(this.myDataSet);for(inti=0;i<myDataSet.T

php简单日历实现程序代码

因为最近在写一个日历的项目功能,所以自然而然想到了日志的存档,其实实现这样的功能也不是很难,首先要有一个日历的表单来直观显示日历,而处理日期的时间就交给了编程代码,比如PHP,对于要看之前写的文档,也就是将日历向前翻,那么就需要提交日历时间了,然后再交给表单来显示出来. 效果 下面是一个新手做的PHP日历功能,这里用一个文件将日历的功能给写出来了,文件不是很大,有注释,是一个简单的原理功能,接受部分都是由PHP来处理的,显示部分用的是表格,如果做PHP的日历项目可以直接进行二次开发即可使用.  

php简单分页实例程序代码详解

php分页例子  代码如下 复制代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.111cn.net /TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta ht

ASP.net Logion用户登陆验证代码

asp.net web.config <configuration> -- <system.web>        <database>         <add key="strConn" value="server=107.120.65.99;database=DB;uid=DB;pwd=DB" /> </database> </system.web> -- </configurati

php下使用curl模拟用户登陆的代码_php技巧

bool curl_setopt (int ch, string option, mixed value) curl_setopt()函数将为一个CURL会话设置选项.option参数是你想要的设置,value是这个选项给定的值. 下列选项的值将被作为长整形使用(在option参数中指定): *CURLOPT_INFILESIZE: 当你上传一个文件到远程站点,这个选项告诉PHP你上传文件的大小. *CURLOPT_VERBOSE: 如果你想CURL报告每一件意外的事情,设置这个选项为一个非零值