Exemplo n.º 1
0
 public static function check($password)
 {
     if (isset($_SESSION["_simple_password_md5"]) && $_SESSION["_simple_password_md5"] == md5($password)) {
         return true;
     }
     if (isset($_POST["_simple_password"]) && md5($_POST["_simple_password"]) == md5($password)) {
         $_SESSION["_simple_password_md5"] = md5($_POST["_simple_password"]);
         return true;
     }
     BF::load_module("BF_output_template");
     $tpl = new BF_output_template("simple_password");
     $tpl->disp();
     die;
 }
Exemplo n.º 2
0
<?php

/*-----------------------------------------------------*\

                  YOUR WEBSITE HERE

\*-----------------------------------------------------*/
// This website uses phpBF
require_once './core/lib/phpbf/framework.php';
BF::init();
$page = BF::gg(0);
if (!$page || $page == "index.php") {
    BF::gr(BF::gc('page_default'))->redirect();
    // try loading a template
} elseif (BF::gr("/tpl/" . $page . '.tpl')->exists()) {
    BF::load_module("BF_output_template");
    $tpl = new BF_output_template($page);
    $tpl->disp();
} else {
    throw new BF_not_found();
}
Exemplo n.º 3
0
    }
    BF::load_module("BF_output_template");
    $tpl = new BF_output_template("view_car");
    $tpl->assign('car', $car);
    $tpl->disp();
} elseif ($action == "save") {
    BF::load_module("BF_form");
    $form = new BF_form('edit_car');
    $car = new car($id);
    if (!$car->exists()) {
        throw new BF_not_found();
    }
    // check
    if (!$form->check()) {
        $form->show_error();
    }
    // process
    $car->name = $form->gval("name");
    $car->price = $form->gval("price");
    $car->save();
    // redirect
    BF::gr("example")->redirect();
} else {
    // list all cars from db
    $list = BF::glist('car');
    // display
    BF::load_module("BF_output_template");
    $tpl = new BF_output_template("list_cars");
    $tpl->assign('list', $list);
    $tpl->disp();
}
Exemplo n.º 4
0
 /**
  * Reset user password and send by email
  */
 public function send_password()
 {
     /**
      * Example 
      */
     BF::load_module('BF_mail');
     BF::load_module("BF_output_template");
     $tpl = new BF_output_template('mail_user_password');
     $user =& $this;
     $tpl->assign('user', $user);
     $tpl->assign('password', $this->reset_password());
     $mail = new BF_mail();
     $mail->From = BF::gu()->_email;
     $mail->FromName = BF::gu()->_username;
     $mail->AddReplyTo($mail->From, $mail->FromName);
     $mail->AddAddress($this->_email);
     $mail->Body = $tpl->disp(false);
     $mail->Subject = $tpl->get_template_vars('subject');
     if ($mail->send()) {
         return true;
     } else {
         throw new exception('Failed sending password mail');
     }
 }