Beispiel #1
0
 function logout()
 {
     if (F3::get('SESSION.onlineUser')) {
         F3::clear('SESSION.onlineUser');
         F3::reroute('/');
     }
 }
 public function get()
 {
     if ($this->flag['search']) {
         if (isset($_GET['q']) && $_GET['q'] != '') {
             // Fetch Search Query
             $query = F3::scrub($_GET['q']);
             $search = new SearchModel();
             // Fetch Search Results
             if ($this->results = $search->items($query)) {
                 // Reroute if one match
                 if (count($this->results) == 1 && $this->redirect) {
                     F3::reroute('/loot/' . $this->results[0]['urlname']);
                 }
                 $this->title = "Search: \"" . $query . "\" - Diablo 2 Database";
                 $this->heading = "Search: \"" . $query . "\"";
                 F3::set('NOTIFY.success', "Rejoice! " . count($this->results) . " matches found!");
                 $this->render('search.php');
             } else {
                 $this->heading = "Search: \"" . $query . "\"";
                 F3::set('NOTIFY.warning', "Nothing found in the database. Try the <a href=/loot/>Loot Directory</a>.");
                 $this->render('blank.php');
             }
         } else {
             F3::reroute('/');
         }
     } else {
         F3::set('NOTIFY.warning', "Search is temporarily disabled. Please try again later.");
         $this->render('blank.php');
     }
 }
Beispiel #3
0
 function logout()
 {
     if (!F3::get('SESSION.asid')) {
         F3:
         reroute('/admin');
     }
     if (F3::get('SESSION.asid')) {
         $this->clear('SESSION.asid');
         $this->clear('SESSION.admin');
         F3::reroute('/admin');
     }
 }
