|
Posted by Shelly on 07/30/06 11:26
"dawnerd" <dawnerd@gmail.com> wrote in message
news:1154246620.954322.199410@m79g2000cwm.googlegroups.com...
> Here is the page in it's completeness. I removed the logging and other
> stuff to see if it was the cause, and it wasn't. Also, the logging
> script is not open source, well, yet.
>
> <?php
> if( !OJAICMS )
> {
> die("No");
> }
>
> require_once( "functions/newpage.function.php" );
>
> /**
> * update the page?
> */
> if( $_GET["action"] == "update" )
> {
> ///
> /// Planned
> ///
> }
>
> /**
> * Delete the page?
> */
> if( $_GET["action"] == "delete" )
> {
> ///
> /// Planned
> ///
> }
> /**
> * Show the correct breadcrumb and perform some other hacking checks
> */
> if( $_GET["do"] == "edit" )
> {
> $bc = "» Editing Page";
> $do = "edit";
>
> /**
> * Check if the id was passed
> */
> if( $_GET["id"] == "" )
> {
> $error .= "<li>What post do you expect to edit?</li>";
> $do = "list";
> }
> else
> {
> $id = mysql_real_escape_string( htmlspecialchars( trim( $_GET["id"] )
> ) );
> $sql = "SELECT * FROM `pages` WHERE `id` = '$id'";
> $query = $db->query( $sql );
> $num = $db->numrows( $query );
>
> /**
> * Check if the page exists
> */
> if( $num != 1 )
> {
> $error .= "<li>Page does not exist witht that identification
> number</li>";
> $do = "list";
> }
> else
> {
> $row = $db->fetcharray( $query );
> }
> }
> }
> else if( $_GET["do"] == "delete" )
> {
> $bc = "» Deleting Page";
> $do = "delete";
>
> /**
> * Check if the id was passed
> */
> if( $_GET["id"] == "" )
> {
> $error .= "<li>What post do you expect to edit?</li>";
> $do = "list";
> }
> else
> {
> $id = mysql_real_escape_string( htmlspecialchars( trim( $_GET["id"] )
> ) );
> $sql = "SELECT * FROM `pages` WHERE `id` = '$id'";
> $query = $db->query( $sql );
> $num = $db->numrows( $query );
>
> /**
> * Check if the page exists
> */
> if( $num != 1 )
> {
> $error .= "<li>Page does not exist witht that identification
> number</li>";
> $do = "list";
> }
> else
> {
> $row = $db->fetcharray( $query );
> }
> }
> }
> else
> {
> $do = "list";
>
> /**
> * Go ahead and do some sql to grab all pages
> */
> $sql = "SELECT * FROM `pages`";
> $query = $db->query( $sql );
> $num = $db->numrows( $query );
> }
> ?>
> <p><a href="index3.php?page=main">Home</a> » <a
> href="index3.php?page=pagemanager">Page Manager</a> <?php echo $bc;
> ?></p>
> <div id="newpage">
> <h2>Page Manager</h2>
> <?php
> if( $error != "" )
> {
> /**
> * Show the errors if there are any
> */
> ?>
> <div id="error">
> <img src="images/emblem-important.png" alt=" " width="32" height="32"
> />
> <h2>There were errors: </h2>
> <ul><?php echo $error;?></ul>
> </div>
> <?php
> }
> if( $perfect != "" )
> {
> /**
> * Show the success mesasages if any
> */
> ?>
> <div id="perfect">
> <img src="images/emblem-notice.png" alt=" " width="32" height="32" />
> <ul><?php echo $perfect;?></ul>
> </div>
> <?php
> }
>
> /**
> * Show the editing page
> */
> if( $do == "edit" )
> {
>
> }
>
> /**
> * Show the delete confirmation
> */
> else if( $do == "delete" )
> {
>
> }
>
> /**
> * Else, show the list of pages
> */
> else
> {
> /**
> * Check if the page exists
> */
> if( $num <= 0 )
> {
> ?>
> <p>There are no pages to display here.<br />
> To add pages, go to back and click on "Create Page".</p>
> <?php
> }
> else
> {
> ?>
> <table id="page_table" border="0" cellspacing="0" cellpadding="5">
> <tr>
> <td> </td>
> <td> </td>
> <th>Id</th>
> <th>Title</th>
> <th>Slug</th>
> <th>Type</th>
> </tr>
> <?php
> /**
> * Loop through the resultset
> */
> $int = 0;
> while( $row = $db->fetcharray( $query ) )
> {
> if( $int == 0 )
> {
> $class = "page_table1";
> $int++;
> }
> else
> {
> $class = "page_table2";
> $int = 0;
> }
>
> if( $row["type"] == "error" )
> {
> $img = "emblem-important-small.png";
> }
> else
> {
> $img = "text-x-generic.png";
> }
> ?>
> <tr class="<?php echo $class; ?>">
> <td><a
> href="index3.php?page=pagemanager&do=edit&id=<?php echo
> $row["id"]; ?>">
> <img src="images/emblem-unreadable.png" width="16" height="16"
> border="0" /></a></td>
> <td><a
> href="index3.php?page=pagemanager&do=edit&id=<?php echo
> $row["id"]; ?>">
> <img src="images/accessories-text-editor.png" alt="Edit" width="16"
> height="16" /></a></td>
> <td><?php echo $row["id"]; ?></td>
> <td><?php echo $row["title"]; ?></td>
> <td><?php echo $row["slug"]; ?></td>
> <td><img src="images/<?php echo $img; ?>" title="<?php echo
> $row["type"]; ?>" style="float:left;" />
> <?php echo $row["type"]; ?></td>
> </tr>
>
> <?php
> }
> ?>
> </table>
> <?php
> }
> }
>
> /**
> * Do some logging.
> * Note: This was removed as for testing
> */
> ?>
> </div>
>
Where is the <html></html>, <body></body> etc.? I couldn't find it in this
code. You said that this was the complete code. Also, how do you know it
stops after the while loop?
Shelly
Navigation:
[Reply to this message]
|