JS 和PHP 数据库操作在一个页面
<?
require ("config.php3");
?>
<?
if($submit)
{
//echo $action;
//if($action=='update')
if($id)
{
$query="update banner_place set adv_plc='$adv_plc',size='$size',description='$description' where id=$id";
$message="update banner place ";
}
else
{
$query="insert into banner_place (adv_plc,size,description) values ('$adv_plc','$size','$description')";
$message="added banner place " ;
}
$my_res = mysql_db_query($phpAds_db, $query) or mysql_die();
// Header("Location: banner.php3?pageid=$pageid&message=".urlencode($message));
// Header("Location: banner.php3");
echo "<script>window.location.href ='admin.php3?pageid=$pageid&message=$message'</script>";
exit();
}
?>
<?
相关文档:
HTML代码
<form action="" method="post">
<input name="ID_Dele[]" type="checkbox" id="ID_Dele[]" value="1"/>
<input name="ID_Dele[]" type="checkbox" id="ID_Dele[]" value="2"/>
<input name="ID_Dele[]" type="checkbox" id="ID_Dele[]" value="3"/>
<input name="ID_D ......
<?php
// An array of allowed users and their passwords
$users = array(
'harryf' => 'secret',
'tom' => 'mypwd'
);
// If there's no Authentication header, exit
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic real ......
PHP是个伟大的web开发语言,灵活的语言,但是看到php程序员周而复始的犯的一些错误。我做了下面这个列表,列出了PHP程序员经常犯的10中错误,大多数和安全相关。看看你犯了几种
1.不转意html entities
一个基本的常识:所有不可信任的输入(特别是用户从form中提交的数据) ,输出之前都要转意。
......
1.
$query = $this->db->query('SELECT name, title, email from my_table');
foreach ($query->result() as $row)
{
echo $row->title;
echo $row->name;
echo $row->email;
}
2.
foreach ($query->result_array() as $row)
{ ......
这些天想作一个在网站中实现插件的功能,谷歌了一下,发现一篇文章感觉对我帮助很大,帖出来和大家分享,废话不多说,直接帖出代码供大家分析:
首先是插件的管理类的实现:
<?
/**
* STBLOG PluginManager Class
*
* 插件机制的实现核心类
*
* @package STBLOG
* @subpackage Libraries
* @ ......