function check_valid_user()
{
    // see if somebody is logged in and notify them if not
    if (isset($_SESSION['valid_user'])) {
        echo "Logged in as " . $_SESSION['valid_user'] . ".<br />";
    } else {
        // they are not logged in
        do_html_heading('Problem:');
        echo 'You are not logged in.<br />';
        do_html_url('login.php', 'Login');
        add_footer();
        exit;
    }
}
//require_once('function/security.php');
require_once 'database/connection.php';
require_once 'includes/output.html.php';
require_once 'function/data_holder.php';
//create short variable names
$email = $_POST['email'];
$password = $_POST['password'];
if (!empty($_POST['email']) && !empty($_POST['password'])) {
    // they have just tried logging in
    try {
        login($email, $password);
        // if they are in the database register the user id
        session_start();
        $_SESSION['valid_user'] = $email;
        $cookie_name = 'login';
        setcookie($cookie_name, $email, time() + 3600, "/");
        if (!last_page()) {
            header("Location:index.php");
        }
    } catch (Exception $e) {
        // unsuccessful login
        add_header('Problem:');
        echo "<div class='wrapper' style=' position:relative; left:-200px; width:30%; height:20em; '>";
        echo '<h3 style="margin-top:20%; width:180%;">You could not be logged in. You must be logged in to view this page.</h3><br/>';
        echo "<b>Try Again!</b><br/><hr/>";
        do_html_url('login.php', 'Login');
        echo "</div>";
        add_footer();
        exit;
    }
}
Esempio n. 3
0
function check_footer_page($footer, $pagename)
{
    $col = 'title';
    $table = 'footer_pages';
    if (!check_url($table, $col, $pagename)) {
        return "This page already exists in Footer";
    } else {
        return add_footer($footer, $pagename);
    }
}
Esempio n. 4
0
$start_epoch = gps_to_epoch($ride_data_array[ride_date]);
if ($target_array[object] === 'segment') {
    //segments have no time stamps
    $stop_at = count($stream_data->latlng) - 1;
} else {
    //stationary rides have no coordinates
    $stop_at = count($stream_data->time) - 1;
}
//TURNING THE CRANK
for ($i = 0; $i <= $stop_at; $i++) {
    $seconds_time = $stream_data->time[$i];
    $timestamp = gps_date($start_epoch + $seconds_time);
    $altitude = $stream_data->altitude[$i];
    $cadence = $stream_data->cadence[$i];
    $distance = $stream_data->distance[$i];
    $latlng = $stream_data->latlng[$i];
    $heartrate = $stream_data->heartrate[$i];
    $temp = $stream_data->temp[$i];
    if ($stream_data->watts[0] !== FALSE) {
        $watts = $stream_data->watts[$i];
    } else {
        $watts = $stream_data->watts_calc[$i];
    }
    $loop_result = array('time' => $timestamp, 'altitude' => $altitude, 'cadence' => $cadence, 'distance' => $distance, 'lat' => $latlng[0], 'lng' => $latlng[1], 'heartrate' => $heartrate, 'temp' => $temp, 'watts' => $watts);
    $data_line = datapoint_format($file_type, $loop_result);
    $trackpoints = $trackpoints . $data_line;
}
$footer = add_footer($file_type);
$contents = $header . $trackpoints . $footer;
$new_name = output_file($file_type, $target_array[id], $contents);
echo 'Congratulations - <a href="' . $target_array[id] . '.' . strtolower($file_type) . '">your file export</a> is ready.';
function check_valid_user()
{
    // see if somebody is logged in and notify them if not
    if (isset($_SESSION['valid_user'])) {
        return true;
    } else {
        // they are not logged in
        echo "<div class='container'>";
        echo "<div class='row'>";
        echo "<div class='col-md-8'>";
        login_form();
        echo "</div>";
        echo "</div>";
        echo "</div>";
        add_footer();
        exit;
    }
}
function show_todolist_notice()
{
    add_header('Please Login:'******'wrapper' style=' width:30%; height:30em; '>";
       echo "<h2 style='position:relative; top:150px;'>Create a TodoList</h2>";
       echo "<div class='alert alert-danger' style='position:relative; left:05%; top:40%;'>" ;
       echo "<div style='text-align:center; font-weight:bold; text-shadow:0px 1px 1px #eee;'> Please Login To Create a TodoList </div></div><br/>"; 
       echo"<a style='display:block; position:relative; top:150px; left:6%;' href='http://localhost/ajax_loader/login.php'>Login</a>";
       echo"</div>";
  
<?php 
    add_footer();
    return true;
}