From: Javier B. <jb...@us...> - 2004-11-17 11:43:41
|
Update of /cvsroot/openbash-org/openbash-org/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22136/modules Modified Files: Quote.php View.php Added Files: Validate.php Log Message: mejorada la validacion, ahora se usa la clase Validate --- NEW FILE: Validate.php --- <?php class validate { function validate() { $view = new view(); if(!isset($_SESSION['logged'])) { if (!isset($_POST['form']) || $_POST['form'] != 1) { $view->ask_login(); } else { if(!$this->check_login($_POST['login'], $_POST['passwd'])) { $view->ask_login();} } } else { if(isset($_POST['form']) && !$this->check_login($_POST['login'], $_POST['passwd'])) { $view->ask_login();} if(!$this->check_session()) $view->ask_login(); } } function check_login($nick, $pass) { include ('config.php'); $nick = variable_clean($nick); $pass = variable_clean($pass); $con = "SELECT * FROM users WHERE login LIKE \"$nick\" AND passwd LIKE \"$pass\" LIMIT 1"; $res = $bd->_Execute($con); $res->Close(); if (!$res) return (0); if (!strcmp($nick, $res->fields['login']) && !strcmp($pass, $res->fields['passwd'])) { $_SESSION['logged'] = 1; return (1); } else { $_SESSION['logged'] = 0; return (0); } } function check_session() { if($_SESSION['logged'] == 1) return 1; else return 0; } } ?> Index: View.php =================================================================== RCS file: /cvsroot/openbash-org/openbash-org/modules/View.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** View.php 17 Nov 2004 10:28:40 -0000 1.4 --- View.php 17 Nov 2004 11:43:32 -0000 1.5 *************** *** 8,11 **** --- 8,15 ---- class view { + /* + * functions related to quotes + */ + function ask_quote() { *************** *** 71,74 **** <?php } ! } --- 75,105 ---- <?php } ! ! /* ! * functions related to admin ! */ ! ! function ask_login() ! { ! global $login_language; ! ?> ! <h5 align="center"><?php echo $login_language['title'];?></h5> ! <hr> ! <p><?=$login_language['msg'];?></p> ! <form action="?page=admin" method="post"> ! <input type="hidden" name="form" value="1"> ! <table border="0" width="50%"> ! <tr class="textoficha"> ! <td><?php echo $login_language['login'];?></td> ! <td><input type="text" name="login" class="textfield" maxlength="20"></td> ! <td><?php echo $login_language['passwd'];?></td> ! <td><input type="password" name="passwd" class="textfield" maxlength="20"><td> ! <td><input type="submit" name="submit" class="submit" value="<?php echo $login_language['submit'];?>"></td> ! </tr> ! </table> ! </form> ! <?php ! exit(); ! } ! } Index: Quote.php =================================================================== RCS file: /cvsroot/openbash-org/openbash-org/modules/Quote.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Quote.php 17 Nov 2004 10:28:40 -0000 1.9 --- Quote.php 17 Nov 2004 11:43:32 -0000 1.10 *************** *** 92,96 **** * Please visit the admin page to validate: http://$_SERVER[SERVER_NAME]/$_SERVER[SCRIPT_NAME]?page=admin"; ! $from = "From: webmaster@$_SERVER[SERVER_NAME]\nReply-To: $email\nX-Mailer: VLog MSG Alert System"; mail($rcpt, $subject, $body, $from); } --- 92,96 ---- * Please visit the admin page to validate: http://$_SERVER[SERVER_NAME]/$_SERVER[SCRIPT_NAME]?page=admin"; ! $from = "From: webmaster@$_SERVER[SERVER_NAME]\nReply-To: $author\nX-Mailer: OpenBash MSG Alert System"; mail($rcpt, $subject, $body, $from); } |