Example #1
0
function updateContent($contentID, $title, $content, $userID)
{
    $db = new DB();
    $db->bind('ContentID', $contentID);
    $db->bind('Title', $title);
    $db->bind('Content', $content);
    $db->bind('User', $userID);
    $result = $db->query('UPDATE content SET Title = :Title, Content = :Content, LastEditedBy = :User WHERE ContentID = :ContentID');
    return $result;
}
Example #2
0
function check_login()
{
    global $db, $mem;
    if (defined('MEM') && MEM == True) {
        $mem = new Memcached('moyoj');
        $mem->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
        if (!count($mem->getServerList())) {
            $mem->addServer(MEM_HOST, MEM_PORT);
        }
    }
    $db = new DB();
    $db->init(DB_HOST, DB_USER, DB_PASS, DB_NAME);
    $db->connect();
    $admin_info = mo_read_cache('mo-admin-' . $_SESSION['aid']);
    if (!$admin_info) {
        $sql = 'SELECT `id`, `username`, `password`, `nickname`, `role` FROM `mo_admin` WHERE `id` = ? AND `role` > 0';
        $db->prepare($sql);
        $db->bind('i', $_SESSION['aid']);
        $result = $db->execute();
        if (!$result || $result[0]['password'] != $_SESSION['admin_password']) {
            unset($_SESSION['aid']);
            header("Location: login.php");
            exit(0);
        }
        mo_write_cache('mo-admin-' . $_SESSION['aid'], $result[0]);
    }
    $mo_settings = array();
    mo_load_settings();
    if (!isset($active)) {
        $active = '';
    }
}
Example #3
0
function updatePolicy($policyID, $name, $disclaimer, $uploadFile)
{
    $db = new DB();
    $db->bind('PolicyID', $policyID);
    $db->bind('Name', $name);
    if (empty($disclaimer)) {
        $db->bind('Disclaimer', null);
    } else {
        $db->bind('Disclaimer', $disclaimer);
    }
    if ($uploadFile == null) {
        $result = $db->query('UPDATE policies SET Name = :Name, Disclaimer = :Disclaimer WHERE PolicyID = :PolicyID');
    } else {
        $db->bind('Url', $uploadFile);
        $result = $db->query('UPDATE policies SET Name = :Name, Disclaimer = :Disclaimer, Url = :Url WHERE PolicyID = :PolicyID');
    }
    return $result;
}
function exists($table, $value, $field)
{
    $db = new DB();
    $db->bind('value', $value);
    $result = $db->query("SELECT COUNT(*) AS `Count` FROM {$table} WHERE {$field} = :value");
    if ($result[0]['Count'] == 0) {
        return false;
    }
    return true;
}
 /**
  * @return array
  */
 public function getCoordinates()
 {
     $poa_coord = array();
     $poa_db = new DB();
     if (is_array($this->postcodes)) {
         foreach ($this->postcodes as $postcode) {
             $poa_db->bind("postcode", $postcode);
             $poa = $poa_db->query("SELECT * FROM poa_coord WHERE postCode = :postcode");
             if ($poa[0]['multigeo'] == 1) {
                 $poa_db->bind("poa_cord_id", $poa[0]['poa_ID']);
                 $multigeo = $poa_db->query("SELECT * FROM multigeo_coord WHERE poa_cord_id = :poa_cord_id");
                 foreach ($multigeo as $multi) {
                     $poa_coord[$postcode][] = $multi['multigeo_cord'];
                 }
             } else {
                 $poa_coord[$postcode] = $poa[0]['coordinates'];
             }
         }
     }
     return $poa_coord;
 }
<?php

require_once "../Classes/User.class.php";
require_once "../Classes/DB.class.php";
session_start();
if (!isset($_SESSION['username'])) {
    echo json_encode(array("status" => "needLogIn"));
    exit;
} else {
    $user = new User();
    $user->username = $_SESSION['username'];
    $user->Find();
    $USER_DATA = array();
    $USER_DATA = $user->variables;
    //USER_DATA CONTIENE TODOS LOS DATOS DEL USUARIO ACTIVO
    //VERIFICACION DE NIVEL DE USUARIO
    //USAR $REQUIRED_USER_LEVEL=%NIVEL% ANTES DEL INCLUDE DE ESTE ARCHIVO.
    if (isset($REQUIRED_USER_LEVEL)) {
        $db = new DB();
        $db->bind("titulo", $REQUIRED_USER_LEVEL);
        $level = $db->query("select level from user_levels where title = :titulo");
        if ($USER_DATA['userLevel'] < $level[0]['level']) {
            echo json_encode(array("status" => "needMoreUserLevel"));
            exit;
        }
    } elseif ($user->banned) {
        echo json_encode(array("status" => "banned", "reasson" => $user->reasson));
        exit;
    }
}
Example #7
0
      </script>
  </head>
  <body>
    <div id="page-content-wrapper">
      <div class="container-fluid">
        <h2>พนักงานในหน่วยงาน
        <?php 
