Exemplo n.º 1
0
<?php

define('_MEXEC', 'OK');
require_once "../../system/load.php";
$action = $_REQUEST['action'];
switch ($action) {
    case "viewCategory":
        viewCategory();
        break;
    case "addCategory":
        addCategory();
        break;
    case "updateCategory":
        updateCategory();
        break;
    case "deleteCategory":
        deleteCategory();
        break;
}
function viewCategory()
{
    $category = new Category();
    $data = $category->getAllCategoryPaginated($_REQUEST['page']);
    $count = $category->getAllCategoryCount();
    viewTable($data, $count[0]['count']);
}
function addCategory()
{
    $category = new Category();
    $category->setValues($_REQUEST);
    if ($category->newCategory()) {
Exemplo n.º 2
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;
  }
?>