/** * Determine if there is data waiting to be processed from a form * * Used on most forms in Moodle to check for data * Returns the data as an object, if it's found. * This object can be used in foreach loops without * casting because it's cast to (array) automatically * * Checks that submitted POST data exists, and also * checks the referer against the given url (it uses * the current page if none was specified. * * @uses $CFG * @param string $url the url to compare to referer for secure forms * @return boolean */ function data_submitted($url = '') { global $CFG; if (empty($_POST)) { return false; } else { if (match_referer($url)) { return (object) $_POST; } else { if ($CFG->debug > 10) { notice('The form did not come from this page! (referer = ' . get_referer() . ')'); } return false; } } }
* $Source: /home/xubuntu/berlios_backup/github/tmp-cvs/otmp/Repository/Release1/user/changepassword.php,v $ * $Revision: 1.3 $ * $Id: changepassword.php,v 1.3 2002/01/11 13:14:45 alexgn Exp $ * * To Do: * - * - */ /****************************************************************************** * MAIN *****************************************************************************/ include "../application.php"; /* $session['wantsurl']=me(); // Rücksprung (ggf) */ checklogin(); /* form has been submitted, changing user data */ if (match_referer() && isset($HTTP_POST_VARS)) { $frm = $HTTP_POST_VARS; $errormsg = validate_form($frm, $errors, $session); if (empty($errormsg)) { $status = change_userPassword($session['username'], $frm); /* Obsolete Code */ /* $DOC_TITLE = "Password Change Successfull"; */ /* include("$CFG->templatedir/header.php"); */ /* include("templates/change_password_success.inc"); */ /* include("$CFG->templatedir/footer.php"); */ $session['notice'] = "Passwort erfolgreich geändert!"; $goto = empty($session["wantsurl"]) ? "{$CFG->wwwroot}/user/user_data.php" : $session["wantsurl"]; header("Location: {$goto}"); die; } else { $session['notice'] = $errormsg;
* $Revision: 1.3 $ * $Id: search.php,v 1.3 2001/12/18 23:29:22 hifix Exp $ * * To Do: * - * - */ /****************************************************************************** * MAIN *****************************************************************************/ include "../application.php"; if (!isset($noerror)) { $noerror = 0; } /* form has been submitted, changing user data */ if (match_referer() && isset($HTTP_POST_VARS) && $noerror != 1) { $frm = $HTTP_POST_VARS; $errormsg = validate_form($frm, $errors); if (empty($errormsg)) { /* Should be search */ $status = search($frm['keywordtitle'], $frm['search_in'], $frm['lang']); $DOC_TITLE = "Your Search Results"; include "{$CFG->templatedir}/header.php"; include "templates/search_result.inc"; include "{$CFG->templatedir}/footer.php"; die; } else { $session['notice'] = $errormsg; } } $DOC_TITLE = "Suche nach einem Dokument.";