Example #1
0
		<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script>
	</head>
	<body>
		<?php 
$name = $_POST["name"];
$type = $_POST["inout"];
$server = "us-cdbr-iron-east-03.cleardb.net";
$username = "******";
$password = "******";
$db = "heroku_3d5da57e92aa9e3";
$mysqli = new mysqli($server, $username, $password, $db);
if ($type === "in") {
    sign_in($name, $mysqli);
} else {
    if ($type === "out") {
        sign_out($name, $mysqli);
    }
}
// NOTE: Probably want to put the following functions in a separate file.
// Not sure how to do that yet, so I'll leave it here for proof of concept.
/**************************************/
// SIGN IN AND OUT
function sign_in($name, $mysqli)
{
    date_default_timezone_set("America/Chicago");
    $unix = time();
    $statement = $mysqli->prepare("INSERT INTO temp (name, time_in)\n\t\t\t\t\t\t\t\t\t\t\tVALUES (?, ?)");
    $statement->bind_param('si', $name, $unix);
    $statement->execute();
    echo "<script> toastr.success('Alright. You\\'re Signed in.') </script>";
}
Example #2
0
<?php

require_once '/home/newvis8/public_html/php/db_util.php';
require_once '/home/newvis8/public_html/php/session.php';
require_once '/home/newvis8/public_html/php/util.php';
$message = "Thank you for visiting New Vision Press Web site.  You have Logged out from NVC press web.<br />";
display_message($message);
sign_out();
            die("Invalid username or password");
        }
        break;
    case 'get_user':
        $User_num = $_REQUEST['u_num'];
        $write = get_user($User_num);
        $result = true;
        break;
    case 'get_schedule':
        $user_num = $_REQUEST['u_num'];
        $start = $_REQUEST['start'];
        $end = $_REQUEST['end'];
        $write = fill_out_sch($user_num, $start, $end);
        $result = true;
        break;
    case 'update_sch':
        $user_num = $_REQUEST['u_num'];
        algorithm($user_num);
        $result = true;
        break;
    case 'sign_out':
        $user_num = $_REQUEST['u_num'];
        sign_out($user_num);
        $result = true;
        break;
}
if ($result) {
    echo $write;
} else {
    die("error");
}