Beispiel #4
0
 function transfer()
 {
     if (!F3::get('SESSION.onlineUser')) {
         F3::reroute("/");
     }
     $dateNep = new Form_elements();
     //transfer information of the vehicle
     $id = date('siGjnty') . rand(1, 100);
     $ip_address = $_SERVER['REMOTE_ADDR'];
     $wheeler = F3::get("POST.wheeler");
     $zone_id = F3::get("POST.zone_id");
     $lot_number = F3::get("POST.lot_number");
     $vehicle_symbol_type = $wheeler == 21 ? F3::get("POST.vehicle_symbol_type_two") : F3::get("POST.vehicle_symbol_type_four");
     $number = F3::get("POST.number");
     $vehicleid = $this->vehicleid($wheeler, $zone_id, $lot_number, $vehicle_symbol_type, $number);
     $reason = F3::get("POST.reason");
     $dates = F3::get("POST.date");
     $date = $dateNep->dateConvertEn($dates);
     $remarks = F3::get("POST.remarks");
     $witness_name = F3::get("POST.witness_name");
     $witness_address = F3::get("POST.witness_address");
     $citizenship_no = F3::get("POST.citizenship_no");
     //owner information
     $owner_type = F3::get("POST.owner_type");
     $first_name = F3::get("POST.first_name");
     $last_name = F3::get("POST.last_name");
     $father_name = F3::get("POST.father_name");
     $grandfather_name = F3::get("POST.grandfather_name");
     $dob = F3::get("POST.dob");
     $reg_num = F3::get("POST.reg_num");
     $email = F3::get("POST.email");
     $mobile = F3::get("POST.mobileno");
     $p_zone_id = F3::get("POST.p_zone_id");
     $p_district_id = F3::get("POST.p_district_id");
     $p_metropolitan = F3::get("POST.p_metropolitan");
     $p_ward_no = F3::get("POST.p_ward_no");
     $p_address = F3::get("POST.p_address");
     $p_house_no = F3::get("POST.p_house_no");
     $p_phone = F3::get("POST.p_phone");
     $temp_zone_id = F3::get("POST.temp_zone_id");
     $temp_district_id = F3::get("POST.temp_district_id");
     $temp_metropolitan = F3::get("POST.temp_metropolitan");
     $temp_ward_no = F3::get("POST.temp_ward_no");
     $temp_address = F3::get("POST.temp_address");
     $temp_house_no = F3::get("POST.temp_house_no");
     $temp_phone = F3::get("POST.temp_phone");
     $nabalik_guardian_name = F3::get("POST.nabalik_guardian_name");
     $nabalik_relation = F3::get("POST.nabalik_relation");
     $nabalik_identity_no = F3::get("POST.nabalik_identity_no");
     $nabalik_district = F3::get("POST.nabalik_district");
     $nabalik_year = F3::get("POST.nabalik_year");
     $nabalik_address = F3::get("POST.nabalik_address");
     $bank_name = F3::get("POST.bank_name");
     $creditor_name = F3::get("POST.creditor_name");
     $creditor_district = F3::get("POST.creditor_district");
     $creditor_year = F3::get("POST.creditor_year");
     $creditor_address = F3::get("POST.creditor_address");
     $per_nagarikta = F3::get("POST.per_nagarikta");
     $per_identificationno = F3::get("POST.per_identificationno");
     $per_district = F3::get("POST.per_district");
     $per_year = F3::get("POST.per_year");
     $indian_identificationno = F3::get("POST.indian_identificationno");
     $other_identificationno = F3::get("POST.other_identificationno");
     $captcha = F3::get("POST.code");
     if ($captcha == F3::get("SESSION.captcha")) {
         $this->pictureFolder($id);
         $sqls[] = "INSERT INTO vehicle (id,wheeler,vehicleid,zone_id,lot_number,vehicle_symbol_type,number,ip_address,form_type) VALUES('{$id}','{$wheeler}','{$vehicleid}','{$zone_id}',' {$lot_number}','{$vehicle_symbol_type} ','{$number}','{$ip_address}','namsari')";
         $sqls[] = "INSERT INTO owner (vehicleid,owner_type,first_name,last_name, father_name,grandfather_name,\n        dob,reg_num,email,mobileno,p_zone_id,p_district_id, p_metropolitan,p_ward_no,\n        p_address, p_house_no, p_phone, temp_zone_id,temp_district_id, temp_metropolitan,\n        temp_ward_no, temp_address,temp_house_no, temp_phone, nabalik_guardian_name,nabalik_relation,\n        nabalik_identity_no, nabalik_district, nabalik_year, nabalik_address, bank_name, creditor_name,\n        creditor_district, creditor_year, creditor_address,per_nagarikta,per_identificationno,per_district,per_year,indian_identificationno,other_identificationno)\n        VALUES( '{$id}','{$owner_type}','{$first_name}','{$last_name}','{$father_name}','{$grandfather_name}',\n       '{$dob}','{$reg_num}','{$email}','{$mobile}','{$p_zone_id}','{$p_district_id}','{$p_metropolitan}','{$p_ward_no}','{$p_address}',\n        '{$p_house_no}', '{$p_phone}','{$temp_zone_id}','{$temp_district_id}','{$temp_metropolitan}','{$temp_ward_no}',\n        '{$temp_address}',' {$temp_house_no}',' {$temp_phone}', '{$nabalik_guardian_name}',' {$nabalik_relation}',\n        '{$nabalik_identity_no}','{$nabalik_district}','{$nabalik_year}','{$nabalik_address}','{$bank_name}',\n        '{$creditor_name}','{$creditor_district}','{$creditor_year}','{$creditor_address}','{$per_nagarikta}',\n        '{$per_identificationno}','{$per_district}','{$per_year}','{$indian_identificationno}' ,'{$other_identificationno}')";
         $sqls[] = "INSERT INTO namsari (vehicle_id,reason,date,remarks,witness_name,witness_address,citizenship_no) VALUES('{$id}','{$reason}','{$date}','{$remarks}','{$witness_name}','{$witness_address}','{$citizenship_no}')";
         DB::sql($sqls);
         F3::reroute("/feedbackt/{$id}");
     } else {
         F3::set('error', 'The captcha you have entered is wrong');
         $this->transfer_ownership();
     }
 }
Beispiel #5
0
function _force_logout()
{
    session_destroy();
    F3::reroute('/');
}
Beispiel #6
0
<?php

