This repository has been archived by the owner on Nov 17, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsubmit.php
executable file
·73 lines (61 loc) · 3.07 KB
/
submit.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
<?php
// Loads everything needed to run PacerCMS
include_once('includes/cm-header.php');
if ($_GET['mode'] != "")
{
$mode = $_GET['mode'];
} else {;
$mode = "letter";
}
// If posted
if (!empty($_POST['text']))
{
if (empty($_POST['name']) || empty($_POST['email']) || empty($_POST['title']))
{
header("Location: $PHP_SELF?msg=missing");
exit;
}
$submitted_title = prep_string(strip_tags($_POST['title']));
$submitted_text = prep_string(strip_tags($_POST['text']));
$submitted_keyword = strtoupper(strip_tags($mode));
$submitted_author = prep_string(strip_tags($_POST['name']));
$submitted_author_email = prep_string(strip_tags($_POST['email']));
$submitted_author_classification = prep_string(strip_tags($_POST['class']));
$submitted_author_major = prep_string(strip_tags($_POST['major']));
$submitted_author_city = prep_string(strip_tags($_POST['hometown']));
$submitted_author_telephone = prep_string(strip_tags($_POST['telephone']));
$submitted_word_count = count_words($submitted_text);
$issue_id = next_issue('id');
$smarty->assign("submitted_title", $submitted_title );
$smarty->assign("submitted_text", $submitted_text );
$smarty->assign("submitted_keyword", $submitted_keyword );
$smarty->assign("submitted_author", $submitted_author );
$smarty->assign("submitted_author_email", $submitted_author_email );
$smarty->assign("submitted_author_classification", $submitted_author_classification );
$smarty->assign("submitted_author_major", $submitted_author_major );
$smarty->assign("submitted_author_city", $submitted_author_city );
$smarty->assign("submitted_author_telephone", $submitted_author_telephone );
$smarty->assign("submitted_sent", $submitted_sent );
$smarty->assign("submitted_word_count", $submitted_word_count );
$smarty->assign("issue_id", $issue_id );
$query = "INSERT INTO cm_submitted (submitted_title, submitted_text, submitted_keyword, submitted_author, submitted_author_email, submitted_author_classification, submitted_author_major, submitted_author_city, submitted_author_telephone, submitted_sent, submitted_words, issue_id) VALUES ('$submitted_title', '$submitted_text', '$submitted_keyword', '$submitted_author', '$submitted_author_email', '$submitted_author_classification', '$submitted_author_major', '$submitted_author_city', '$submitted_author_telephone', now(), '$submitted_word_count', '$issue_id');";
$stat = run_query($query);
if ($stat)
{
$recipient = site_info('email');
$subject = stripslashes($submitted_title);
$message = stripslashes($smarty->fetch("submit-email.tpl"));
$header = "From: $submitted_author_email";
$sendit = mail($recipient, $subject, $message, $header);
header("Location: $PHP_SELF?msg=submitted");
exit;
} else {
header("Location: $PHP_SELF?msg=failed");
exit;
}
}
$page_title = "Submit";
// Assign variables
$smarty->assign("page_title", $page_title);
// Render
$smarty->display("submit.tpl");