Ejemplo n.º 1
0
</div>

<div class="col-md-6">
 <h2>Done</h2>
 <hr>
                    <table class="table table-striped">
                    <thead>
                      <tr>
                        <th>#</th>
                        <th>ToDo</th>
                        <th style="text-align:center">Action</th>
                      </tr>
                    </thead>
                    <tbody>
                     <?php 
$result = dbRowSelect('todo_list', " WHERE todo_status != 'Not Done' ");
$count = 1;
while ($row = mysql_fetch_array($result)) {
    ?>
                      <form>
                      <tr>
                        <td><?php 
    echo $count;
    ?>
</td>
                        <td><?php 
    echo $row['todo_item'];
    ?>
</td>
                        <td style="text-align:center" > 
                       <a href="index.php?done=0&amp;id=<?php 
        $res = dbRowupdate($_POST['t_name'], $data, $_POST['clause'], $con);
        if (!$res) {
            die("failed");
        }
        exit;
    }
    if (strcmp($op, 'delete') == 0) {
        echo "in delete";
        $res = dbRowDelete($_POST['t_name'], $_POST['clause'], $con);
        if (!$res) {
            die("failed");
        }
        exit;
    }
    if (strcmp($op, 'select') == 0) {
        $res = dbRowSelect($_POST['t_name'], $_POST['fields'], $_POST['clause'], $con);
        if (!$res) {
            die("failed");
        } else {
            while ($r[] = mysqli_fetch_array($res)) {
            }
            echo json_encode($r);
        }
        exit;
    }
}
function dbRowSelect($table_name, $fields, $where_clause, $con)
{
    $whereSQL = '';
    if (!empty($where_clause)) {
        // check to see if the 'where' keyword exists
Ejemplo n.º 3
0
    <li><a href="logout.php">Logout</a></li>       
  </ul> 
  
  
<hr style="border: 4px double #ccc;" />

            <div class="col-md-6">
             <h2>Update Username</h2>
             
              
             <hr>
              <form role="form" action="settings.php" method="post" >
              <div class="form-group">
                <label for="username">Username:</label>
                <input type="text" class="form-control" value="<?php 
$result = dbRowSelect('users', " WHERE id = 1 ");
while ($row = mysql_fetch_array($result)) {
    echo $row['username'];
}
?>
" name="username" required>
              </div>
            
             <button type="submit" name="update_username_btn" class="btn btn-primary">Submit</button>
            </form>
            
            </div>
            
            <div class="col-md-6">
             <h2>Change Password</h2>
             <hr>
Ejemplo n.º 4
0
<?php

require_once 'includes/connection.php';
require_once 'includes/session.php';
//form login submitted
if (isset($_POST['login_btn'])) {
    //form variables
    $username = trim(mysql_prep($_POST['username']));
    $password = md5($_POST['pwd']);
    $result = dbRowSelect('users', " WHERE username = '******' and password='******' ");
    $row = mysql_fetch_array($result);
    if ($row > 0) {
        //User Found
        $_SESSION['username'] = true;
        redirect_to("index.php");
    } else {
        //User Not Found
        $error_login = true;
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <title>ToDo</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="css/bootstrap.min.css">
  <script src="js/jquery.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
</head>