Commit | Line | Data |
---|---|---|
cd274349 | 1 | <?PHP |
ae1c5e9a | 2 | include_once('../slack.php'); |
cd274349 | 3 | include_once('security.php'); |
ae1c5e9a PM |
4 | if ($_COOKIE['level'] == 'user'){ |
5 | slack_general('ADMIN: Redirect User Home ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition'); | |
6 | header('Location: user_home.php'); | |
7 | } | |
cd274349 | 8 | include_once('header.php'); |
1f39b6e9 | 9 | slack_general('ADMIN: petition manager Loaded ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition'); |
989fe01d | 10 | $group_id = $_COOKIE['group_id']; |
13fdcaf5 PM |
11 | if(isset($_POST['web_short_name']) && isset($_POST['web_color']) && isset($_POST['petition_name']) ){ |
12 | $web_short_name = $petition->real_escape_string($_POST['web_short_name']); | |
13 | $web_color = $petition->real_escape_string($_POST['web_color']); | |
14 | $petition_name = $petition->real_escape_string($_POST['petition_name']); | |
15 | $petition->query("insert into petitions (web_short_name,web_color,group_id,petition_name) values ('$web_short_name','$web_color','$group_id','$petition_name') "); | |
16 | } | |
cd274349 PM |
17 | ?> |
18 | ||
989fe01d PM |
19 | <h1>Petitions</h1> |
20 | <?PHP | |
a7049cc9 PM |
21 | if($_COOKIE['level'] == 'admin'){ |
22 | $q="SELECT * FROM petitions"; | |
23 | }else{ | |
24 | $q="SELECT * FROM petitions where group_id = '$group_id'"; | |
25 | } | |
989fe01d PM |
26 | $r = $petition->query($q); |
27 | while($d = mysqli_fetch_array($r)){ | |
a7049cc9 | 28 | echo "<li>$d[admin_status] $d[petition_id] $d[web_short_name] $d[web_color] $d[group_id] $d[petition_name] $d[eligibleVoterListField] $d[eligibleVoterListEquals] $d[eligibleVoterListEnforce]</li>"; |
989fe01d PM |
29 | } |
30 | ?> | |
cd274349 | 31 | |
13fdcaf5 PM |
32 | <h1>New Petition</h1> |
33 | <form method='post'> | |
34 | web_short_name <input name='web_short_name' required> | |
35 | web_color <input name='web_color' required> | |
36 | petition_name <input name='petition_name' required> | |
37 | <input type='submit'> | |
38 | </form> | |
39 | ||
cd274349 PM |
40 | <?PHP |
41 | include_once('footer.php'); | |
42 | ?> |