File: fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch12_Projects/blog_edit.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch12_Projects/blog_edit.php  >  Download  
File: fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch12_Projects/blog_edit.php
Role: Example script
Content type: text/plain
Description: Example script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change:
Date: 1 month ago
Size: 765 bytes
 

Contents

Class file image Download
<?php
require_once("blog_config.php");

if (
$_REQUEST["submit"]) {
   
$content = mysql_escape_string(strip_tags($_REQUEST["content"],
                         
"<a><i><b><img>"));
   
$teaser = substr(strip_tags($content), 0, 80);
   
$title = mysql_escape_string(strip_tags($_REQUEST["title"]));
   
$category = mysql_escape_string(strip_tags($_REQUEST["category"]));
   
$q = "INSERT INTO blog_entries
             (title, content, category, teaser, entry_time)
      VALUES ('
$title', '$content', '$category', '$teaser', now())";
   
mysql_query($q, $connection) or die(mysql_error());
   
$id = mysql_insert_id($connection);
   
header("Location: blog_display.php?ID=$id");
} else {
   
$smarty->assign("title", "blog: post an entry");
   
$smarty->display("blog_edit.tpl");
}
?>

For more information send a message to info at phpclasses dot org.