$today = date("Y-m-d");
$month = date("m");
$year = date("Y");
$year_thai = "2558";
require_once 'core/init.php';
$db = new DB();
$division = htmlspecialchars($_GET["division"]);
$id_division = $db->query('SELECT department_id,division FROM all_tttbb_division2 WHERE department_id = :id_division');
$id_division = $db->bind(':id_division', $division, PDO::PARAM_STR);
$id_division = $db->execute();
$id_division = $db->single();
foreach ($id_division as $key => $value) {
    $division_name = $id_division["division"];
}
echo $division_name;
?>
        </h2>
        <br>
          <div class="row">
            <div class="col-lg-12">
              <div class="col-lg-2">
                 <div align="right"><h4>Select Section</h4></div>
              </div>
              <div class="col-lg-4">
<?php

require_once __DIR__ . '/db.php';
//response for JSON
$response = array();
if (isset($_POST['Content']) && isset($_POST['UserID']) && isset($_POST['PlaceID'])) {
    $content = $_POST['Content'];
    $userID = $_POST['UserID'];
    $placeID = $_POST['PlaceID'];
    $db = new DB();
    $db->bind('Content', $content);
    $db->bind('UserID', $userID);
    $db->bind('PlaceID', $placeID);
    $result = $db->query("INSERT INTO posts(Content, UserID, PlaceID) VALUES (:Content, :UserID, :PlaceID)");
    if ($result) {
        //successfully inserted into db
        $response['success'] = 1;
        $response['message'] = 'Post successfully created';
        //JSON response
        echo json_encode($response);
    } else {
        //failed to insert
        $response['success'] = 0;
        $response['message'] = 'An error occurred.';
        //JSON response
        echo json_encode($response);
    }
} else {
    //missing fields
    $response['success'] = 0;
    $response['message'] = 'Required field(s) are missing.';
Example #9
0
                          <h3 class="panel-title">รายชื่อพนักงานเข้าใหม่</h3>
                      </div>
                      <div class="panel-body">
                        <div class="col-lg-12 col-md-6">
                            <?php 
require_once 'core/init.php';
$db = new DB();
$today = date("Y-m-d");
$month = date("m");
$year = date("Y");
$year_thai = "2558";
$start_emp = $db->query('SELECT date_start,emp_id,t_firstname,t_lastname,job_title,section,division,date_start  FROM all_ro10_emp
                                                         WHERE MONTH(date_start) = :month
                                                         AND (YEAR(date_start) = :thai_year OR  YEAR(date_start) = :year)
                                                         AND data_date = :today ');
$start_emp = $db->bind(':year', $year, PDO::PARAM_STR);
$start_emp = $db->bind(':month', $month, PDO::PARAM_STR);
$start_emp = $db->bind(':thai_year', $year_thai, PDO::PARAM_STR);
$start_emp = $db->bind(':today', $today, PDO::PARAM_STR);
$start_emp = $db->execute();
$start_emp = $db->rowCount();
?>
                                 <table class="table table-striped table-bordered" id="new_emp" cellspacing="0" width="100%">
                                    <thead>
                                        <tr>
                                            <th>No.</th>
                                            <th>รหัสพนักงาน</th>
                                            <th>ชื่อพนักงาน</th>
                                            <th>นามสกุลพนักงาน</th>
                                            <th>Job Title</th>
                                            <th>Division</th>
Example #10
0
require_once "../Classes/VerifyEmail.class.php";
$user = new User();
$VEmail = new VerifyEmail();
if (isset($PARAMS['email']) && isset($PARAMS['hash']) && isset($PARAMS['u'])) {
    $username = $PARAMS['u'];
    $code = $PARAMS['hash'];
    $email = $PARAMS['email'];
    $VEmail->email = $email;
    $VEmail->Find();
    if ($VEmail->variables && !$VEmail->verified && $VEmail->username == $username && $VEmail->code == $code) {
        $user->username = $username;
        $user->Find();
        $user->verified = 1;
        //GET LEVEL OF LoggedVeriffied
        $db = new DB();
        $db->bind("title", "LoggedVerified");
        $level = $db->query("select level from user_levels where title = :title");
        //.............................
        $user->userLevel = $level;
        $user->Save();
        $VEmail->verified = 1;
        $VEmail->Save();
        $datos = array("status" => "OK");
        print_r(json_encode($datos));
    } else {
        if ($VEmail->variables && $VEmail->verified && $VEmail->username == $username && $VEmail->code == $code) {
            $datos = array("status" => "alreadyVerified");
            print_r(json_encode($datos));
        } else {
            $datos = array("status" => "NoResults");
            print_r(json_encode($datos));
Example #11
0
        <?php 
//require_once('themes/left.php');
require_once 'core/init.php';
require 'bower_components/Carbon/Carbon.php';
$today = date("Y-m-d");
$month = date("m");
$year = date("Y");
$year_thai = "2558";
$number = "1";
use Carbon\Carbon;
$yesterday = Carbon::yesterday();
$yesterday->toDateString();
//$last_month = date("Y-n-j", strtotime("last day of previous month"));
$db = new DB();
$new = $db->query("SELECT date_finish\n                            FROM all_ro10_emp_trans\n                            WHERE MONTH(all_ro10_emp_trans.date_finish) = :month\n                            AND all_ro10_emp_trans.data_date = :today\n                            AND (YEAR(all_ro10_emp_trans.date_finish) = :year OR YEAR(all_ro10_emp_trans.date_finish) = :thai_year)\n                            AND ExpiredCaseID != '0' ");
$new = $db->bind(':month', $month);
$new = $db->bind(':year', $year);
$new = $db->bind(':today', $today);
$new = $db->bind(':thai_year', $year_thai);
$new = $db->execute();
$emp_out = $db->rowCount();
$start_emp = $db->query('SELECT date_start  FROM all_ro10_emp
                                 WHERE MONTH(date_start) = :month
                                 AND (YEAR(date_start) = :thai_year OR  YEAR(date_start) = :year)
                                 AND data_date = :today ');
$start_emp = $db->bind(':year', $year, PDO::PARAM_STR);
$start_emp = $db->bind(':month', $month, PDO::PARAM_STR);
$start_emp = $db->bind(':thai_year', $year_thai, PDO::PARAM_STR);
$start_emp = $db->bind(':today', $today, PDO::PARAM_STR);
$start_emp = $db->execute();
$start_emp = $db->rowCount();
<?php

require_once __DIR__ . '/db.php';
//array for json response
$response = array();
if (isset($_POST['PlaceID']) && isset($_POST['Name']) && isset($_POST['Longitude']) && isset($_POST['Latitude'])) {
    $placeID = $_POST['PlaceID'];
    $name = $_POST['Name'];
    $longitude = $_POST['Longitude'];
    $latitude = $_POST['Latitude'];
    require_once 'ifExists.php';
    $db = new DB();
    //if place doesn't exist, make it exist
    if (!placeExists($placeID)) {
        $db->bind('PlaceID', $placeID);
        $db->bind('Name', $name);
        $db->bind('Longitude', $longitude);
        $db->bind('Latitude', $latitude);
        $db->query('INSERT INTO `places` (PlaceID, Name, Longitude, Latitude) ' . 'VALUES(:PlaceID, :Name, :Longitude, :Latitude)');
    }
    $db->bind('PlaceID', $placeID);
    $results = $db->query("SELECT PostID, Content, Time, posts.UserID, users.Username, places.Name AS Name " . "FROM posts " . "JOIN users ON posts.UserID = users.UserID " . "JOIN places ON places.PlaceID = posts.PlaceID " . "WHERE posts.PlaceID = :PlaceID " . "ORDER BY Time DESC");
    $db->bind('PlaceID', $placeID);
    $name = $db->query("SELECT Name FROM places WHERE PlaceID = :PlaceID");
    //results is not empty
    if (count($results) != 0) {
        //successful
        $response['success'] = 1;
        $response['message'] = "Posts successfully grabbed.";
        $response['PlaceName'] = $name[0]['Name'];
        $response['FirstToPost'] = 0;
<?php

require_once __DIR__ . '/db.php';
//response for JSON
$response = array();
if (isset($_POST['Content']) && isset($_POST['UserID']) && isset($_POST['PostID']) || true) {
    $content = $_POST['Content'];
    $userID = $_POST['UserID'];
    $postID = $_POST['PostID'];
    $db = new DB();
    $db->bind('Content', $content);
    $db->bind('UserID', $userID);
    $db->bind('PostID', $postID);
    $result = $db->query("INSERT INTO comments(Content, UserID, PostID) VALUES (:Content, :UserID, :PostID)");
    if ($result) {
        //successfully inserted into db
        $response['success'] = 1;
        $response['message'] = 'Comment successfully created';
        $response['PostID'] = $postID;
        //JSON response
        echo json_encode($response);
    } else {
        //failed to insert
        $response['success'] = 0;
        $response['message'] = 'An error occurred.';
        //JSON response
        echo json_encode($response);
    }
} else {
    //missing fields
    $response['success'] = 0;
Example #14
0
 /**
  * Test DB::bind() with named placeholders
  * 
  * @depends testQuote
  */
 public function testBind_Named()
 {
     $query = DB::bind('SELECT * FROM foo WHERE id = :id', array('id' => 10));
     $this->assertEquals('SELECT * FROM foo WHERE id = 10', $query);
     $query = DB::bind('SELECT * FROM foo WHERE name = :name', array('name' => 'jan'));
     $this->assertEquals('SELECT * FROM foo WHERE name = "jan"', $query);
     $query = DB::bind('SELECT *, "a\\"b:id" AS `str:id` FROM foo WHERE id = :id', array('id' => 10));
     $this->assertEquals('SELECT *, "a\\"b:id" AS `str:id` FROM foo WHERE id = 10', $query);
     $query = DB::bind('SELECT * FROM foo WHERE id = :id AND active = :active LIMIT :limit', array('id' => 10, 'active' => true, 'limit' => 15));
     $this->assertEquals('SELECT * FROM foo WHERE id = 10 AND active = TRUE LIMIT 15', $query);
     $query = DB::bind('UPDATE foo SET data = :data WHERE id = :id', array('data' => null, 'id' => 10));
     $this->assertEquals('UPDATE foo SET data = NULL WHERE id = 10', $query);
     $query = DB::bind('SELECT * FROM foo WHERE id = :id AND active = :active', array('id' => 10));
     $this->assertEquals('SELECT * FROM foo WHERE id = 10 AND active = :active', $query);
     $query = DB::bind('SELECT * FROM foo WHERE id IN :ids', array('ids' => array(10, 20, 99)));
     $this->assertEquals('SELECT * FROM foo WHERE id IN (10, 20, 99)', $query);
 }
<?php

require_once __DIR__ . '/db.php';
$response = array();
if (isset($_POST['Username']) && isset($_POST['Password']) || true) {
    $db = new DB();
    $username = $_POST["Username"];
    $password = $_POST['Password'];
    $db->bind('Username', $username);
    $db->bind('Password', $password);
    $result = $db->query("SELECT UserID, FirstName, LastName, Username, Password, Email FROM users " . "WHERE Username = :Username AND Password = :Password");
    if ($result) {
        $response['success'] = 1;
        $response['user'] = array();
        array_push($response['user'], $result);
        echo json_encode($response);
    } else {
        $response['success'] = 0;
        $response['message'] = "An error has occurred.";
        echo json_encode($response);
    }
} else {
    $response['success'] = 0;
    $resposne['message'] = 'Required field(s) are missing.';
    echo json_encode($response);
}
Example #16
0
	</head>
	<body>
	<h1>Scouting Record for Team #<?php 
echo $_GET['team'];
?>
</h1>
	<h2>Pit Scouting Record</h2>
	<table style="text-align: center" class="table table-condensed table-bordered"
	<thead>
	<tr style="background: #BBBBBB">
		<td style="width: 50%;">Stat</td>
		<td style="width: 50%;">Value</td>
	</tr>
	</thead>
	<?php 
$db->bind("team", $_GET['team']);
$pitscout = $db->getAll("CALL getPitScoutRecord(:team)")[0];
if (count($pitscout)) {
    echo "<tr><td>Drive Type</td><td>" . $drivetypeLookup[$pitscout['drivetype']] . "</td></tr>";
    echo "<tr><td># of Balls Intake Holds</td><td>" . $intakeballhold[$pitscout['intakehold']] . "</td></tr>";
    echo "<tr><td>Shooter Type</td><td>" . $shoottype[$pitscout['shootertype']] . "</td></tr>";
    echo "<tr><td>Goal Aimed At</td><td>" . $goalaimed[$pitscout['aimedgoal']] . "</td></tr>";
    echo "<tr><td>Shooter Speed</td><td>" . $shootspeed[$pitscout['shooterspeed']] . "</td></tr>";
    echo "<tr><td>Auto Description</td><td>" . $autodesc[$pitscout['autodesc']] . "</td></tr>";
    echo "<tr><td>Possibility of Elevation</td><td>" . $elevationpossiblities[$pitscout['eleposs']] . "</td></tr>";
    echo $pitscout['eleposs'] != '1' ? "<tr><td>Elevation Speed</td><td>" . $timeforele[$pitscout['elespeed']] . "</td></tr>" : "";
    echo "<tr><td>Balls Scored During Driver Control</td><td>" . $scoredballsdriver[$pitscout['drivercontrolballs']] . "</td></tr>";
    echo "<tr><td>Driver Control Strategy</td><td>" . $driverstrat[$pitscout['driverstrat']] . "</td></tr>";
}
?>
	</table>
Example #17
0
</head>
<body>
<?php 
// include_once('themes/left.php');
?>
 <div id="page-content-wrapper">
     <div class="container-fluid">
        <h3>รายชื่อพนักงานหน่วยงานที่เป็นพนักงานประจำ</h3>
        <?php 
require_once 'core/init.php';
$db = new DB();
$division = htmlspecialchars($_GET["division"]);
$emp_type = htmlspecialchars($_GET["emp"]);
$id_division = $db->query('SELECT department_id,division FROM all_tttbb_division WHERE department_id = :id_division');
$id_division = $db->bind(':id_division', $division, PDO::PARAM_STR);
$id_division = $db->execute();
$id_division = $db->single();
foreach ($id_division as $key => $value2) {
    $division_name = $id_division["division"];
}
echo "หน่วยงาน : ", $division_name;
$today = date("Y-m-d");
$month = date("m");
$year = date("Y");
$year_thai = "2558";
$emp_division = $db->query('SELECT date_start,emp_id,t_firstname,t_lastname,job_title,section,division  FROM all_ro10_emp
                                     WHERE division = :division
                                     AND emp_type_id = :emp_type
                                     AND data_date = :today
                                     ORDER BY date(date_start) ASC');
<?php

require_once __DIR__ . '/db.php';
$response = array();
$db = new DB();
//get post id
if (isset($_POST['PostID'])) {
    $postID = $_POST['PostID'];
    $db->bind('PostID', $postID);
    $result = $db->query("SELECT PostID, Content, Time, users.Username FROM posts " . "JOIN users ON posts.userID = users.userID WHERE PostID = :PostID ORDER BY Time DESC");
    $db->bind('PostID', $postID);
    $comments = $db->query("SELECT CommentID, c.Content, c.Time, u.Username " . "FROM comments c " . "JOIN users u on u.userID = c.UserID " . "WHERE PostID = :PostID " . "ORDER BY c.Time DESC");
    //if result actually contains something
    if (!empty($result)) {
        //should only be one row
        if (!(count($result) == 0)) {
            $response['success'] = 1;
            $response['message'] = 'Post successfully grabbed.';
            $response['post'] = array();
            $post = array();
            $post['PostID'] = $result[0]['PostID'];
            $post['Content'] = $result[0]['Content'];
            $post['Time'] = date('n/d/Y g:i a', strtotime($result[0]['Time']));
            $post['Username'] = $result[0]['Username'];
            array_push($response['post'], $post);
            $response['comments'] = array();
            foreach ($comments as $row) {
                $comment = array();
                $comment['CommentID'] = $row['CommentID'];
                $comment['Content'] = $row['Content'];
                $comment['Time'] = date('n/d/Y g:i a', strtotime($row['Time']));
Example #19
0
                            <h3 class="panel-title">รายชื่อพนักงานเข้าใหม่ <?php 
echo $monthName;
?>
</h3>
                      </div>
                      <div class="panel-body">
                        <div class="col-lg-12 col-md-6">
                            <?php 
require_once 'core/init.php';
$db = new DB();
$today = date("Y-m-d");
$month = date("m");
$year = date("Y");
$year_thai = "2558";
$finish = $db->query("SELECT    all_ro10_emp.data_date,\n                                                                  all_ro10_emp.emp_id,\n                                                                  all_ro10_emp.e_firstname,\n                                                                  all_ro10_emp.e_lastname,\n                                                                  all_ro10_emp.job_title,\n                                                                  all_ro10_emp_trans.e_firstname,\n                                                                  all_ro10_emp_trans.e_lastname,\n                                                                  all_ro10_emp_trans.date_finish\n                                                      FROM\n                                                              all_ro10_emp_trans\n                                                      INNER JOIN all_ro10_emp ON all_ro10_emp_trans.e_firstname = all_ro10_emp.e_firstname AND all_ro10_emp_trans.e_lastname = all_ro10_emp.e_lastname\n                                                      WHERE MONTH(all_ro10_emp_trans.date_finish) = :month\n                                                      AND all_ro10_emp.data_date = :today\n                                                      AND (YEAR(all_ro10_emp_trans.date_finish) = :year OR YEAR(all_ro10_emp_trans.date_finish) = :thai_year)\n                                                      AND all_ro10_emp_trans.ExpiredCaseID != 0 ");
$finish = $db->bind(':month', $month);
$finish = $db->bind(':year', $year);
$finish = $db->bind(':today', $today);
$finish = $db->bind(':thai_year', $year_thai);
$finish = $db->execute();
$count = $db->rowCount();
$new = $db->query("SELECT date_finish,emp_id,t_firstname,t_lastname,section,division,date_finish FROM all_ro10_emp_trans\n                                                WHERE MONTH(all_ro10_emp_trans.date_finish) = :month\n                                                AND all_ro10_emp_trans.data_date = :today\n                                                AND (YEAR(all_ro10_emp_trans.date_finish) = :year OR YEAR(all_ro10_emp_trans.date_finish) = :thai_year)");
$new = $db->bind(':month', $month);
$new = $db->bind(':year', $year);
$new = $db->bind(':today', $today);
$new = $db->bind(':thai_year', $year_thai);
$new = $db->execute();
$count_new = $db->rowCount();
?>
                                 <table class="table table-striped table-bordered" id="new_emp" cellspacing="0" width="100%">
                                    <thead>
Example #20
0
    require_once ABSPATH . 'mo-config.php';
    require_once MOINC . 'functions.php';
    require_once MOINC . 'class-db.php';
    if (defined('MEM') && MEM == True) {
        $mem = new Memcached('moyoj');
        $mem->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
        if (!count($mem->getServerList())) {
            $mem->addServer(MEM_HOST, MEM_PORT);
        }
    }
    $db = new DB();
    $db->init(DB_HOST, DB_USER, DB_PASS, DB_NAME);
    $db->connect();
    $sql = 'SELECT `id`, `username`, `password`, `nickname`, `role` FROM `mo_admin` WHERE `username` = ? AND `role` > 0 LIMIT 1';
    $db->prepare($sql);
    $db->bind('s', $_POST['username']);
    $result = $db->execute();
    if ($result && password_verify($_POST['password'], $result[0]['password'])) {
        $result = $result[0];
        $_SESSION['aid'] = $result['id'];
        $_SESSION['admin_password'] = $result['password'];
        mo_write_cache('mo-admin-' . $_SESSION['aid'], $result);
    } else {
        $loginfail = True;
    }
}
if (isset($_GET['action']) && $_GET['action'] == 'logout') {
    unset($_SESSION['aid']);
    unset($_SESSION['admin_password']);
    $logout = True;
}
<?php

require_once __DIR__ . '/db.php';
//response for json
$response = array();
if (isset($_POST['FirstName']) && isset($_POST['LastName']) && isset($_POST['Username']) && isset($_POST['Password']) && isset($_POST['Email'])) {
    $fname = $_POST['FirstName'];
    $lname = $_POST['LastName'];
    $username = $_POST['Username'];
    $password = $_POST['Password'];
    $email = $_POST['Email'];
    require_once __DIR__ . '/ifExists.php';
    if (!usernameExists($username)) {
        if (!emailExists($email)) {
            $db = new DB();
            $db->bind('FirstName', $fname);
            $db->bind('LastName', $lname);
            $db->bind('Username', $username);
            $db->bind('Password', $password);
            $db->bind('Email', $email);
            $result = $db->query("INSERT INTO `users`(FirstName, LastName, Username, Password, Email) " . "VALUES (:FirstName, :LastName, :Username, :Password, :Email)");
            if ($result) {
                //successful
                $response["success"] = 1;
                $response["message"] = "User successfully registered.";
                echo json_encode($response);
            } else {
                $response["success"] = 0;
                $response["message"] = 'An error occurred.';
                echo json_encode($response);
            }
Example #22
0
//require_once('themes/left.php');
require_once 'core/init.php';
require 'bower_components/Carbon/Carbon.php';
$today = date("Y-m-d");
$month = date("m");
$year = date("Y");
$year_thai = "2558";
$number = "1";
use Carbon\Carbon;
$yesterday = Carbon::yesterday();
$yesterday->toDateString();
//$last_month = date("Y-n-j", strtotime("last day of previous month"));
//echo $last_month,"<br>";
$db = new DB();
$emp_last = $db->query('SELECT data_date  FROM all_ro10_emp WHERE data_date = :yesterday');
$emp_last = $db->bind(':yesterday', $yesterday, PDO::PARAM_STR);
$emp_last = $db->execute();
$emp_last = $db->rowCount();
//echo $emp_last;
$stmt = $db->query('SELECT data_date  FROM all_ro10_emp  WHERE data_date = :today');
$stmt = $db->bind(':today', $today);
$stmt = $db->execute();
$stmt = $db->rowCount();
//echo $stmt;
$finish = $db->query("SELECT    all_ro10_emp.data_date,\n                                        all_ro10_emp.emp_id,\n                                        all_ro10_emp.e_firstname,\n                                        all_ro10_emp.e_lastname,\n                                        all_ro10_emp.job_title,\n                                        all_ro10_emp_trans.e_firstname,\n                                        all_ro10_emp_trans.e_lastname,\n                                        all_ro10_emp_trans.date_finish\n                            FROM\n                                    all_ro10_emp_trans\n                            INNER JOIN all_ro10_emp ON all_ro10_emp_trans.e_firstname = all_ro10_emp.e_firstname AND all_ro10_emp_trans.e_lastname = all_ro10_emp.e_lastname\n                            WHERE MONTH(all_ro10_emp_trans.date_finish) = :month\n                            AND all_ro10_emp.data_date = :today\n                            AND (YEAR(all_ro10_emp_trans.date_finish) = :year OR YEAR(all_ro10_emp_trans.date_finish) = :thai_year)");
$finish = $db->bind(':month', $month);
$finish = $db->bind(':year', $year);
$finish = $db->bind(':today', $today);
$finish = $db->bind(':thai_year', $year_thai);
$finish = $db->execute();
$finish = $db->rowCount();
Example #23
0
<?php

require "backend/Db.class.php";
$db = new DB();
$res = $db->getAll("CALL getMatchInfo(" . $_GET['match'] . ")")[0];
$db->bind("match", $_GET['match']);
$db->bind("team", $res['team_redA']);
$redAScout = $db->getAll("CALL getScout(:match, :team)")[0];
$db->bind("match", $_GET['match']);
$db->bind("team", $res['team_redB']);
$redBScout = $db->getAll("CALL getScout(:match, :team)")[0];
$db->bind("match", $_GET['match']);
$db->bind("team", $res['team_blueA']);
$blueAScout = $db->getAll("CALL getScout(:match, :team)")[0];
$db->bind("match", $_GET['match']);
$db->bind("team", $res['team_blueB']);
$blueBScout = $db->getAll("CALL getScout(:match, :team)")[0];
?>
<!DOCTYPE html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha256-7s5uDGW3AHqw6xtJmNNtr+OBRJUlgkNJEo78P4b0yRw= sha512-nNo+yCHEyn0smMxSswnf/OnX6/KwJuZTlNZBjauKhTK0c+zT+q5JOCx0UFhXQ6rJR9jg6Es8gPuD2uZcYDLqSw==" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha256-KXn5puMvxCw+dAYznun+drMdG1IFl3agK0p/pqT9KAo= sha512-2e8qq0ETcfWRI4HJBzQiA3UoyFk6tbNyG+qSaIBZLyW9Xf3sWZHN/lxe9fTh1U45DpPf07yj94KsUHHWe4Yk1A==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<title>Match View</title>
</head>
<body>
<h1>Basic Match Info & Recap</h1><br>
<table class="table table-condensed table-bordered">
<thead>
<tr>
<td class="text-center" style="width:10%">Match Number</td>