Exemple #1
0
 public function reset()
 {
     if ($this->owner->logged_in()) {
         url::redirect('/admin/testimonials/display');
     }
     $login_shell = new View('admin/login_shell');
     $login_shell->content = new View('admin/reset');
     if (empty($_POST)) {
         die($login_shell);
     }
     $post = new Validation($_POST);
     $post->pre_filter('trim');
     $post->add_rules('email', 'required', 'valid::email');
     # if Post is good, atttempt to log owner in.
     if ($post->validate()) {
         $owner = ORM::factory('owner')->find($_POST['email']);
         if (!$owner->loaded) {
             die('email does not have an account');
         }
         $pw = text::random('alnum', 8);
         $owner->password = $pw;
         $owner->save();
         $replyto = 'unknown';
         $body = "Your auto-generated password is: {$pw} \r\n" . "Change your password to something more appropriate by going here:\r\n" . "http://pluspanda.com/admin/account?old={$pw} \r\n\n" . "Thank you! - Jade from pluspanda";
         # to do FIX THE HEADERS.
         $subject = 'Your Pluspanda Password Has Been Reset =)';
         $headers = "From: noreply@pluspanda.com \r\n" . "Reply-To: Jade \r\n" . 'X-Mailer: PHP/' . phpversion();
         mail($_POST['email'], $subject, $body, $headers);
         die('Please check your email for your new password!');
     }
     # error
     $login_shell->content->alert = alerts::display(array('error' => 'Invalid Email or Password.'));
     $login_shell->content->values = $_POST;
     die($login_shell);
 }
/*jpgraph库放在了当前目录下
 *  Note:
 *  	general_display.php equals to a img file. 
 * 		So there should be no space between <?php ?>
 * 		由于<img>标签来使用图片时,该文件中引用的文件应该相对
 * 		此文件的目录
 * 
 * 
 */
require_once '../../includes/connection_settings.php';
require_once '../../classes/adodb/adodb.inc.php';
require_once '../../classes/alerts_class.php';
//Create object
$DB = NewADOConnection($_type_of_db_server);
$_res_db = @$DB->Connect($_host, $_user, $_password, $_db_name);
$ALERTS = new alerts(&$DB);
$ydata = array();
$ydata[0] = $ALERTS->TCPPktCnt();
$ydata[1] = $ALERTS->UDPPktCnt();
$ydata[2] = $ALERTS->ICMPPktCnt();
$ydata[3] = $ALERTS->PortscanPktCnt();
$xlabel = array("TCP", "UDP", "ICMP", "Portscan Traffic");
/*主页的总体图表信息*/
/*
 * Lib
 */
require_once 'jpgraph/src/jpgraph.php';
require_once 'jpgraph/src/jpgraph_canvas.php';
require_once 'jpgraph/src/jpgraph_error.php';
require_once 'jpgraph/src/jpgraph_log.php';
require_once 'jpgraph/src/jpgraph_pie.php';
 /**
  * Deletes a alert
  * 
  * If no alert ID is passed or if it does not match a valid product ID in the database, an error
  * message is generated.  Otherwise the alert is deleted and a success message is generated.  In either
  * case the user is redirected to the alerts index.
  */
 public function actionDelete()
 {
     testProject::setAlert('There was a problem with your request.  Please try again.', 'error');
     if (isset($_GET['value'])) {
         $model = alerts::model()->getByPK($_GET['value']);
         $name = $model->name;
         if ($model->delete()) {
             testProject::setAlert('The item ' . $name . ' was deleted.', 'info');
         }
     }
     $this->redirect('alerts/index');
 }
            $_SESSION['status'][] = $round['pause_message'];
            redirect('login.php', '');
        }
    }
    function updater()
    {
        if (!isset($_SESSION['player_id']) || !empty($_SESSION['admin'])) {
            return;
        }
        $player =& $this->data->player($_SESSION['player_id']);
        $kingdom =& $this->data->kingdom($_SESSION['kingdom_id']);
        $player['lastactive'] = microfloat();
        $kingdom['last_active'] = microfloat();
    }
    function status()
    {
        if (!empty($_SESSION['status'])) {
            $this->smarty->append('status', $_SESSION['status']);
            unset($_SESSION['status']);
        }
    }
}
$init = new ImperialKingdoms_Initialization();
if (!empty($_SESSION['player_id'])) {
    require_once dirname(__FILE__) . '/updater_round.php';
    $updater =& new Updater_Round();
    $data->updater =& $updater;
    require_once dirname(__FILE__) . '/alerts.php';
    $alerts = new alerts();
    $alerts->get_alerts();
}