导航:首页 > 编程语言 > php页面设计代码

php页面设计代码

发布时间:2024-10-16 12:15:41

php如何生成HTML页面 要详细的生成过程代码

很简单,用ob_start压制,然后保存到一个html页面就可以了,写了个小演示
访问时在后面加参数 ?id=xxx xxx为任意数字,你把里面的输出换成你的动态页面就可以了,代码里有解释

<?php
ob_start();

/*下面的内容就是你原来的动态页面*/
$id=isset($_GET["id"])?$_GET["id"]:'';
if ($id!=''){
echo "原使用参数的页面 参数为".$id."</br>已生成<a href=\"$id.html\">$id.html</a>";
}
/*结束*/

$info=ob_get_contents();
$file=fopen($id.'.html','w');
fwrite($file,$info);
fclose($file);
?>

Ⅱ PHP做一个用户登录页面

index.html登录页面代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>登录示例</title>
</head>

<body>
<form id="forms" name="forms" method="post" action="loginchk.php">
用户名:<input type="text" id="uname" name="uname" value=""/><br/>
密码:<input type="password" id="upass" name="upass" value=""/><br/>
<input type="submit" id="loginbtn" value="立即登录"/>
<input type="reset" id="resetbtn" value="重新填写"/>
</form>
</body>
</html>

loginchk.php 的PHP程序代码如下:
<?php
$uname=trim($_REQUEST["uname"]);
$upass=trim($_REQUEST["upass"]);
if($uname=="admin"&&$upass=="admin")
{
echo "登录成功";
}
else
{
echo "登录失败,<a href='index.html'>重新登录</a>";
}
?>

以上只是一个简单示例,真正的开始,需要考到很多因素,比如说登录前有效性检查,加入登录验证码,程序需要连接数据库进行用户匹配等。
希望对你有帮助 。
如果使用数据库进行进行匹配的话,PHP程序可以这样改进一下。
<?php
$uname=trim($_REQUEST["uname"]);
$upass=trim($_REQUEST["upass"]);

$con = mysql_connect("localhost","root","root");
mysql_select_db("dbname", $con);
$result = mysql_query("select * from sers where uname='$uname' and upass='$upass'");
$rs = mysql_fetch_array($result);
if($rs)
{
echo "登录成功";
}
else
{
echo "登录失败,<a href='index.html'>重新登录</a>";
}
?>
不过你需要连接到你自己的指定的数据库和数据表。

Ⅲ 求写个比较简单的php登陆页面代码

主页面:index.php <form name="form1" action="login.php" method="post" onsubmit="return check()"><!--这里注意onclick的用法-->
账号:<input name="adminAccount" type="text" />

密码:<input type="password" name="adminPass" />

输入验证码:<input type="text" name="validate" />
< br />
<input type="submit" value="登陆" /><input type="reset" value="重置">
</form>判断页面:login.php<?php
//再连库判断账号密码
require_once("../inc/dbconfig.php");
$adminAccount=$_POST['adminAccount'];
$adminPass=md5($_POST['adminPass']);
$sql="select * from admin where adminAccount='$adminAccount' and adminPass='$adminPass'";
$result=mysql_query($sql) or die($sql);
$rows=mysql_num_rows($result);
if($rows==0){
?>
<script language="javascript">
alert("管理员账号密码错误!");
window.location="index.php";
</script>
<?
exit();
}
//将管理员账号赋值给session
$_SESSION['adminAccount']=$adminAccount;
?>
<script language="javascript">
window.location="command.php";
</script>配置文件自己来就行了!

Ⅳ php网页怎么编辑源代码

现在这个页面没有具体代码 只有两句话
第一句 定义个常数 值=1
第二具 引用一个文件 叫做 load.php
你需要去修改 load.php 页面的代码 所有输出应该到在那个页面中。

Ⅳ 求这个PHP页面如何加入代码才能实现自动跳转到其他网站

<?php
header('Location: http://www..com');//换成你想要跳至的网址

error_reporting(E_ERROR | E_PARSE | E_STRICT);

define('SITE_PATH', getcwd());
define('RUNTIME_ALLINONE', false);
define('NO_CACHE_RUNTIME', true);

require(SITE_PATH.'/core/sociax.php');

$App = new App();
$App->run();

Ⅵ 求一个PHP登陆页面代码

改完了

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>这里是网站的标题</title>
<link href="css/index.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body,td,th {
font-size: 14px;
}
a:link {
text-decoration: none;
color: #FFFFFF;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.STYLE99 {

font-family: Georgia, "Times New Roman", Times, serif;
color: #FF00FF;
}
-->
</style></head>