$main = (require __DIR__ . '/lib/base.php');
//F3::set('CACHE',TRUE);
$main->set('DEBUG', 3);
$main->set('UI', 'ui/');
$main->set('FONTS', 'fonts/');
$main->set('AUTOLOAD', 'controller/');
$main->set('DB', new DB('mysql:host=localhost;dbname=vrs', 'root', ''));
$main->set('db_param', array('live_host' => "mysql:host=localhost;dbname=db_vrs", 'live_user' => "root", 'live_password' => "3!!5(("));
$main->set('local_param', array('local_host' => "mysql:host=localhost;dbname=db_vrs_public", 'local_user' => "root", 'local_password' => "3!!5(("));
$main->set('ONERROR', function () {
    F3::reroute('/user/home');
});
//$main->set('dateParams',array(
//  "DSN" => "mysql:host=localhost;dbname=vrs",
//  "DB_USER" => "root",
// "DB_PWD" => ""
//));
//all user requirements
$main->route('GET /', 'User_login->index;');
$main->route('POST /', 'User_login->login;');
$main->route('GET /user/home', 'User_login->user_home');
$main->route('GET /user/home/@sid', 'User_login->user_home');
$main->route('GET /user/logout', 'User_login->logout');
$main->route('GET /user/register', 'User_login->register');
$main->route('POST /user/register', 'User_login->register_approve');
$main->route('POST /saveRegister', 'SavedForm->registration_save');
$main->route('POST /saveNamsari', 'SavedForm->namsari_save');
//{{@BASE}}/saveRegister
$main->route('GET /register', 'User->new_registration');
Beispiel #7
0
<!--

Url:   http://192.168.56.101/omu
Çıktı: OMU nun sayfasi

-->

<?php 
require_once 'F3/F3.php';
F3::route('GET /omu', function () {
    F3::reroute('http://www.omu.edu.tr');
});
F3::run();
Beispiel #8
0
 function deleteForm()
 {
     if (!F3::get('SESSION.onlineUser')) {
         F3::reroute("/");
     }
     $id = F3::get("PARAMS.id");
     $vehicle = new Axon('vehicle');
     if ($vehicle->found(array('id =:id', array(':id' => $id)))) {
         $vehicle->load(array('id =:id', array(':id' => $id)));
         $vehicle->erase();
         F3::reroute('/');
     } else {
         F3::reroute('/');
     }
 }
