Wrox Programmer Forums
|
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143
This is the forum to discuss the Wrox book Beginning PHP 6, Apache, MySQL 6 Web Development by Timothy Boronczyk, Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz; ISBN: 9780470391143
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 11th, 2011, 08:44 AM
Registered User
 
Join Date: Jul 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default In chapter-16 frm_admin.php some code in book missing

hey frnds,
File header.php is included in code of chapter-16 frm_admin.php. but this file is not given anywhere in book.
Don't know where to get code of header.php

Code:
<?php
require_once 'header.php';
?>
<script type="text/javascript">
function delBBCode(id) {
    window.location = 'frm_transact_admin.php?action=deleteBBCode&b=' + id;
}
function delForum(id) {
    window.location = 'frm_transact_affirm.php?action=deleteForum&f=' + id;
}
</script>
<?php
$sql = 'SELECT
        access_lvl, access_name
    FROM
        frm_access_levels
    ORDER BY
        access_lvl DESC';
$result = mysql_query($sql,'MYSQL_DB') or die(mysql_error('MYSQL_DB'));

while ($row = mysql_fetch_array($result)) {
    $a_users[$row['access_lvl']] = $row['access_name'];
}

$menuoption = 'boardadmin';
if (isset($_GET['option'])) $menuoption = $_GET['option'];

$menuItems = array(
    'boardadmin' => 'Board Admin',
    'edituser' => 'Users',
    'forums' => 'Forums',
    'bbcode' => 'BBcode');
echo '<p>|';
foreach ($menuItems as $key => $value) {
    if ($menuoption != $key) {
        echo '<a href="' . $_SERVER['PHP_SELF'] . '?option=' . $key. '">';
    }
    echo ' ' . $value . ' ';
    if ($menuoption != $key) {
        echo '</a>';
    }
    echo '|';
}
echo '</p>';

switch ($menuoption) {
case 'boardadmin':
?>
<h2>Board Administration</h2>
<form method="post" action="frm_transact_admin.php">
 <table>
  <tr>
   <th>Title</th>
   <th>Value</th>
   <th>Parameter</th>
  </tr>
<?php
    foreach ($admin as $key => $value) {
        echo '<tr>';
        echo '<td>' . $value['title'] . '</td>';
        echo '<td><input type="text" name="' . $key . '" value="' . 
            $value['value'] . '" size="60" /></td>';
        echo '<td>' . $key . '</td>';
        echo '</tr>';
    }
?>
 </table>
 <p><input type="submit" name="action" id="Update" value="Update" /></p>
</form>
<?php
    break;
  
case 'edituser':
?>
<h2>User Administration</h2>
    <div id="users">
<form action="frm_transact_admin.php" method="post">
 <div>
  <label for="userlist">Please select a user to manage:</label>
  <select id="userlist" name="userlist[]">
<?php
    foreach ($a_users as $key => $value) {
        echo '<optgroup label="' . $value . '">' . user_option_list($db, $key) .
            '</optgroup>';
    }
  ?>
  </select>
  <input type="submit" name="action" value="Modify User"/>
 </div>
</form>
<?php
    break;

case 'forums':
?>
<h2>Forum Administration</h2>
<table>
 <tr><th colspan="3">Forum</th></tr>
<?php
    $sql = 'SELECT
            id, forum_name, forum_desc
        FROM
             frm_forum';
    $result = mysql_query($sql, $db) or die(mysql_error($db));
    while ($row = mysql_fetch_array($result)) {
        echo '<tr>';
        echo '<td>' . $row['forum_name'] . '<br/>' . $row['forum_desc'] . '</td>';
        echo '<td><a href="frm_edit_forum.php?forum=' .$row['id'] .
            '">Edit</a></td>';
        echo '<td><a href="#" onclick="delForum('. $row['id'] .
            '); return false;">Delete</a></td>';
        echo '</tr>';
    }
?> 
</table>
<p><a href="frm_edit_forum.php">New Forum</a></p>
<?php
    break;

case 'bbcode':
  ?>
<h2>BBcode Administration</h2>
<form method="post" action="frm_transact_admin.php">
 <table>
  <tr>
   <th>Template</th>
   <th>Replacement</th>
   <th>Action</th>
  </tr>
<?php
    if (isset($bbcode)) {
        foreach ($bbcode as $key => $value) {
            echo '<tr>';
            echo '<td><input type="text" name="bbcode_t' . $key . '" value="' .
                $value['template'] . '" size="32"/></td>';
            echo '<td><input type="text" name="bbcode_r' . $key . '" value="' .
                $value['replacement'] . '" size="32"/></td>';
            echo '<td><input type="button" name="action" id="DelBBCode" ' .
                'value="Delete" onclick="delBBCode(' . $key .
                '); return false;"/></td>';
            echo '</tr>';
        }
    }
?>
  <tr>
   <td><input type="text" name="bbcode-tnew" size="32"/></td>
   <td><input type="text" name="bbcode-rnew" size="32"/></td>
   <td><input type="submit" name="action" id="AddBBCode" value="Add New"/></td>
  </tr>
 </table>
 <p><input type="submit" name="action" id="Update" value="Update BBCodes"/></p>
</form>
  <?php
    break;
}

require_once 'frm_footer.inc.php';
?>

Plz help ....anyone has working code of frm_admin.php





Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing Code in book dspearing BOOK: Ivor Horton's Beginning Visual C++ 2008 ISBN: 978-0-470-22590-5 3 March 6th, 2010 06:49 PM
Chapter 16 Error? - Missing RTrim wrozyboy BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 0 February 18th, 2010 09:12 PM
Problem with book code of Chapter 16 legendofzelda2000 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 6 July 13th, 2005 02:12 PM
Chapter 16 missing sample code bruceaj VB.NET 2002/2003 Basics 3 June 18th, 2003 08:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.