-
Notifications
You must be signed in to change notification settings - Fork 1
/
metatag.php
executable file
·95 lines (84 loc) · 3.25 KB
/
metatag.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
require_once('database.php');
class metatag {
private $title;
private $description;
private $keywords;
private $custom_metatags;
private $metatag_id;
public function __construct(){
$this->title="";$this->description="";
$this->keywords="";$this->custom_metatags="";
$this->metatag_id="";
}
public function restart_metatags(){
$this->title="";$this->description="";
$this->keywords="";$this->custom_metatags="";
$this->metatag_id="";
}
public function load_from_post($p){
$this->title=addslashes($p['metatag_title']);
$this->description=addslashes($p['metatag_description']);
$this->keywords=addslashes($p['metatag_keywords']);
$this->custom_metatags=addslashes($p['metatags_custom']);
}
public function return_metatag_id(){
return $this->metatag_id;
}
public function show_metatag_form(){
echo('<div class="MetaTag_containter">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10%" height="34" valign="top">Title</td>
<td width="90%"><input name="metatag_title" type="text" id="metatag_title" style="width:98%" size="100" value="'.$this->title.'"/></td>
</tr>
<tr>
<td height="80" valign="top">Keywords</td>
<td><textarea name="metatag_keywords" cols="100" rows="4" style="width:98%" id="metatag_keywords">'.$this->keywords.'</textarea></td>
</tr>
<tr>
<td height="80" valign="top">Description</td>
<td><textarea name="metatag_description" cols="100" rows="4" style="width:98%" id="metatag_description">'.$this->description.'</textarea></td>
</tr>
<tr>
<td height="80" valign="top">Custom metatags</td>
<td><textarea name="metatags_custom" cols="100" rows="4" style="width:98%" id="metatags_custom">'.$this->custom_metatags.'</textarea></td>
</tr>
</table>
<label></label>
<p>
<label></label>
</p>
<p>
<label></label>
</p>
<p> </p>
</div>');
}
public function load_metatags($metatag_serch_id){
$db= new database();
$sql="SELECT * FROM `metatags` as m WHERE m.ID='".$metatag_serch_id."'";
list($result,$a)=$db->query($sql);
if($result && mysql_num_rows($result)>0){
while ($podaci = mysql_fetch_array($result)){
$this->title=$podaci['title'];
$this->keywords=$podaci['keywords'];
$this->description=$podaci['description'];
$this->custom_metatags=$podaci['custom_metatags'];
}
}
}
public function save_to_database(){
$db= new database();
$sql="INSERT INTO `metatags` VALUES (NULL,'".htmlentities($this->title) ."','".htmlentities($this->keywords)."', '".htmlentities($this->description)."', '".$this->custom_metatags."')";
list($a,$this->metatag_id)=$db->query($sql);
return $this->metatag_id;
}
public function update_to_database(){
$db= new database();
$db->open_connection();
$sql="UPDATE `metatags` SET title='".htmlentities($this->title) ."',keywords='".htmlentities($this->keywords)."', description='".htmlentities($this->description)."', custom_metatags='".htmlentities($this->custom_metatags)."' WHERE ID='".$this->metatag_id."'";
$db->query($sql);
}
}
?>