Exemplo n.º 1
0
$username = "******";
$conn = new mysqli($servername, $username, "");
$sql = "CREATE DATABASE IF NOT EXISTS quiz";
$conn->query($sql);
$conn->close();
$conn = new mysqli($servername, $username, "", "quiz");
$sql = "CREATE TABLE IF NOT EXISTS accounts(\n  id int(11) AUTO_INCREMENT PRIMARY KEY,\n  name VARCHAR(50),\n  username VARCHAR(50),\n  password VARCHAR(50),\n  score int(11)\n  )";
$conn->query($sql);
$sql = "CREATE TABLE IF NOT EXISTS questions(\n  id int(11) AUTO_INCREMENT PRIMARY KEY,\n  question VARCHAR(100),\n  opt1 VARCHAR(50),\n  opt2 VARCHAR(50),\n  opt3 VARCHAR(50),\n  opt4 VARCHAR(50),\n  correct VARCHAR(2),\n  points int(5),\n  author int(11)\n  )";
$conn->query($sql);
$sql = "CREATE TABLE IF NOT EXISTS answers(\n  id int(11) AUTO_INCREMENT PRIMARY KEY,\n  ques_id int(11),\n  author_id int(11),\n  ans_opt VARCHAR(255),\n  cor_opt VARCHAR(255),\n  ques VARCHAR(255)\n  )";
$conn->query($sql);
if (count($_SESSION)) {
    $id = $_SESSION["user"];
    $pass = $_SESSION["pass"];
    $account = \App\account::find($id);
    if (strcmp($pass, $account->password) == 0) {
        echo '
   <script>
  window.location="' . url("quiz") . '";
  </script>
  
  ';
    }
}
echo '
  <nav class="navbar navbar-inverse" id="bar">
  <div class="container-fluid">
  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
Exemplo n.º 2
0
 <body>
 <?php 
if (count($_SESSION)) {
    $id = $_SESSION["user"];
    $pass = $_SESSION["pass"];
    $account = \App\account::find($id);
    if (strcmp($pass, $account->password) == 0) {
        echo '
   <script>
   window.location="' . url("quiz") . '";
   </script>
  
  ';
    }
}
$account = \App\account::where('username', '=', $username)->get();
if (count($account)) {
    if (Hash::check($pass, $account[0]->password)) {
        $_SESSION["user"] = $account[0]->id;
        $_SESSION["pass"] = $account[0]->password;
        echo '
         <script>
         window.location="' . url("quiz") . '";
         </script>
         ';
    } else {
        echo '
         <br>
		 <br>
		 <br>
		 <br>
Exemplo n.º 3
0
        $signinurl = "";
        $login = "******";
        $loginurl = url("logout");
        $login_failure = 0;
    }
}
if ($login_failure) {
    echo '
   <script>
  window.location="' . url("/") . '";
  </script>
  
  ';
} else {
    include 'navbar.php';
    $account = \App\account::find($_SESSION["user"]);
    $score = $account->score;
    echo '
	<h1>SCORE REPORT</h1>
	<br>
    <h2>We really appreciate your playing competitive skills.Keep Going.!!</h2>
<br>
<br>
<br>	
 <center>
				<div style="position:relative;float:left;margin-left:150px;">
				<canvas id="canvas"  height="300" width="400"></canvas>
			</div>
			<div style="position:relative;float:left;margin-left:50px;margin-top:50px;" class="alert alert-info col-sm-4 text-center">Your effective total score is <strong>' . $score . '</strong> points</div>
			</div>
			
Exemplo n.º 4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     session_start();
     $loguser = $_SESSION['user_id'];
     $data = ['modified_by' => $loguser, 'deleted' => '1'];
     App\account::find($id)->update($data);
 }