summary refs log tree commit diff stats
path: root/admin/newLink.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/newLink.php')
-rw-r--r--admin/newLink.php93
1 files changed, 93 insertions, 0 deletions
diff --git a/admin/newLink.php b/admin/newLink.php new file mode 100644 index 0000000..3f6b42c --- /dev/null +++ b/admin/newLink.php
@@ -0,0 +1,93 @@
1<?php
2/*
3 444444444
4 4::::::::4
5 4:::::::::4
6 4::::44::::4
7 4::::4 4::::4 Four Island
8 4::::4 4::::4
9 4::::4 4::::4 Written and maintained by Starla Insigna
104::::444444::::444
114::::::::::::::::4 admin/newLink.php
124444444444:::::444
13 4::::4 Please do not use, reproduce or steal the
14 4::::4 contents of this file without explicit
15 4::::4 permission from Hatkirby.
16 44::::::44
17 4::::::::4
18 4444444444
19*/
20
21if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22
23require('headerproc.php');
24
25$category = 'links';
26$pageaid = 'newlink';
27
28$template = new FITemplate('admin/writeLink');
29
30if (isset($_GET['submit']))
31{
32 if (empty($_POST['title']))
33 {
34 $errors[] = array( 'field' => 'title',
35 'text' => 'Title is a required field');
36 }
37
38 if (empty($_POST['url']))
39 {
40 $errors[] = array( 'field' => 'url',
41 'text' => 'URL is a required field');
42 } else if (!preg_match("/^(http(s?):\\/\\/|ftp:\\/\\/{1})((\w+\.)+)\w{2,}(\/?)$/i", $_POST['url']))
43 {
44 $errors[] = array( 'field' => 'url',
45 'text' => 'URL must be a valid URL');
46 }
47
48 if (empty($_POST['type']))
49 {
50 $errors[] = array( 'field' => 'type',
51 'text' => 'Type is a required field');
52 }
53
54 if (isset($errors))
55 {
56 $template->adds_block('ISERROR',array('exi'=>1));
57
58 $eid = 0;
59 foreach ($errors as $error)
60 {
61 $template->adds_block('ERROR', array( 'ID' => $eid,
62 'TEXT' => $error['text']));
63 $template->add('IS' . strtoupper($error['field']) . 'ERROR', ' error');
64 $template->adds_block(strtoupper($error['field']) . 'ERROR', array( 'ID' => $eid,
65 'TEXT' => $error['text']));
66
67 $eid++;
68 }
69
70 $template->add('TITLE', 'New Link');
71 $template->add('ACTION', '/admin/newLink.php?submit=');
72 } else {
73 $inslink = "INSERT INTO links (title,url,type) VALUES (\"" . mysql_real_escape_string($_POST['title']) . "\",\"" . mysql_real_escape_string($_POST['url']) . "\",\"" . mysql_real_escape_string($_POST['type']) . "\")";
74 $inslink2 = mysql_query($inslink);
75
76 $template->adds_block('FLASH', array('TEXT' => 'Your link has been sucessfully created.'));
77
78 $template->add('TITLE', 'Edit Link');
79 $template->add('ACTION', '/admin/editLink.php?id=' . mysql_insert_id() . '&amp;submit=');
80 $template->add('TYPEDISABLED', ' readonly="readonly"');
81 }
82
83 $template->add('TITLEVALUE', $_POST['title']);
84 $template->add('URLVALUE', $_POST['url']);
85 $template->add(strtoupper($_POST['type']) . 'SELECTED', ' checked="checked"');
86} else {
87 $template->add('TITLE', 'New Link');
88 $template->add('ACTION', '/admin/newLink.php?submit=');
89}
90
91$template->display();
92
93?>