-
Notifications
You must be signed in to change notification settings - Fork 0
/
webcfg.php
47 lines (45 loc) · 1.32 KB
/
webcfg.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
42
43
44
45
46
47
<?php
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->prefix="cms_";
$CFG->host="localhost"; // Your database host
$CFG->user="root"; // Your database username
$CFG->password=""; // Your database password
$CFG->database="webschool"; // Your database name
$CFG->wwwroot="http://localhost/webschool/"; // Your website path
$conn = mysqli_connect($CFG->host,$CFG->user,$CFG->password,$CFG->database);
mysqli_set_charset($conn, "utf8");
function get_reading($name,$table)
{
global $CFG,$conn;
$sql="select reading from ".$CFG->prefix."$table where name='".$name."'";
$rs=mysqli_query($conn,$sql);
$data=mysqli_fetch_assoc($rs);
return $data["reading"];
}
function get_like($id)
{
global $CFG,$conn;
$sql="select likes from ".$CFG->prefix."contents where id=".$id;
$rs=mysqli_query($conn,$sql);
$data=mysqli_fetch_assoc($rs);
return $data["likes"];
}
function get_creading($id)
{
global $CFG,$conn;
$sql="select reading from ".$CFG->prefix."contents where id=".$id;
$rs=mysqli_query($conn,$sql);
$data=mysqli_fetch_assoc($rs);
return $data["reading"];
}
function get_share($id)
{
global $CFG,$conn;
$sql="select share from ".$CFG->prefix."contents where id='".$id."'";
$rs=mysqli_query($conn,$sql);
$data=mysqli_fetch_assoc($rs);
return $data["share"];
}
?>