1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<?php
function check_input($value) { if(!empty($value)){ // 去除斜杠 if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // 如果不是数字则加引号 if (!is_numeric($value)) { $value = mysql_real_escape_string($value) ; } return $value; }else{ return $value; } }
$dbh = mysql_connect("192.168.11.11", "kelvinsa", "1k2e3l4v5i6n");
if (!$dbh) { die('Could not connect: ' . mysql_error()); } $selected = mysql_select_db("kelvintestdb",$dbh) or die("Could not select first_test");
mysql_query("SET NAMES UTF8"); ?>
|