Exemplo n.º 1
0
<?php

include 'include.php';
$login_success = false;
if ($_POST) {
    $roll = $_POST['roll'];
    $password = $_POST['password'];
    $result = db_select_where('students', 'roll,name', 'roll=' . $roll . ' and md5("' . $password . '")=password');
    if ($result) {
        $token = uniqid();
        setcookie("roll", $roll);
        setcookie("token", $token);
        $login_query = 'update students set token="' . $token . '" where roll=' . $roll;
        if (db_exec_only($login_query)) {
            $login_success = true;
        }
    }
}
theme_header('Login');
theme_navbar($login_success, $roll);
?>
        <div class="col-lg-5">
        <h2><i class="fa fa-sign-in fa-fw"></i> Login <small>Get access student database</small></h2>
        <?
        if($login_success)
            login_success();
        else {
            if($_POST) {
                login_error();
            }
            theme_login_form();
Exemplo n.º 2
0
$user_exists = false;
$field_incomplete = false;
$register_success = false;
if ($_POST) {
    $roll = $_POST['roll'];
    $name = $_POST['name'];
    $password = $_POST['password'];
    if (empty($roll) or empty($name)) {
        $field_incomplete = true;
    } else {
        $result = db_select_where('students', 'roll', 'roll=' . $roll);
        if ($result) {
            $user_exists = true;
        } else {
            $register_query = sprintf('insert into students (roll,name,password) values (%d, "%s", md5("%s"))', $roll, $name, $password);
            if (db_exec_only($register_query)) {
                $register_success = true;
            }
        }
    }
}
theme_header('Register');
theme_navbar($verified_user, $roll);
?>
        <div class="col-lg-5">
        <h2><i class="fa fa-plus fa-fw"></i> Register <small>Add a new student to database</small></h2>
        <?
        if($user_exists) {
            reg_already_exists();
            theme_reg_form();
        } else if($field_incomplete) {
Exemplo n.º 3
0
include 'include.php';

$success = false;

if($_POST)
{
    $querystr = "update students set ";
    $params = array();
    foreach($_POST as $key => $value)
    {
        if($key != 'roll')
            $params[] = $key . '="' . mysql_escape_string($value) . '"';
    }
    $querystr = $querystr . join(', ', $params) . ' where roll = ' . $roll;
    $success = db_exec_only($querystr);
}

$student = db_select_where('students', 'roll,name,birthdate,email,cell_number,emergency_number,hall_name,room_no,address', 'roll='.$roll);
$student = $student[0];
$fields = array_keys($student);

foreach(db_select('icons', 'field,icon') as $icon)
    $icons[$icon['field']] = $icon['icon'];

theme_header('Edit Profile | ' . $student['name']);
theme_navbar($verified_user, $roll);

if($verified_user) {
?>
        <div class="col-lg-9">
Exemplo n.º 4
0
<?php

include 'include.php';
$logout_success = false;
$roll = $_COOKIE['roll'];
if ($roll) {
    setcookie("roll", "");
    setcookie("token", "");
    $logout_query = 'update students set token="" where roll=' . $roll;
    $logout_success = db_exec_only($logout_query);
}
theme_header('Logout');
theme_navbar();
?>
        <div class="col-lg-5">
            <h2>Logout <small>End your session</small></h2>
            <?
            if($logout_success)
                logout_success();
            else
                logout_error();           
            
            ?>
        </div>
<?
theme_footer();
db_close();

?>
Exemplo n.º 5
0
<?php

include 'include.php';
$chpasswd_success = false;
if ($_POST) {
    $password = $_POST['password'];
    $chpasswd_query = 'update students set password=md5("' . $password . '") where roll=' . $roll;
    if (db_exec_only($chpasswd_query)) {
        $chpasswd_success = true;
    }
}
theme_header('Change Password');
theme_navbar($verified_user, $roll);
?>
        <div class="col-lg-8">
        </div>
        <h2><i class="fa fa-sign-in fa-fw"></i> Change Password <small>Change your login credential</small></h2>
        <div class="col-lg-5">
        <?
        if($chpasswd_success)
            chpasswd_success();
        else {
            if($_POST) {
                chpasswd_error();
            }
            theme_chpasswd_form();
        }
        ?>
        </div>
<?
theme_footer();
Exemplo n.º 6
0
<?php

include 'include.php';
if ($_POST) {
    $confirm = $_POST['confirm'];
    $delete_query = 'delete from students where roll=' . $roll;
    if (db_exec_only($delete_query)) {
        header('Location: index.php');
    }
}
theme_header('Delete Account');
theme_navbar($verified_user, $roll);
?>
        <div class="col-lg-9">
        <h2><i class="fa fa-ban fa-fw"></i>Delete Account <small>Remove your all details</small></h2>
        <h3>Are you sure that you want to delete your account?</h3>
        <?
        theme_delete_form();
        ?>
        </div>
<?
theme_footer();
db_close();

?>