Esempio n. 1
0
    global $dbi;
    $now = date( "M, d Y @ h:i a" );
    sql_query( "insert into jones_blog_comment values( null, '$blog_entry_id', '$name', '$email', '$subject', '$body', '$now' )", $dbi );
    Header( "Location: blog.php?cmd=readAll&id=$blog_entry_id" );
  }

	set_error_handler("myErrorHandler");
	
  if( isSet( $_GET['cmd'] ) )
  	$cmd = $_GET['cmd'];
  else if( isSet( $_POST['cmd'] ) )
  	$cmd = $_POST['cmd'];
  else
  	$cmd = "";

  switch( $cmd ) {
    case "viewCategory":
      viewCategory( $_GET['id'] );
      break;
    case "readAll":
      readAll( $_GET['id'] );
      break;
    case "postComment":
      postComment( $_POST['blog_entry_id'], $_POST['name'], $_POST['email'], $_POST['subject'], $_POST['body'] );
      break;
    default:
      main( );
      break;
  }
?>
Esempio n. 2
0
<?php

include "functions.php";
readAll();
include "includes/headear.php";
?>
  

    <div class="container">
      <div class="row">

        <div class="col-md-12">
          <h1>READ</h1>
          
           <?php 
while ($row = mysqli_fetch_assoc($result)) {
    ?>

                  <pre>
                      <?php 
    print_r($row);
    ?>
                  </pre>

                  <?php 
}
?>


        </div>
Esempio n. 3
0
            }
            echo insertNoti($from, $fname, $to, $msg, $type, $post_id, $extra);
            break;
        case "read":
            // http://armymax.com/api/noti/noti.php?a=list&user_id=22
            $notiId = $_REQUEST["noti_id"];
            echo read($notiId);
            break;
        case "readAll":
            $userId = $_REQUEST["user_id"];
            if (isset($_REQUEST["timestamp"])) {
                $timestamp = $_REQUEST["timestamp"];
            } else {
                $timestamp = now();
            }
            echo readAll($userId, $timestamp);
            break;
        case "delete":
            // http://armymax.com/api/noti/noti.php?a=list&user_id=22
            $notiId = $_REQUEST["noti_id"];
            echo deleteNoti($notiId);
            break;
    }
}
function read($notiId)
{
    $db = notiDbConnect();
    $sql = "UPDATE message SET readed = 1 WHERE id = {$notiId}";
    $res = $db->query($sql);
    if ($res) {
        return json_encode(array('status' => "1"));