function showlist($perpage) { global $list_prefix; $PRAYERLISTMOD = loadtmplate("prayerlist.mod"); //lets set our content to be blank. $CONTENT = ""; //lets setup our query $sql = "SELECT * FROM " . $list_prefix . "prayer_list WHERE `expired` = '0' LIMIT 0," . $perpage . ";"; //now lets show the prayerlist entries. $result = db_query($sql); @($rows = db_num_rows($result)); if ($rows != 0) { $j = 0; while ($j < $rows) { //lets fetch our prayer request from the database. $row = db_fetch_array($result); //lets insert the prayerrequest into our working copy of this template. $WORK = insert_into_template($PRAYERLISTMOD, "{REQUESTFOR}", striphtml($row['request_for'])); $WORK = insert_into_template($WORK, "{REQUEST}", striphtml($row['request'])); if ($admin == 1) { $WORK = insert_into_template($WORK, "{DELETE}", "<a href='prayerlist.php?delete=" . $row['id'] . "'>Delete</a>"); } $j++; //now lets add this request to the CONTENT. $WORK = insert_into_template($WORK, "{REQUESTID}", $row['id']); $CONTENT .= $WORK; } } else { $CONTENT .= "There are no active prayer requests at this time.<BR>\r\n"; } //when we output this lets make sure that the output is stripped of any template elements that are not used. return striptemplate($CONTENT); }
function shownews($id) { global $list_prefix, $NEWS, $MAIN; $sql = "SELECT * FROM " . $list_prefix . "news WHERE id = '" . $id . "';"; $result = db_query($sql); $rows = db_num_rows($result); if ($rows != 0) { $row = db_fetch_array($result); $postedby = getuser($row['posted_by']); //lets insert the prayerrequest into our working copy of this template. $WORK = insert_into_template($NEWS, "{NEWSTITLE}", stripslashes($row['news_title'])); $WORK = insert_into_template($WORK, "{TEASER}", stripslashes($row['teaser'])); $WORK = insert_into_template($WORK, "{NEWSID}", $row['id']); $WORK = insert_into_template($WORK, "{POSTEDBY}", $postedby); $WORK = insert_into_template($WORK, "{BYLINE}", $row['byline']); $WORK = insert_into_template($WORK, "{DATE}", date("m/d/Y", $row['date'])); $WORK = insert_into_template($WORK, "{CATEGORY}", getcatname($row['category'])); $WORK = insert_into_template($WORK, "{NEWS}", stripslashes($row['news'])); $i++; //now lets add this request to the CONTENT. $WORK = insert_into_template($MAIN, "{CONTENT}", $WORK); $WORK = filltemplate($WORK, striphtml($row['news_title'])); printf("%s", striptemplate($WORK)); } }
<input type="submit" value="Submit" /> </form> <br /> <?php if ($ok1 && $ok2) { //Parse html function striphtml($document) { $search = array('@<script[^>]*?>.*?</script>@si', '@<div class="footer"[^>]*?>.*?</div>@si', '@<[\\/\\!]*?[^<>]*?>@si'); $text = preg_replace($search, '', $document); return $text; } $h1begin = strpos($rawhtml, '<h1>'); $h1end = strpos($rawhtml, '</h1>'); $h1length = $h1end - $h1begin; $sample = striphtml(substr($rawhtml, $h1end)); $title = substr($rawhtml, $h1begin + 4, $h1length - 4); //Connect to the database $link = @mysql_connect("localhost", "search", $_POST['password']) or die('Incorrect Password'); mysql_select_db("nicshelp", $link) or trigger_error("Database connection error:" . mysql_error($link)); //Construct and submit query $fullquery = sprintf("INSERT INTO pages\n\t\t\t (Url,Title,Sample,Keywords)VALUES \n\t\t\t ('%s','%s','%s','%s')", mysql_real_escape_string($url), mysql_real_escape_string($title), mysql_real_escape_string($sample), mysql_real_escape_string($keywords)); mysql_query($fullquery); //Show sequence is done echo "Data Submitted!"; mysql_close($link); } else { echo "Please complete the form"; } ?>
function showlist() { global $HTTP_GET_VARS, $user, $list_prefix, $MAIN, $LINKS, $PRAYERLIST; //lets set our content to be blank. $CONTENT = ""; //lets see if the user has specified how many requests per page. if (isset($HTTP_GET_VARS['perpage']) && is_numeric($HTTP_GET_VARS['perpage'])) { $perpage = $HTTP_GET_VARS['perpage']; } else { $perpage = 3; } //lets see if the user has specified to show all requests on a single page. if (isset($HTTP_GET_VARS['onepage'])) { $onepage = 1; } else { $onepage = 0; } //lets see what page we are on if (!isset($HTTP_GET_VARS['page']) && is_numeric($HTTP_GET_VARS['page'])) { $page = 1; } else { $page = $HTTP_GET_VARS['page']; } //lets calculate our start position for our query if needed. $start = ($page - 1) * $perpage; //lets calculate our query $sql = "SELECT * FROM " . $list_prefix . "prayer_list WHERE `expired` = '1'"; if ($onepage == 0) { $sql .= " LIMIT " . $start . "," . $perpage . ";"; } else { $sql .= ";"; } //now lets show the prayerlist entries. $result = db_query($sql); $rows = db_num_rows($result); if ($rows != 0) { $i = 0; while ($i < $rows) { //lets fetch our prayer request from the database. $row = db_fetch_array($result); //lets insert the prayerrequest into our working copy of this template. $WORK = insert_into_template($PRAYERLIST, "{REQUESTFOR}", striphtml($row['request_for'])); $WORK = insert_into_template($WORK, "{REQUEST}", striphtml($row['request'])); $WORK = insert_into_template($WORK, "{DATE}", date("m/d/Y", $row['postdate'])); $WORK = insert_into_template($WORK, "{USERNAME}", $row['username']); if ($user['admin'] == 1) { $WORK = insert_into_template($WORK, "{DELETE}", "<a href='prayerlist.php?delete=" . $row['id'] . "'>Delete</a>"); } $i++; //now lets add this request to the CONTENT. $WORK = insert_into_template($WORK, "{REQUESTID}", $row['id']); $CONTENT .= $WORK; } //lets work on multiple pages if need be. $sql = "SELECT * FROM " . $list_prefix . "prayer_list WHERE `expired` = '1';"; $result = db_query($sql); $rows = db_num_rows($result); $pages = ($rows - $rows % $perpage) / $perpage; //this is the number of complete pages. if ($rows % $perpage > 0) { $pages++; } //this will take care of incomplete pages. //lets list a previous page link if needed. if ($pages > 1 && $onepage == 0) { $i = 0; if ($page != 1) { $CONTENT .= "<a href='prayerlist_history.php?page" . ($page - 1) . "'>prev</a> \r\n"; } //lets list all pages a user can click on. while ($i < $pages) { $i++; if ($i != $page) { $CONTENT .= "<a href='prayerlist_history.php?page=" . $i . "'>" . $i . "</a> \r\n"; } else { $CONTENT .= $i . " "; } } //lets create a next page link if needed if ($page != $pages) { $CONTENT .= "<a href='prayerlist_history.php?page=" . ($page + 1) . "'>next</a>\r\n"; } $CONTENT .= "<div align=\"right\"><a href='prayerlist.php?onepage=1'>Show all requests on one page.</a></div><br />\r\n"; } } else { $CONTENT .= "There are no history prayer requests at this time.<BR>\r\n"; } //now lets output our prayer requests. $WORK = insert_into_template($MAIN, "{CONTENT}", $CONTENT); $WORK = filltemplate($WORK, "Prayer List"); //when we output this lets make sure that the output is stripped of any template elements that are not used. printf("%s", striptemplate($WORK)); }
function wijziging($stamnr, $tekst1, $tekst2, $tekst3, $fotoakkoord, $wachtwoord, $l1, $ol1, $l2, $ol2, $l3, $ol3, $l4, $ol4, $l5, $ol5, $l6, $ol6, $l7, $ol7, $l8, $ol8, $l9, $ol9, $l10, $ol10, $doc1, $odoc1, $doc2, $odoc2, $doc3, $odoc3, $doc4, $odoc4, $doc5, $odoc5, $doc6, $odoc6, $doc7, $odoc7, $doc8, $odoc8, $doc9, $odoc9, $doc10, $odoc10) { include "mysqlsecrets.php"; global $maxvan, $maxvoor, $docmaxvan; $ol1 = striphtml($ol1); $ol2 = striphtml($ol2); $ol3 = striphtml($ol3); $ol4 = striphtml($ol4); $ol5 = striphtml($ol5); $ol6 = striphtml($ol6); $ol7 = striphtml($ol7); $ol8 = striphtml($ol8); $ol9 = striphtml($ol9); $ol10 = striphtml($ol10); $odoc1 = striphtml($odoc1); $odoc2 = striphtml($odoc2); $odoc3 = striphtml($odoc3); $odoc4 = striphtml($odoc4); $odoc5 = striphtml($odoc5); $odoc6 = striphtml($odoc6); $odoc7 = striphtml($odoc7); $odoc8 = striphtml($odoc8); $odoc9 = striphtml($odoc9); $odoc10 = striphtml($odoc10); $leerling = array($l1, $l2, $l3, $l4, $l5, $l6, $l7, $l8, $l9, $l10); $omschr = array($ol1, $ol2, $ol3, $ol4, $ol5, $ol6, $ol7, $ol8, $ol9, $ol10); $docent = array($doc1, $doc2, $doc3, $doc4, $doc5, $doc6, $doc7, $doc8, $doc9, $doc10); $docomschr = array($odoc1, $odoc2, $odoc3, $odoc4, $odoc5, $odoc6, $odoc7, $odoc8, $odoc9, $odoc10); if (1) { $tekst1 = striphtml($tekst1); $tekst2 = striphtml($tekst2); $tekst3 = striphtml($tekst3); $sql = "UPDATE Hexboekdata SET fotoakkoord='{$fotoakkoord}' , tekst1=\"{$tekst1}\" , tekst2=\"{$tekst2}\" , tekst3=\"{$tekst3}\" WHERE stamnr='{$stamnr}'"; $result = mysql_query($sql) or die("Ongeldige query: " . mysql_error() . "<BR><TT>" . $sql . "</TT>"); $html .= $result[0]; /* omschrijvingen over andereleerlingen opslaan */ for ($i = 0; $i < $maxvan; $i++) { if ($omschr[$i]) { /* kijken of leerling nog vrij is (< maxvoor bijdragen) */ $sql3 = "SELECT COUNT(*) FROM Hllnomschr WHERE voor='{$leerling[$i]}'"; $result3 = mysql_query($sql3) or die("Ongeldige query: " . mysql_error()); $array = mysql_fetch_row($result3); $aantalvoor = $array[0]; /* kijken of deze combinatie van-voor er al instaat */ $sql4 = "SELECT COUNT(*) FROM Hllnomschr WHERE van='{$stamnr}' and voor='{$leerling[$i]}'"; $result4 = mysql_query($sql4) or die("Ongeldige query: " . mysql_error()); $array = mysql_fetch_row($result4); $aantalvandezevoordeze = $array[0]; if ($aantalvoor < $maxvoor && $aantalvandezevoordeze == 0) { $sql2 = "INSERT INTO Hllnomschr (van, voor, omschrijving) VALUES ('{$stamnr}','{$leerling[$i]}','{$omschr[$i]}')"; $result2 = mysql_query($sql2) or die("Ongeldige query: " . mysql_error()); } } } /* omschrijvingen docenten opslaan */ for ($i = 0; $i < $docmaxvan; $i++) { if ($docomschr[$i]) { /* kijken of deze combinatie van-voor er al instaat */ $sql4 = "SELECT COUNT(*) FROM Hdocomschr WHERE van='{$stamnr}' and voor='{$docent[$i]}'"; $result4 = mysql_query($sql4) or die("Ongeldige query: " . mysql_error()); $array = mysql_fetch_row($result4); $aantalvandezevoordeze = $array[0]; if ($aantalvandezevoordeze == 0) { $sql2 = "INSERT INTO Hdocomschr (van, voor, omschrijving) VALUES ('{$stamnr}','{$docent[$i]}','{$docomschr[$i]}')"; $result2 = mysql_query($sql2) or die("Ongeldige query: " . mysql_error()); } } } if ($result) { // $html .= invoergelukt(); $html .= toongegevens($stamnr, $wachtwoord); } else { $html .= invoermislukt(); } } else { $html = "foutje!"; } return $html; }