Beispiel #9
0
F3::route('GET /', function () {
    $view = new View();
    echo $view->render('gallery.htm');
});
F3::route('GET /admin', function () {
    F3::set('html_title', 'My Blog Administration');
    $db = new \DB\Jig('data/');
    $user = new \DB\Jig\Mapper($db, 'users.json');
    $auth = new \Auth($user, array('id' => 'username', 'pw' => 'password'));
    $auth->basic();
    if ($auth) {
        //set the session so user stays logged in
        F3::set('SESSION.user', $auth->name);
        F3::reroute('/admin/upload');
    } else {
        F3::reroute('/admin');
    }
    $view = new View();
    echo $view->render('layout.htm');
});
F3::route('GET /admin/list', function () {
    (new app\controllers\GalleryController())->viewAll();
});
F3::route('GET /admin/upload', function () {
    F3::set('html_title', 'My Blog Create');
    F3::set('content', 'admin_edit.html');
    if (!F3::get('SESSION.user')) {
        F3::set('content', 'security.html');
    }
    $view = new View();
    echo $view->render('upload.html');
Beispiel #10
0
 function viewData()
 {
     if (!F3::get('SESSION.sid')) {
         F3::reroute('/home');
     }
     $id = F3::get('PARAMS.pid');
     $poll = DB::sql(" SELECT  tbl_poll.user_id,tbl_option.name,tbl_poll.expiry_date,tbl_poll.created_date,tbl_poll.published_date,tbl_poll.keyword,tbl_poll.id,tbl_poll.user_id,tbl_user.fullname,tbl_user.image,tbl_poll.question,tbl_option.value FROM tbl_user LEFT join tbl_poll  ON tbl_user.id=tbl_poll.user_id left join tbl_option on tbl_poll.id=tbl_option.poll_id where tbl_poll.id={$id} ");
     $i = 0;
     $data = DB::SQL("select tbl_poll.*, options.* from tbl_poll,(select name, value, COALESCE(votes, 0) as votes from tbl_option left outer join (SELECT option_name, count(option_name) as votes, poll_id from tbl_vote  where poll_id={$id} group by option_name) as vote on tbl_option.name = vote.option_name where tbl_option.poll_id ={$id}) as options where tbl_poll.id={$id}");
     $vote = DB::SQL("select count(option_name) as vote from tbl_vote  where poll_id={$id}");
     //  var_dump($data);die;
     $dt = array();
     $totalValue = $vote[0]["vote"];
     if ($totalValue != 0) {
         // loop over poll options
         foreach ($data as $datas) {
             $cent = $datas["votes"] / $totalValue * 100;
             array_push($dt, array($datas["name"], stripslashes($datas["value"]), $datas["votes"], $cent));
         }
     } else {
         foreach ($data as $datas) {
             array_push($dt, array($datas["name"], stripslashes($datas["value"]), $datas["votes"]));
         }
     }
     // var_dump($dt);
     $question = $data[0]["question"];
     if (!strpos($poll[0]["question"], '?')) {
         $poll[0]["question"] .= "?";
     }
     $date = DATE('Y-m-d');
     F3::set('date', $date);
     F3::set('user_id', $poll[0]["user_id"]);
     F3::set('id', $poll[0]["id"]);
     F3::set('published_date', $poll[0]["published_date"]);
     F3::set('expiry_date', $poll[0]["expiry_date"]);
     F3::set('created_date', $poll[0]["created_date"]);
     F3::set('keyword', $poll[0]["keyword"]);
     $question = ucfirst($poll[0]["question"]);
     F3::set('user_id', $poll[0]["user_id"]);
     F3::set('fullname', $poll[0]["fullname"]);
     F3::set('image', $poll[0]["image"]);
     F3::set('question', $question);
     F3::set('options', $dt);
     F3::set('title', 'Poll Detail');
 }
Beispiel #11
0
 function dismissNamsari()
 {
     if (!F3::get('SESSION.asid')) {
         F3::reroute("/admin");
     }
     $id = F3::get("PARAMS.id");
     $vrs = new Axon("vehicle");
     $vrs->load(array("id=:id", array(":id" => $id)));
     $zone = Admin::getZone($vrs->zone_id);
     $symbol = Admin::getSymbolType($vrs->vehicle_symbol_type);
     $vehicleNo = $zone . $vrs->lot_number . $symbol . $vrs->number;
     AdminLog::add($vehicleNo, $vrs->form_type, "dismissed");
     $vrs->erase();
     F3::reroute("/admin/ownershipTransfer/s");
 }
Beispiel #12
0
// cache seminggu :3
/*
	ADMIN PANEL SETTINGS~ :* :*
*/
\Middleware::instance()->before('GET|POST|PUT|DELETE /admin*', function (\Base $f3, $param) {
    //cek apa dia login apa kagak, dan layak apa kagak. lel
    $access = \Access::instance();
    $access->policy('deny');
    $access->allow('/admin/*', 'admin');
    $access->allow('GET|POST /admin/Auth*');
    $access->allow('GET|POST /admin/auth*');
    if (!$f3->exists('SESSION.user_type') && !$f3->exists('COOKIE.user')) {
        $f3->set('SESSION.user_type', 'guest');
    }
    $access->authorize($f3->get('SESSION.user_type'), function ($route, $subject) {
        \F3::reroute('@admin_pack(@pack=Auth)');
    });
    /* 
    	Default settings for template #1
    */
    if ($f3->exists("COOKIE.user") or $f3->exists("SESSION.user")) {
        $userz = \User::createUser(\kksd\Sesi::$DB);
        $userz->load(array('id=?', $f3->exists("COOKIE.user") ? $f3->COOKIE['user'] : $f3->SESSION['user']));
        $f3->set("system.user", $userz);
    }
    \Template::instance()->extend('php', function ($args) {
        $html = isset($args[0]) ? $args[0] : '';
        return "<?php {$html} ?>";
    });
});
\F3::route("GET  @admin:      /admin", "\\Control\\Admin\\App->home");
 public function get()
 {
     F3::reroute('/loot');
 }
Beispiel #14
0
 function reportLog()
 {
     if (F3::get('SESSION.asid')) {
         F3::reroute("/admin");
     }
     $admin = new Axon("admin_log");
     // $users=$admin->afind();
     $date1 = F3::get("POST.date1");
     $date2 = F3::get("POST.date2");
     if ($users = $admin->found()) {
         // var_dump($users);die;
         $users = $admin->afind("date between '" . $date1 . "' and '" . $date2 . "'");
         F3::set('report', $users);
         F3::set('nav', 'navigation');
         F3::set('title', 'Admin - Log');
         F3::set('templateAdmin', 'adminLog');
         echo Template::serve("template/layout.html");
     } else {
         $users = array();
         F3::set('report', $users);
         F3::set('nav', 'navigation');
         F3::set('templateAdmin', 'adminLog');
         echo Template::serve("template/layout.html");
     }
 }
Beispiel #15
0
<?php

// Reset previous error message, if any
F3::clear('message');
// Form field validation
F3::call(':common');
if (!F3::exists('message')) {
    // No input errors; add record to database
    $blog = new Axon('kul');
    $blog->copyFrom('REQUEST');
    $blog->save();
    // Return to home page; new blog entry should now be there
    F3::reroute('/');
    /*$payload = json_encode(array(F3::get('REQUEST.title'), F3::get('REQUEST.entry')));
    	F3::reroute('http://192.168.140.86/receiver.php?payload=' . $payload );*/
}
// Display the blog form again
F3::call(':createkul');
Beispiel #16
0
 /**
  * check and show login/logout
  * html
  *
  * @return void
  */
 private function authentication()
 {
     // logout
     if (isset($_GET['logout'])) {
         \F3::get('auth')->logout();
         \F3::reroute($this->view->base);
     }
     // login
     if (isset($_GET['login']) || \F3::get('auth')->isLoggedin() !== true && \F3::get('public') != 1) {
         // authenticate?
         if (count($_POST) > 0) {
             if (!isset($_POST['username'])) {
                 $this->view->error = 'no username given';
             } else {
                 if (!isset($_POST['password'])) {
                     $this->view->error = 'no password given';
                 } else {
                     if (\F3::get('auth')->login($_POST['username'], $_POST['password']) === false) {
                         $this->view->error = 'invalid username/password';
                     }
                 }
             }
         }
         // show login
         if (count($_POST) == 0 || isset($this->view->error)) {
             die($this->view->render('templates/login.phtml'));
         } else {
             \F3::reroute($this->view->base);
         }
     }
 }
Beispiel #17
0
 function toggleActive()
 {
     $id = F3::get("PARAMS.id");
     $user = new Axon('tbl_user');
     $user->load(array("id=:id", array(":id" => $id)));
     $user->active = $user->active == 'y' ? 'n' : 'y';
     $user->save();
     F3::reroute('/admin/user');
 }
Beispiel #18
0
    F3::set('config_permissions', $settings->config_permissions);
    $status_buttons = Template::serve('ui/status_buttons.html');
    F3::set('status_buttons', Template::serve('ui/status_buttons.html'));
    F3::set('content', Template::serve('ui/settings.html'));
    echo Template::serve('ui/template.html');
}
*/
F3::route('GET /settings', function () {
    global $settings;
    $settings->settings_page_data();
    F3::set('company_logos', $settings->company_logos);
    //        F3::set('debug', $settings->debug);
    F3::set('config_permissions', $settings->config_permissions);
    $status_buttons = Template::serve('ui/status_buttons.html');
    F3::set('status_buttons', Template::serve('ui/status_buttons.html'));
    F3::set('content', Template::serve('ui/settings.html'));
    echo Template::serve('ui/template.html');
});
F3::route('GET /set_permissions', function () {
    global $settings;
    $settings->set_permissions();
    F3::reroute('/settings');
});
F3::route('POST /save_settings', function () {
    $post_data = $_POST;
    $settings = new Settings();
    $settings->save();
    F3::reroute('/settings');
});
F3::route('GET /debug', 'debug.php');
F3::run();