自己先到google里面搜索一些源码了

解决方案 »

  1.   

    /**
     * 防止sql注入函数
     *
     * @param string  $post_data  用户输入数据
     */
    function quotes($post_data)

        if (!get_magic_quotes_gpc()) 
        { 
           
    if (is_array($post_data) && count($post_data))
    {
    foreach ($post_data as $post_key => $post_val)
    {
    $post_data[$post_key] = quotes($post_val);
         }

    else 
    {
    $post_data=addslashes($post_data);
    }
    return $post_data; }
    else
    {
    return $post_data;
    }
    }/**
    *操作成功提示
    *
    *@param string  $msg   成功信息
    *@param string  $tourl 跳转地址
    */
    function showMsg($msg,$tourl){
    ?>
    <html><head>
    <!-- css -->
    <style type="text/css">
    .menu { font-family: "Verdana"; font-size: 8pt; font-weight: bold; }
    .content { font-family: "Verdana"; font-size: 8pt; }
    .border { border: 1px #000000 dotted; }
    a:visited {  color: #000000; text-decoration: none }
    a:link {  color: #000000; text-decoration: none }
    a:hover {  color: blue; text-decoration: underline }
    </style>
    <!-- css -->
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta HTTP-EQUIV="REFRESH" CONTENT="2;URL=<?php echo "$tourl"; ?>">
    </head>
    <body>
    <table>
    <tr><td height="150">&nbsp;</td>
    </tr>
    </table>
    <table cellspacing="0" cellpadding="5" width="450" class="border" align="center">
    <tr bgcolor="#99CC66">
    <td height="11" align="left" bgcolor="#E1E4CE" class="menu">操作成功</td></tr><tr>
    <td align="left" class="content"><font color="red"><? echo "$msg"; ?></font> 
    <p align="left"><a href="<? echo "$tourl"; ?>">系统两秒钟后将跳转,如果您不想等待请点击</a></p></td></tr>
    </table>
    </body></html>
    <?
        exit;
    }
    /**
    *操作出错提示函数
    *
    */function showError($msg)
    {?>
    <!-- css -->
    <style type="text/css">
    .menu { font-family: "Verdana"; font-size: 8pt; font-weight: bold; }
    .content { font-family: "Verdana"; font-size: 8pt; }
    .border { border: 1px #000000 dotted; }
    a:visited {  color: #000000; text-decoration: none }
    a:link {  color: #000000; text-decoration: none }
    a:hover {  color: blue; text-decoration: underline }
    </style>
    <!-- css -->
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"">
    </head>
    <body>
    <table>
    <tr><td height="150">&nbsp;</td>
    </tr>
    </table>
    <table cellspacing="0" cellpadding="5" width="450" align="center" class="border">
    <tr bgcolor="#99CC66">
    <td height="11" align="left" bgcolor="#E1E4CE" class="menu">错误提示:</td></tr><tr>
    <td align="left" class="content"><font color="red"><br><? echo $msg; ?></font>
    <p align="left"><a href="javascript:history.go(-1);">[返回]</a></p></td></tr>
    </table>
    <?
    exit;
    }