-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconn.php
42 lines (36 loc) · 790 Bytes
/
conn.php
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
32
33
34
35
36
37
38
39
40
41
<?php
$servername="localhost:3305";
$username="root";
$password="1234";
$dbname="dj";
//create connection
$conn= mysqli_connect($servername,$username,$password,$dbname);
//check connection
if (!$conn){
die("Connection failed:".mysqli_connect_error());
}
//echo "Connected successfully";
//UTF-8
mysqli_set_charset($conn,"UTF8");
//Error message
function Error($msg){
echo"
<script>
window.alert('$msg');
history.back();
</script>
";
exit;
}
//cookie 获取user名
//function user(){
// global $conn;
// $temps=$_COOKIE['COOKIES'];
// $COOKIE=explode("//","$temps");
// $query = "select *from member where user='$COOKIE[0]'";
// $result = mysqli_query($conn, $query);
// $user = mysqli_fetch_array($result);
// return $user;
//
//
//}