⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 connect.inc.bak

📁 一个php的公司信息系统
💻 BAK
字号:
<?php
$hostname='localhost';
$username='root';
$password='123';
$db='projectx';


$link_id=mysql_connect($hostname,$username,$password);
if (! $link_id)
{ echo '<html><head><title>Error</title></head><body>';
echo 'Connection to MySQL has failed.';
echo '</body></html>';
exit(); }

$arr_request=array();/*定义数组*/
if (count($_GET)) /*如果用户信息以GET方式输入,则读数据*/
{ while (list($key, $value) = each ($_GET)) /*函数list()与each()配合处理输入数据*/
{ $arr_request[strtolower($key)] = $value; } }
/*函数strtolower()将起区分作用的key字串转为小写,这样对后面的编程有好处,并把他们组成数组*/
if (count($_POST)) /*用户信息以POST方式输入*/
{ while (list($key, $value) = each ($_POST))
{ $arr_request[strtolower($key)] = $value; } } //我们还要定义每次输出的HTML


function html_header($title,$extra='',$vf=0)
{
$html='<html>
<head>
<title>::: '.$title.' :::</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">'
.$extra;
if ($vf==1)
  $html.="<script language=\"JavaScript\">
<!--
function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf(\"?\"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_validateForm() { //v3.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!=\"\") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' 必须是一个有效的E-mail地址.\\n';
      } else if (test!='R') { num = parseFloat(val);
        if (val!=''+num) errors+='- '+nm+' 必须是一个数值.\\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' 必须是从 '+min+' 到 '+max+' 的数值.\\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' 必须填写, 不得为空.\\n'; }
  } if (errors) alert('表单填写有下列错误:\\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>";

$html.='
<link rel="stylesheet" href="common.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="770" border="0" cellspacing="0" cellpadding="0" align="center" height="450">
  <tr>
    <td background="images/bg2.jpg">
      <table width="770" border="0" cellspacing="0" cellpadding="0" height="450">
        <tr>';
echo $html;
}

function html_footer($style=0)
{ global $link_id;
@mysql_close($link_id);
$html='              </tr>
              <tr>
                <td height="40">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0" height="40">
                    <tr>
                      <td valign="bottom" align="right"><font face="Arial"><b>Powered
                        by <img src="images/php.gif" width="39" height="20" align="absmiddle">
                        &amp; <img src="images/mysql.gif" width="82" height="20" align="absmiddle"></b></font></td>
                      <td align="right" valign="bottom" width="200"><font face="Arial">&copy;
                        <a href="mailto:lonelyp@etang.com">Lonely Passenger</a>,2001<br>
                        All rights reserved!</font></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>';
if ($style==1)
  $html.='    </td>
  </tr>
</table>';

$html.='
</body>
</html>';
echo $html;
}//还有一个出错信息处理


function html_error_exit($msg)
{ $errno = mysql_errno(); /*得到错误信息代码*/
$error = mysql_error(); /*得到错误信息,两者一起起排错作用*/
$html_title="Error -$msg";
$html_meta='<META http-equiv="refresh" content="3; url=index.php">';
$html_onload='';
require('htmlhead.inc');
echo $msg."<br>Error: ($errno) $error<br><a href=index.php>返回</a>";
require('htmlend.inc');
exit();}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -