Advertisement
Guest User

My script

a guest
Oct 2nd, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 22.87 KB | None | 0 0
  1. <?php
  2. $attempts=$_COOKIE['attempts'];
  3. if($attempts<=5)
  4. {
  5. include("../inc/config.php");
  6. $con=mysqli_connect($address,$DB_user,$DB_password,$DB_name);
  7. $myusername=$_COOKIE['username'];
  8. $mypassword=$_COOKIE['password'];
  9. $groupid=$_COOKIE['groupid'];
  10. /*These next few lines caused me a bit of problems
  11. $myusername = stripslashes($myusername);
  12. $mypassword = stripslashes($mypassword);*/
  13. $sql="SELECT 'members' FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
  14. $result=mysqli_query($con,$sql);
  15. $count=mysql_num_rows($result);
  16. if($count!==1){
  17. $newattempt=$attempts+1;
  18. header("location:login.php");
  19. setcookie("attempts", $newattempt, time()+3600);
  20. }
  21. ?>
  22. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  23.  
  24.         "http://www.w3.org/TR/html4/loose.dtd">
  25. <!--Changelog: +=Added $=Removed *=Still to come &=Known Bugs #=Extra info on the item above !=Announcement
  26.  
  27. 0.1 Alpha Dev | Initialization stage | Unknown - Unknown:
  28. -------------------------------------
  29.   + - Database utilization
  30.     + - PHP scripts
  31.     + - Login system
  32.     + - Install system
  33.     # - Auto Sets up the database info in the config file, as well as creates the tables and all.
  34.     * - Adding the items such as the events or links using a cp
  35.     * - An Upload system that also adds the name of the image/video to a column
  36.     * - A script that changes depending on the file extension of the upload
  37.     # - I will use this to determine weather the event would be a picture or video.
  38.     * - Two usergroups, Admin and Super Admin
  39.     # - Admins would have regular access to editing the events and links where Super admins will be able to edit the pages, and the databases at will.
  40.     * - Actually finish the if video script.
  41.     & - Everything to do with SQL is broken
  42.     # - Problem is most likely caused by a failed SQL query.
  43.    
  44. 0.2 Alpha Dev | Functionality update | Unknown - Unknown:
  45. -------------------------------------
  46.     + - Added the use of the default admin account specified in the config.php
  47.     + - Article page that is dynamic and changes depending on the event that linked it.
  48.     $ - Removed the sql selection in the login_check.php
  49.     * - Adding the items such as the events or links using a cp
  50.     * - An Upload system that also adds the name of the image/video to a column
  51.     * - A script that changes depending on the file extension of the upload
  52.     # - I will use this to determine weather the event would be a picture or video.
  53.     * - Two usergroups, Admin and Super Admin
  54.     # - Admins would have regular access to editing the events and links where Super admins will be able to edit the pages, and the databases at will.
  55.     * - Actually finish the if video script.
  56.     $ - All bugs that were known about have been removed.
  57.     ! - Seems to be no bugs in this version
  58.     # - Spoke to soon.
  59.    
  60. 0.3 Alpha Dev | The Overhaul | Unknown - 6/10/2013:
  61. -----------------------------
  62.     ! - The name has changed to OSI
  63.     # - OSI meaning Open Source Intranet
  64.     ! - This is expected to be the second last dev version before testing can begin.
  65.     # - Only thing that is stopping it being now is the bugs.
  66.     + - Added CSS.
  67.     + - Added auto updating system
  68.     + - Added an article page where it dynamically displays content depending on the URL(Known as get in php).
  69.     + - Added Admin CP areas.
  70.     + - Added NoSQL admin login.
  71.     # - Just in case something happens with the connection.
  72.     + - Added Event upload.
  73.     + - Added time.php
  74.     + - Added a method of updating the time.php table
  75.     # - This doesn't require a sql connection as it simply rewrites the php file completely.
  76.     + - Admin groups
  77.     + - Adding and removing users
  78.     + - Finished admin CP
  79.     # - This is untill I get time to add some other non essential functions
  80.     + - Super admin only function in admin CP
  81.     + - Made the admin CP one page
  82.     # - Nothing goes out of the page, all data is submitted in it. This MAY decrease security risks.
  83.     + - Added 2 stage authentication
  84.     + - Redid the changelog
  85.     # - It looked pretty bad. Also added dates and made it easier to read.
  86.     + - Overhauled the entire layout of the Admin CP
  87.     $ - REMOVED MASSIVE SECURITY EXPLOIT.
  88.     # - Missing one =, means anyone could log in, even with invalid credentials.
  89.     * - A script that changes depending on the file extension of the upload.
  90.     * - Actually finish the if video script.
  91.     * - Encrypting cookies
  92.     * - Masive security check
  93.     # - Perhaps an overhaul of the security systems If I find exploits
  94.     & - Sql statements are invalid
  95.     # - Because of this you can't login to the Admin CP
  96.     & - Cant login to Admin CP
  97.     & - Files don't upload
  98.     # - For now just use a URL of the item.
  99.     ======================================================================================================================================================
  100.     End of changelog-->
  101.  
  102. <html lang="en">
  103.  
  104.  
  105.  
  106. <head>
  107.  
  108.  
  109.  
  110.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  111.  
  112.     <title>Kiama High School Intranet - Admin Page</title>
  113.  
  114.  
  115.  
  116. <style type="text/css">
  117. a:link
  118. {
  119.     text-decoration: none;
  120.     position: relative;
  121.     margin-left: 1em;
  122. }
  123.  
  124. a:hover
  125. {
  126.     text-decoration: underline;
  127. }
  128.  
  129. a:before
  130. {
  131.     position: absolute;
  132.     right: 100%;
  133.     top: 0;
  134.     bottom: 0;
  135.     width: 1em;
  136. }
  137. .header {
  138.     color: #FFF;
  139.     background-color: #06F;
  140.     text-align: center;
  141.     padding: 5px;
  142.     font-family: Verdana, Geneva, sans-serif;
  143.     font-size: xx-large;
  144.     margin-top: 20px;
  145.     margin-right: 20px;
  146.     margin-bottom: 0px;
  147.     margin-left: 20px;
  148. }
  149. .subheading {
  150.     font-family: Tahoma, Geneva, sans-serif;
  151.     font-size: 24px;
  152.     background-color: #09F;
  153.     text-align: center;
  154. }
  155. .Name {
  156.     font-family: Tahoma, Geneva, sans-serif;
  157.     text-align: left;
  158. }
  159. .login {
  160.     font-family: Tahoma, Geneva, sans-serif;
  161.     background-color: #06F;
  162.     text-align: center;
  163.     font-size: 18px;
  164.     color: #FFF;
  165. }
  166. .menu {
  167.     background-color: #06F;
  168.     padding: 0px;
  169.     font-family: Tahoma, Geneva, sans-serif;
  170.     font-size: 18px;
  171.     text-align: center;
  172. }
  173. .footer {
  174.     font-family: Tahoma, Geneva, sans-serif;
  175.     font-size: 14px;
  176.     color: #FFF;
  177.     background-color: #333;
  178.     margin: 20px;
  179.     padding: 10px;
  180. }
  181. .footer_top {
  182.     background-color: #121212;
  183. }
  184. .menu_selected {
  185.     background-color: #FFF;
  186.     text-align: center;
  187.     color:#000
  188. }
  189. </style>
  190. </head>
  191. <body link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
  192. <div class="header">
  193.   <div class="Name">
  194.     <table width="100%" height="10%" align="center" class="name">
  195. <tr>
  196. <td width="66%">
  197. <span class="Name">Kiama High School</span>
  198. </td>
  199. <td width="33%">
  200. <p class="login"><a href="admin/login.php"><span >Admin Login</span></a></p>
  201. </td>
  202. </tr>
  203. </table>
  204. </div>
  205. <div class="subheading">
  206. Respect, Commitment to Personal Excellence, Responsibility
  207. </div>
  208. <div class="menu">
  209. <table align="center" width="100%" border="0">
  210.   <tr>
  211.     <td class="menu_selected" width="33%"><a href="home.php"><p class="login">Home</a></a></td>
  212.     <td width="33%"><a href="links.php"><p class="login">Links</p></a></td>
  213.     <td width="33%"><a href="time.php"><p class="login">Time Table</p></a></td>
  214.   </tr>
  215. </table>
  216.  
  217. </div>
  218. </div>
  219. <a href="logout.php">Logout</a>
  220. <br/>
  221. <center>
  222. <form action="admin.php" method="get" name="select">
  223. <select name=area onChange="document.forms['select'].submit()">
  224. <option>---Please Select an action---</option>
  225. <option value="event">Add/Remove Events</option>
  226. <option value="links">Add/Remove Links</option>
  227. <option value="time">Edit Time Table Times</option>
  228. <?php
  229. if($groupid=="0")
  230. {
  231. echo '<option value="users">Add/Remove Users</option>';
  232. //echo '<option value="page">Page edit</option>';
  233. //echo '<option value="database">Edit Database</option>';
  234. }
  235. ?>
  236. </select>
  237. </form>
  238.  
  239. <?php
  240. $selection=$_GET['area'];
  241. if($selection=="users"){
  242. if (isset($_GET['action']))
  243. {
  244. if($_GET['action']=="edit")
  245. {
  246. echo '<table><form action="admin.php?area=users&action=edit_confirm" method="post"><tr>';
  247. $con=mysqli_connect($address,$DB_user,$DB_password,$DB_name);
  248. // Check connection
  249. if (mysqli_connect_errno($con))
  250.   {
  251.   echo "Failed to connect to MySQL: " . mysqli_connect_error();
  252.   }
  253.   $query = "SELECT `members`.*
  254.     FROM members;";
  255.   $result = mysqli_query($con,$query);
  256.   $row = mysqli_fetch_array($result, MYSQLI_BOTH);
  257.   echo '<td>';
  258.   echo '<input type="hidden" name="id" value="'.$row['id'].'"';
  259.   echo '<input type="text" name="username" placeholder="'.$row['username'].'"';
  260.   echo '</td>';
  261.   echo '<td>';
  262.   echo '<input type="password" name="password" placeholder="'.$row['username'].'"';
  263.   echo '</td>';
  264.   echo '<td>';
  265.   echo '<select name="groupid">';
  266.   if ($row['groupid']==1)
  267.   {
  268.   echo '<option value=1>Normal Admin</option';
  269.   echo '<option value=0>Super Admin</option>';
  270.   }
  271.   else{
  272.   echo '<option value=0>Super Admin</option>';
  273.   echo '<option value=1>Normal Admin</option';
  274.   }
  275. echo '</select>';
  276. echo '</tr></form></table>';
  277. }
  278. else{
  279.   echo '<table>';
  280.   echo '<tr>';
  281.   echo '<td>';
  282.   echo 'ID';
  283.   echo '</td>';
  284.   echo '<td>';
  285.   echo 'Username';
  286.   echo '</td>';
  287.   echo '<td>';
  288.   echo 'Password';
  289.   echo '</td>';
  290.   echo '<td>';
  291.   echo 'Group ID';
  292.   echo '</td>';
  293.   echo '</tr>';
  294. $con=mysqli_connect($address,$DB_user,$DB_password,$DB_name);
  295. if (mysqli_connect_errno($con))
  296.   {
  297.   echo "Failed to connect to MySQL: " . mysqli_connect_error();
  298.   }
  299.   $query = "SELECT `members`.*
  300.     FROM members;";
  301.   $result = mysqli_query($con,$query);
  302. while($row = mysqli_fetch_array($result, MYSQLI_BOTH))
  303.   {
  304.   echo '<tr>';
  305.   echo '<td>';
  306.   echo $row['id'];
  307.   echo '</td>';
  308.   echo '<td>';
  309.   echo $row['username'];
  310.   echo '</td>';
  311.   echo '<td>';
  312.   echo $row['password'];
  313.   echo '</td>';
  314.   echo '<td>';
  315.   echo $row['groupid'];
  316.   echo '</td>';
  317.   echo '<td>';
  318.   echo '<form action="admin.php?area=users&action=edit" method="post">';
  319.   echo '<input type="hidden" name="id" value="' .$row['id'] .'"';
  320.   echo '<input type="image" src="../resources/images/postbit/edit.png" alt="Edit">';
  321.   echo '</form>';
  322.   echo '<form action="admin.php?area=users&action=delete" method="post">';
  323.   echo '<input type="hidden" name="id" value="' .$row['id'] .'"';
  324.   echo '<input type="image" src="../resources/images/postbit/delete.png" alt="Delete">';
  325.   echo '</form>';
  326.   echo '</td>';
  327.   echo '</tr>';
  328.   }
  329.   echo '<form action="admin.php?area=users&action=add" method="post">';
  330.   echo '<tr>';
  331.   echo '<td>';
  332.   echo '<input type="image" src="../resources/images/postbit/add.png" alt="Add">';
  333.   echo '</td>';
  334.   echo '<td>';
  335.   echo '<input type="text" name="username" id="username">';
  336.   echo '</td>';
  337.   echo '<td>';
  338.   echo '<input type="password" name="password" id="password">';
  339.   echo '</td>';
  340.   echo '<td>';
  341.   echo '<select name="groupid">';
  342.   echo '<option value="1">Normal Admin</option>';
  343.   echo '<option value="0">Super Admin</option>';
  344.   echo '</select>';
  345.   echo '</td>';
  346.   echo '</tr>';
  347.   echo '</form>';
  348.   echo '</table>';
  349.   mysqli_close($con);
  350.   }
  351. if ($selection=="time"){
  352. echo '<form action="admin.php?area=time" method="post"><br />
  353. <table width="100%" border="0">
  354.  <tr>
  355.     <th scope="col">&nbsp;</th>
  356.    <th scope="col">Monday</th>
  357.    <th scope="col">Tuesday</th>
  358.    <th scope="col">Wednesday</th>
  359.    <th scope="col">Thrusday</th>
  360.    <th scope="col">Friday</th>
  361.  </tr>
  362.    <tr>
  363.    <th scope="row">0</th>
  364.    <td><input type="text" name="mo0"></td>
  365.    <td><input type="text" name="tu0"></td>
  366.    <td><input type="text" name="we0"></td>
  367.    <td><input type="text" name="th0"></td>
  368.    <td><input type="text" name="fr0"></td>
  369.  </tr>
  370.  <tr>
  371.    <th scope="row">1</th>
  372.    <td><input type="text" name="mo1"></td>
  373.    <td><input type="text" name="tu1"></td>
  374.    <td><input type="text" name="we1"></td>
  375.    <td><input type="text" name="th1"></td>
  376.    <td><input type="text" name="fr1"></td>
  377.  </tr>
  378.  <tr>
  379.    <th scope="row">2</th>
  380.    <td><input type="text" name="mo2"></td>
  381.    <td><input type="text" name="tu2"></td>
  382.    <td><input type="text" name="we2"></td>
  383.    <td><input type="text" name="th2"></td>
  384.    <td><input type="text" name="fr2"></td>
  385.  </tr>
  386.  <tr>
  387.    <th scope="row">3</th>
  388.    <td><input type="text" name="mo3"></td>
  389.    <td><input type="text" name="tu3"></td>
  390.    <td><input type="text" name="we3"></td>
  391.    <td><input type="text" name="th3"></td>
  392.    <td><input type="text" name="fr3"></td>
  393.  </tr>
  394.  <tr>
  395.    <th scope="row">4</th>
  396.    <td><input type="text" name="mo4"></td>
  397.    <td><input type="text" name="tu4"></td>
  398.    <td><input type="text" name="we4"></td>
  399.    <td><input type="text" name="th4"></td>
  400.    <td><input type="text" name="fr4"></td>
  401.  </tr>
  402.  <tr>
  403.    <th scope="row">5</th>
  404.    <td><input type="text" name="mo5"></td>
  405.    <td><input type="text" name="tu5"></td>
  406.    <td><input type="text" name="we5"></td>
  407.    <td><input type="text" name="th5"></td>
  408.    <td><input type="text" name="fr5"></td>
  409.  </tr>
  410.  <tr>
  411.    <th scope="row">6</th>
  412.    <td><input type="text" name="mo6"></td>
  413.    <td><input type="text" name="tu6"></td>
  414.    <td><input type="text" name="we6"></td>
  415.    <td><input type="text" name="th6"></td>
  416.    <td><input type="text" name="fr6"></td>
  417.  </tr>
  418.  <tr>
  419.    <th scope="row">7</th>
  420.    <td><input type="text" name="mo7"></td>
  421.    <td><input type="text" name="tu7"></td>
  422.    <td><input type="text" name="we7"></td>
  423.    <td><input type="text" name="th7"></td>
  424.    <td><input type="text" name="fr7"></td>
  425.  </tr>
  426. </table>
  427. <input type="submit" name="time_submit" value="Change Time Tables">
  428. </form>';
  429. }
  430. elseif($selection=="event"){
  431. echo'<form action="admin.php?area=event&" method="get"
  432. enctype="multipart/form-data">
  433. Title
  434. <input type="text" name="title">
  435. <br/>
  436. Information about the event
  437. <input type="text" name="info">
  438. <label for="file">Image</label>
  439. <input type="file" name="file" id="file"><br>
  440. <input type="submit" name="'.$row['id'].'" value="Submit">
  441. </form>';
  442. include ('inc/config.php');
  443. // Create connection
  444. $con=mysqli_connect($address,$DB_user,$DB_password,$DB_name);
  445.  
  446. // Check connection
  447. if (mysqli_connect_errno($con))
  448.   {
  449.   echo "Failed to connect to MySQL: " . mysqli_connect_error();
  450.   }
  451.   $result = mysqli_query($con,"SELECT * FROM Event");
  452. while($row = mysqli_fetch_array($result))
  453.   {
  454.   echo "<a href=" . $row['Link'] . ">";
  455.   echo '<span class="heading">' . $row['Title'] . '</span>';
  456.   echo '<span class="paragraph"'.$row['Information']."";
  457.   echo '<form action="admin.php" method="post">
  458.  <input type="button" name='.$row['id'].'>
  459.  </form>';
  460.   echo "<br\>";
  461.   echo "<hr>";
  462.   echo "<br\>";
  463.   }
  464. }
  465. elseif($selection=="link"){
  466. include ('inc/config.php');
  467. // Create connection
  468. $con=mysqli_connect($address,$DB_user,$DB_password,$DB_name);
  469.  
  470. // Check connection
  471. if (mysqli_connect_errno($con))
  472.   {
  473.   echo "Failed to connect to MySQL: " . mysqli_connect_error();
  474.   }
  475.   $result = mysqli_query($con,"SELECT * FROM Links");
  476. while($row = mysqli_fetch_array($result))
  477.   {
  478.   echo '<span class="heading">' . $row['Title'] . '</span>';
  479.   echo "<br>";
  480.   echo '<span class="paragraph"'.$row['Information']."";
  481.   echo '<form action="admin.php" method="post">
  482.  <input type="button" name='.$row['id'].'>
  483.  </form>';
  484.   echo "<br\>";
  485.   echo "<hr>";
  486.   echo "<br\>";
  487.   }
  488. }
  489. if($_POST['mo0'] !== "" AND $_POST['tu0'] !== "" AND $_POST['we0'] !== "" AND $_POST['th0'] !== "" AND $_POST['fr0'] !== "" AND $_POST['mo1'] !== "" AND $_POST['tu1'] !== "" AND $_POST['we1'] !== "" AND $_POST['th1'] !== "" AND $_POST['fr1'] !== "" AND $_POST['mo2'] !== "" AND $_POST['tu2'] !== "" AND $_POST['we2'] !== "" AND $_POST['th2'] !== "" AND $_POST['fr2'] !== "" AND $_POST['mo3'] !== "" AND $_POST['tu3'] !== "" AND $_POST['we3'] !== "" AND $_POST['th3'] !== "" AND $_POST['fr3'] !== "" AND $_POST['mo4'] !== "" AND $_POST['tu4'] !== "" AND $_POST['we4'] !== "" AND $_POST['th4'] !== "" AND $_POST['fr4'] !== "" AND $_POST['mo5'] !== "" AND $_POST['tu5'] !== "" AND $_POST['we5'] !== "" AND $_POST['th5'] !== "" AND $_POST['fr5'] !== "" AND $_POST['mo6'] !== "" AND $_POST['tu6'] !== "" AND $_POST['we6'] !== "" AND $_POST['th6'] !== "" AND $_POST['fr6'] !== "" AND $_POST['mo7'] !== "" AND $_POST['tu7'] !== "" AND $_POST['we7'] !== "" AND $_POST['th7'] !== "" AND $_POST['fr7'] !== "")
  490. {
  491.     $file = '../time.php';
  492. $contents='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  493. <html xmlns="http://www.w3.org/1999/xhtml">
  494. <head>
  495. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  496. <title>Kiama High School Intranet -</title>
  497. <style type="text/css">
  498. a:link {
  499.     text-decoration: none;
  500.     position: relative;
  501.     margin-left: 1em;
  502. }
  503. a:hover {
  504.     text-decoration: underline;
  505. }
  506. a:before {
  507.     position: absolute;
  508.     right: 100%;
  509.     top: 0;
  510.     bottom: 0;
  511.     width: 1em;
  512. }
  513. .heading {
  514.     font-family: Tahoma, Geneva, sans-serif;
  515.     font-size: x-large;
  516. }
  517. .header {
  518.     color: #FFF;
  519.     background-color: #06F;
  520.     text-align: center;
  521.     padding: 5px;
  522.     font-family: Verdana, Geneva, sans-serif;
  523.     font-size: xx-large;
  524.     margin-top: 20px;
  525.     margin-right: 20px;
  526.     margin-bottom: 0px;
  527.     margin-left: 20px;
  528. }
  529. .subheading {
  530.     font-family: Tahoma, Geneva, sans-serif;
  531.     font-size: 24px;
  532.     background-color: #09F;
  533.     text-align: center;
  534. }
  535. .Name {
  536.     font-family: Tahoma, Geneva, sans-serif;
  537.     text-align: left;
  538. }
  539. .login {
  540.     font-family: Tahoma, Geneva, sans-serif;
  541.     background-color: #06F;
  542.     text-align: center;
  543.     font-size: 18px;
  544.     color: #FFF;
  545. }
  546. .menu {
  547.     background-color: #06F;
  548.     padding: 0px;
  549.     font-family: Tahoma, Geneva, sans-serif;
  550.     font-size: 18px;
  551.     text-align: center;
  552. }
  553. .footer {
  554.     font-family: Tahoma, Geneva, sans-serif;
  555.     font-size: 14px;
  556.     color: #FFF;
  557.     background-color: #333;
  558.     margin: 20px;
  559.     padding: 10px;
  560. }
  561. .footer_top {
  562.     background-color: #121212;
  563. }
  564. .menu_selected {
  565.     background-color: #FFF;
  566.     text-align: center;
  567.     color: #000
  568. }
  569. </style>
  570. </head>
  571. <body link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
  572. <div class="header">
  573.  <div class="Name">
  574.    <table width="100%" height="10%" align="center" class="name">
  575.      <tr>
  576.        <td width="406"> Kiama High School </td>
  577.        <td width="198"><p class="login"><a href="admin/login.php"><span >Admin Login</span></a></p></td>
  578.      </tr>
  579.    </table>
  580.  </div>
  581.  <div class="subheading"> Respect, Commitment to Personal Excellence, Responsibility </div>
  582.  <div class="menu">
  583.    <table align="center" width="100%" border="0">
  584.      <tr>
  585.        <td width="200"><a href="index.php">Home</a></td>
  586.        <td width="200"><a href="links.php">
  587.          <p class="login">Links</p>
  588.        </a></td>
  589.        <td class="menu_selected" width="200"><a href="#">
  590.          <span class="menu_selected" style="color:#000">Time Table</span>
  591.          </a></td>
  592.      </tr>
  593.    </table>
  594.  </div>
  595. </div>
  596. <center>
  597. <br />
  598. <span class="heading">
  599. Time Table
  600. </span>
  601. <hr />
  602. <table width="100%" border="0">
  603.  <tr>
  604.    <th scope="col">Monday</th>
  605.    <th scope="col">Tuesday</th>
  606.    <th scope="col">Wednesday</th>
  607.    <th scope="col">Thursday</th>
  608.    <th scope="col">Friday</th>
  609.  </tr>
  610.  <tr>
  611.    <td>'.$_POST['mo0'].'</td>
  612.    <td>'.$_POST['tu0'].'</td>
  613.    <td>'.$_POST['we0'].'</td>
  614.    <td>'.$_POST['th0'].'</td>
  615.    <td>'.$_POST['fr0'].'</td>
  616.  </tr>
  617.  <tr>
  618.    <td>'.$_POST['mo1'].'</td>
  619.    <td>'.$_POST['tu1'].'</td>
  620.    <td>'.$_POST['we1'].'</td>
  621.    <td>'.$_POST['th1'].'</td>
  622.    <td>'.$_POST['fr1'].'</td>
  623.  </tr>
  624.  <tr>
  625.    <td>'.$_POST['mo2'].'</td>
  626.    <td>'.$_POST['tu2'].'</td>
  627.    <td>'.$_POST['we2'].'</td>
  628.    <td>'.$_POST['th2'].'</td>
  629.    <td>'.$_POST['fr2'].'</td>
  630.  </tr>
  631.  <tr>
  632.    <td>'.$_POST['mo3'].'</td>
  633.    <td>'.$_POST['tu3'].'</td>
  634.    <td>'.$_POST['we3'].'</td>
  635.    <td>'.$_POST['th3'].'</td>
  636.    <td>'.$_POST['fr3'].'</td>
  637.  </tr>
  638.  <tr>
  639.    <td>'.$_POST['mo4'].'</td>
  640.    <td>'.$_POST['tu4'].'</td>
  641.    <td>'.$_POST['we4'].'</td>
  642.    <td>'.$_POST['th4'].'</td>
  643.    <td>'.$_POST['fr4'].'</td>
  644.  </tr>
  645.  <tr>
  646.    <td>'.$_POST['mo5'].'</td>
  647.    <td>'.$_POST['tu5'].'</td>
  648.    <td>'.$_POST['we5'].'</td>
  649.    <td>'.$_POST['th5'].'</td>
  650.    <td>'.$_POST['fr5'].'</td>
  651.  </tr>
  652.  <tr>
  653.    <td>'.$_POST['mo5'].'</td>
  654.    <td>'.$_POST['tu5'].'</td>
  655.    <td>'.$_POST['we5'].'</td>
  656.    <td>'.$_POST['th5'].'</td>
  657.    <td>'.$_POST['fr5'].'</td>
  658.  </tr>
  659.    <tr>
  660.    <td>'.$_POST['mo6'].'</td>
  661.    <td>'.$_POST['tu6'].'</td>
  662.    <td>'.$_POST['we6'].'</td>
  663.    <td>'.$_POST['th6'].'</td>
  664.    <td>'.$_POST['fr6'].'</td>
  665.  </tr>
  666.    <tr>
  667.    <td>'.$_POST['mo7'].'</td>
  668.    <td>'.$_POST['tu7'].'</td>
  669.    <td>'.$_POST['we7'].'</td>
  670.    <td>'.$_POST['th7'].'</td>
  671.    <td>'.$_POST['fr7'].'</td>
  672.  </tr>
  673. </table>
  674.  
  675. </center>
  676. </body>
  677. </html>';
  678. }
  679. elseif($_POST['mo0'] == "" AND $_POST['tu0'] == "" AND $_POST['we0'] == "" AND $_POST['th0'] == "" AND $_POST['fr0'] == "" AND $_POST['mo1'] == "" AND $_POST['tu1'] == "" AND $_POST['we1'] == "" AND $_POST['th1'] == "" AND $_POST['fr1'] == "" AND $_POST['mo2'] == "" AND $_POST['tu2'] == "" AND $_POST['we2'] == "" AND $_POST['th2'] == "" AND $_POST['fr2'] == "" AND $_POST['mo3'] == "" AND $_POST['tu3'] == "" AND $_POST['we3'] == "" AND $_POST['th3'] == "" AND $_POST['fr3'] == "" AND $_POST['mo4'] == "" AND $_POST['tu4'] == "" AND $_POST['we4'] == "" AND $_POST['th4'] !== "" AND $_POST['fr4'] == "" AND $_POST['mo5'] == "" AND $_POST['tu5'] == "" AND $_POST['we5'] == "" AND $_POST['th5'] == "" AND $_POST['fr5'] == "" AND $_POST['mo6'] == "" AND $_POST['tu6'] == "" AND $_POST['we6'] == "" AND $_POST['th6'] == "" AND $_POST['fr6'] == "" AND $_POST['mo7'] == "" AND $_POST['tu7'] == "" AND $_POST['we7'] == "" AND $_POST['th7'] == "" AND $_POST['fr7'] == "")
  680. {
  681.     echo 'please fill in all the period times';
  682. }
  683. /*$allowedExts = array("gif", "jpeg", "jpg", "png");
  684. $temp = explode(".", $_FILES["file"]["name"]);
  685. $extension = end($temp);
  686. if ((($_FILES["file"]["type"] == "image/gif")
  687. || ($_FILES["file"]["type"] == "image/jpeg")
  688. || ($_FILES["file"]["type"] == "image/jpg")
  689. || ($_FILES["file"]["type"] == "image/pjpeg")
  690. || ($_FILES["file"]["type"] == "image/x-png")
  691. || ($_FILES["file"]["type"] == "image/png"))
  692. && ($_FILES["file"]["size"] < 20000)
  693. && in_array($extension, $allowedExts))
  694.   {
  695.   if ($_FILES["file"]["error"] > 0)
  696.     {
  697.     echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
  698.     }
  699.   else
  700.     {
  701.     echo "Upload: " . $_FILES["file"]["name"] . "<br>";
  702.     echo "Type: " . $_FILES["file"]["type"] . "<br>";
  703.     echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
  704.     echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
  705.  
  706.     if (file_exists("upload/" . $_FILES["file"]["name"]))
  707.       {
  708.       echo $_FILES["file"]["name"] . " already exists. ";
  709.       }
  710.     else
  711.       {
  712.       include('../inc/config.php');
  713. // Create connection
  714. $title=$_POST['title'];
  715. $info=$_POST['info'];
  716. $con=mysqli_connect($address,$DB_user,$DB_password,$DB_name);
  717. $query = "INSERT INTO `Event` (`id`, `Title`, `Info`, `Image`) VALUES (NULL, '$title', '$info', '" .$_FILES['file']['name']."');";
  718. $result = mysqli_query($con,$query);
  719.       move_uploaded_file($_FILES["file"]["tmp_name"], "images/" . $_FILES["file"]["name"]);
  720.       echo "Stored in: " . "images/" . $_FILES["file"]["name"];
  721.       }
  722.     }
  723.   }*/
  724.   }
  725.  else{
  726. header("location:login.php");
  727. }
  728. ?></center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement