This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
agregar.php
68 lines (58 loc) · 1.84 KB
/
agregar.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
<?
/* ===========================
sabros.us monousuario version 1.8
http://sabros.us/
sabros.us is a free software licensed under GPL (General public license)
=========================== */
include("include/config.php");
include("include/conex.php");
include("include/functions.php");
include("include/tags.class.php");
if (!esAdmin()) {
header("Location: login.php");
exit();
}
if($_SERVER["REQUEST_METHOD"]=="POST") {
$titulo = htmlspecialchars($_POST["title"]);
$enlace = $_POST["enlace"];
$descripcion = $_POST["descripcion"];
$etiquetas = $_POST["etiquetas"];
$salto = $_POST["salto"];
$privado = 0;
if (isset($_POST["privado"])) {
$privado = 1;
}else{
if($Sabrosus->ping=="1"){
include("sopa_ping.php");
}
}
if(!isInSabrosus($enlace)) {
$Sql="insert into ".$prefix."sabrosus (title,enlace,descripcion,fecha,privado) values ('".$titulo."','".$enlace."','".$descripcion."', now(),".$privado.")";
mysql_query($Sql,$link);
$Sql = "SELECT LAST_INSERT_ID() as last_id";
$res = mysql_query($Sql,$link);
list($link_id) = mysql_fetch_array($res);
$tags = new tags;
$tags->addTags($etiquetas,$link_id);
} else {
// Link already exist in the DB, so let user edit that link.
$sql = "SELECT id_enlace FROM ".$prefix."sabrosus WHERE enlace='".$enlace."' LIMIT 1";
$result = mysql_query($sql, $link);
$en = mysql_fetch_array($result);
header("Location: editar.php?id=".$en['id_enlace']);
exit();
}
if (isset($_POST["regresa"])) {
if($salto=='cerrar') echo '<SCRIPT LANGUAGE="JavaScript">window.opener=self; window.close();self.close(); window.close(); </SCRIPT>';
else
$url="Location: ".urldecode($_POST["regresa"]);
header($url);
} else {
header("Location: cpanel.php");
exit();
}
} else {
header("Location: index.php");
exit();
}
?>