<body>

<div id="bigbox" class="ceng">
<div id="banner" class="ceng"><img src="images/banner.gif" width="778" height="70" /></div>
<div id="main" class="ceng">
<form id="form1" name="form1" method="post" action="post.php">
<div id="log">
<div id="logxx"><span class="dazi">这里是网站的标题</span></div>
<div id="yonghu">用户名:
<input name="user" type="text" id="user" />
</div>
<div id="mima">密 码:
<input name="pass" type="password" id="pass" />
</div>
<div id="yanzheng">验证码:
<input name="yz" type="text" id="yz" size="8" maxlength="4" />
<?php
//$yzm = rand(1000, 9999 );
//echo $yzm;
$seedarray =microtime();
$seedstr =split(" ",$seedarray,5);
$seed =$seedstr[0]*10000;
//第二步:使用种子初始化随机数发生器
srand($seed);
//第三步:生成指定范围内的随机数
$random =rand(1000,9999);
echo "<span class=\"STYLE99\">".$random."</span>";
?>
<input name="hiddenField" type="hidden" id="hiddenField" value="<?php echo $random ?>" />
</div>
<div id="tijiao">
<input type="submit" name="Submit" value="提交" />

<input type="reset" name="Submit2" value="重置" />
</div>
</div>
</form>
</div>
<?php include("buttom.php");?>
</div>

</body>
</html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>这里是网站的标题 </title>
<link href="css/index.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body,td,th {
font-size: 14px;
}
a:link {
text-decoration: none;
color: #FFFFFF;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style></head>

<body>
<div id="bigbox" class="ceng">
<div id="banner" class="ceng"><img src="images/banner.gif" width="778" height="70" /></div>
<div id="main" class="ceng">

<div id="log">
<div id="logxx"><span class="dazi">这里是网站的标题</span></div>
<div id="yonghu">
<?php
function make_safe($variable) {
$variable = addslashes(trim($variable));
return $variable;
}
$user=make_safe($_REQUEST["user"]);
$pass=make_safe($_REQUEST["pass"]);
$yz=make_safe($_REQUEST["yz"]);
$yzma=make_safe($_REQUEST["hiddenField"]);

if ($yz == $yzma)
{
if ($user=="" or $pass=="" or $yz =="")
{
echo"你输入的信息有空,请<a href=\"login.php\">"."返回"."</a>重新输入";
}
else
{
mysql_connect("localhost","root","12345") /*请修改用户名和密码*/
or die("无法连接数据库,请重来");
mysql_select_db("user")
or die("无法选择数据库,请重来");
mysql_query("SET NAMES 'gbk'");/*解决汉字*/
$row = mysql_fetch_assoc(mysql_query(" SELECT pass,xh FROM yh where name = '$user' and password = '$pass'"));
$mima=$row[password];

if($pass == $mima)
{
session_start();
$_SESSION['yhm']=$user;
echo "<script>alert('成功登陆')</script>";
echo "<script>window.location.href='a.php';</script>";
}
else
{
echo"你的用户名或者密码输入错误,请<a href=\"login.php\">"."返回"."</a>";
}
}
}
else
{
echo"您输入的验证码不正确!请<a href=\"login.php\">"."返回"."</a>";
}
?>

</div>
<div id="mima"></div>
<div id="yanzheng"></div>
<div id="tijiao"></div>
</div>

</div>
<?php include("buttom.php");?>
</div>
</body>
</html>

阅读全文

与php页面设计代码相关的资料

热点内容
点爱APP怎么下载不了了 浏览:105
pr视频生成文件夹能删除吗 浏览:715
香港云服务器1m带宽吗 浏览:366
如何打开老手机内存卡加密 浏览:850
单片机8脚5v 浏览:58
防止反编译技术 浏览:489
网关的加密方式用哪个 浏览:232
加密便签在哪里找小米 浏览:527
对数函数的预算法则 浏览:893
会计基础教材pdf 浏览:408
怎么用苹果平板登安卓账号王者 浏览:379
苹果怎么下rosi的app 浏览:488
单片机usb模块作用 浏览:936
拿破仑传pdf 浏览:885
Java7程序设计 浏览:402
黑马程序员百度云 浏览:559
java验证码识别算法 浏览:759
单片机共阳极数码管0到9重复 浏览:940
pdf如何图片格式 浏览:383
龙虎榜接收数据器源码 浏览:648