-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddauthor.php
More file actions
75 lines (68 loc) · 2.23 KB
/
addauthor.php
File metadata and controls
75 lines (68 loc) · 2.23 KB
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
<?php
include("./config.php");
$fl = new TemplatePower("./templates/addauthor.tpl");
require("./header.php");
$fl->assign("_ROOT.SITENAAM", $sitenaam." / Add an author");
if((isset($login)&&$login==1) || (isset($authenticated)&&$authenticated==1))
{
if(isset($_POST['notify'])&&$_POST['notify']=="yes")
{
$notify=1;
}
else
{
$notify=0;
}
if(!isset($_POST['finished'])||(isset($_POST['finished'])&&$_POST['name']==""))
{
$fl->newBlock("authorform");
if(isset($_POST['finished'])&&$_POST['name']=="")
{
$fl->assign("FORMNAME", stripslashes($_POST['name']));
$fl->assign("FORMFIRSTNAME", stripslashes($_POST['firstname']));
$fl->assign("FORMBIO", stripslashes($_POST['bio']));
if($notify==1)
{
$fl->assign("CHECKED", "CHECKED");
}
else
{
$fl->assign("CHECKED", "");
}
$fl->newBlock("feedback");
$fl->assign("FEEDBACK", "You did not complete the required field (Name). Please complete the form and try again");
}
}
if(isset($_POST['finished'])&&$_POST['name']!="")
{
$name=invoer($_POST['name']);
$firstname=invoer($_POST['firstname']);
$bio=invoer($_POST['bio']);
$invoerid=get_uid($username);
$query="INSERT INTO fl_authors (name, bio, submittedby, notify, firstname) VALUES ('".$name."', '".$bio."', '".$invoerid."', '".$notify."', '".$firstname."')";
$result=mysql_query($query);
if($result==1)
{
$fl->newBlock("feedback");
$fl->assign("FEEDBACK", "The author was succesfully added to the database");
if($notify==1)
{
$fl->newBlock("feedback");
$fl->assign("FEEDBACK", "You will be notified when the author is approved by one of our librarians");
}
}
else
{
report_error("addauthor.php", mysql_error());
$fl->newBlock("feedback");
$fl->assign("FEEDBACK", "Something went wrong while adding the author. Our librarians have been notified. Please try again later");
}
}
}
else
{
$fl->newBlock("feedback");
$fl->assign("FEEDBACK", "You need to be logged in to add an author to the library. If you don't have an account yet, you can <a href=\"".$fileroot."/signup.php\">sign up for an account here</a>");
}
$fl->printToScreen();
?>