bug 1411: replaced PayPal link in index/5.php
[cacert-devel.git] / www / advertising.php
1 <? /*
2 LibreSSL - CAcert web application
3 Copyright (C) 2004-2008 CAcert Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */ ?>
18 <?
19 if($_SESSION['profile']['adadmin'] <= 0)
20 {
21 showheader(_("My CAcert.org Account!"));
22 echo _("You don't have access to this area.");
23 showfooter();
24 exit;
25 }
26
27 $id = array_key_exists('id',$_REQUEST)?intval($_REQUEST['id']):0;
28 if($id == 2)
29 $id = 0;
30 $oldid = array_key_exists('oldid',$_POST)?intval($_POST['oldid']):0;
31 $process = array_key_exists('process',$_POST)?$_POST['process']:"";
32
33 loadem("account");
34 $errmsg = "";
35
36 if($oldid == 1 && $process != "")
37 {
38 $title = mysql_real_escape_string(strip_tags(trim(htmlentities($_POST['title']))));
39 $link = mysql_real_escape_string(strip_tags(trim($_POST['link'])));
40 $months = intval($_POST['months']);
41
42 if(!strstr($link, "://"))
43 {
44 $link = "http://".$link;
45 }
46
47 if($months < 1 || $months > 12)
48 {
49 $id = 1;
50 $errmsg .= _("You can only place an advertisement for up to 12 months.")."<br />";
51 $process="";
52 $oldid=0;
53 }
54
55 if(strlen($title) <= 5)
56 {
57 $id = 1;
58 $errmsg .= _("Link title was too short.")."<br />";
59 $process="";
60 $oldid=0;
61 }
62
63 if(strlen($link) <= 10)
64 {
65 $id = 1;
66 $errmsg .= _("Link URI was too short.")."<br />";
67 $process="";
68 $oldid=0;
69 }
70 }
71
72 if($oldid == 1 && $process != "")
73 {
74 $query = "insert into `advertising` set `link`='$link', `title`='$title', `months`='$months', `who`='".$_SESSION['profile']['id']."',
75 `when`=NOW()";
76 mysql_query($query);
77 unset($link);
78 unset($title);
79 unset($months);
80 $id = 1;
81 $errmsg = _("Your advertisement request has been lodge in the system and administrators notified. Once the information has been reviewed, you will be notified if the link was acceptable or declined and the reason for the decline. If the request is successful the system will generate an invoice.");
82 }
83
84 showheader(_("CAcert.org Advertising Section"));
85 includeit($id, "advertising");
86 showfooter();
87 ?>