Login   Register  
PHP Classes
elePHPant
Icontem

File: guestbookadmin.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Frederik Yssing  >  Guestbooks  >  guestbookadmin.php  >  Download  
File: guestbookadmin.php
Role: Example script
Content type: text/plain
Description: the admin partq
Class: Guestbooks
Manage guestbooks or simple blogs using MySQL
Author: By
Last change:
Date: 2012-04-24 17:10
Size: 1,483 bytes
 

Contents

Class file image Download
<?php
    
include_once('guestbook.class.php');
    
// Add your own session logick here
    
session_start();
    
$_SESSION['admin'] = 1;

    if(
$_SESSION['admin']){
        
$guestbookAdmin = new guestbookAdmin();
        
//approve guestbook entry
        
if(isset($_REQUEST['approve']) && isset($_REQUEST['entry']) && isset($_REQUEST['email'])){
            
$guestbookAdmin->approveGuestbook($_REQUEST['entry'],$_REQUEST['email']);
            
header ('location: guestbookadmin.php');
        }        
        
//delete guestbook entry
        
if(isset($_REQUEST['del']) && isset($_REQUEST['entry']) && isset($_REQUEST['email'])){
            
$guestbookAdmin->destroyGuestbook($_REQUEST['entry'],$_REQUEST['email']);
            
header ('location: guestbookadmin.php');
        }    
        
        echo 
"Approved guestbook entries <br />";
        echo 
$guestbookAdmin->displayResults($guestbookAdmin->readAllguestbook(1));
        echo 
"<br />";
        echo 
"Non-approved guestbook entries <br />";    
        echo 
$guestbookAdmin->displayResults($guestbookAdmin->readAllguestbook(0));
    } 
?>

<script type="text/javascript">
    function readGuestbook(id){
        w_left = ((screen.width/2)-(680/2));
        w_top = ((screen.height/2)-(552/2));
        EditWin=window.open("showguestbook.php?id="+id, "EditWin","resizable=1,location=0,scrollbars=1,left="+w_left+",top="+w_top+",width=620,height=300");
        this.EditWin.focus()
    }
    this.focus()
</script>

<a href="createdb.php">Create new DB entry</a><br />
<a href="createdb.php?del=true">Destroy DB entry</a><br />
<a href="guestbook.php">user</a>