Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Modules
Author Message
giantmidget
Regular
Regular



Joined: Nov 27, 2005
Posts: 58

PostPosted: Sat Jun 01, 2013 4:28 pm Reply with quote

PLEASE SEE NEW PROBLEM IN SUBSEQUENT POST



Original problem has been fixed. Now I have a new one
EDIT::
Original Problem
I am converting my Fictioneer module to work with MySQLI and I am over my head. It worked fine under MySQL. My first error is below. The line 48 is the query result just below - function FictioneerMain

I believe the fix is something I may have to include in several other files, but I do not know how to fix it initially.

Help would be greatly appreciated.

Call to a member function query() on a non-object in ... Fictioneer/index.php on line 48

Code:
<?php

// File: index.php
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Version For PHPNUKE by Rob wolf visit http://www.tremorsfan.com for the latest version.
// Original Author of file: Rebecca Smallwood
// Fictioneer Updrades to file by Theresa Sanchez and Joyce Melton
// ----------------------------------------------------------------------

if (!preg_match("/modules.php/i", $_SERVER['PHP_SELF'])) {
    die ("You can't access this file directly...");
}

require_once("mainfile.php");


$pagetitle = "- Fictioneer";

$ModName = Fictioneer;
$dontcare = -1;
include("modules/$ModName/config.php");

$module_name = basename(dirname(__FILE__));
get_lang($module_name);

//Intro page

function FictioneerMain()
{
   global $bgcolor1, $bgcolor2, $prefix;
   $result = $mysqli->query("select * from ".$prefix."_fictioneer_settings");
   if($settings = $result->fetch_assoc)
   {
      FictioneerHeader();
      echo "<br><table width=\"100%\">";
      echo "<tr valign=\"top\"><td width=\"60%\">";
      echo "".$settings[welcome]."";
      echo "</td>";
      echo "<td width=\"40%\">";
      echo "<b>Categories</b><br><br>";
      ListCategories();
      echo "<br></td></tr></table>";
      FictioneerFooter();
   }
   else
   {
      echo "This is an error message.";
   }
}

//Header

function FictioneerHeader()
{
   global $bgcolor1, $bgcolor2, $ModName, $sitename, $user, $cookie, $subsoff;
   include("header.php");
   OpenTable();
   if (is_user($user))
   {
      cookiedecode($user);
      $author = $cookie[1];
   }
   echo "<br><table width=\"100%\"><tr><td colspan=\"2\"><center><b>$sitename -- "._FNNAME."</b></center></td></tr>";
   echo "<tr><td>";
   echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"modules.php?name=$ModName&amp;file=index&amp;options=SearchResults&amp;pagenumber=1&amp;searchterm=$searchterm&amp;searchkind=$searchkind&amp;totalpages=-1\">";
   echo "<a href=\"modules.php?name=$ModName&amp;file=index\">Main</a> | ";
   if($subsoff == "1")
      echo "<a href=\"modules.php?name=$ModName&amp;file=index&amp;options=ViewRules\">Add Story</a> | ";
   echo "<a href=\"modules.php?name=$ModName&amp;file=index&amp;options=DisplayStories&amp;pagenumber=1&amp;categoryid=-1&amp;totalpages=-1\">Recent Stories</a> | ";
   if(($subsoff == "1") && (is_user($user)))
      echo "<a href=\"modules.php?name=$ModName&amp;file=index&amp;options=SearchResults&amp;searchterm=".$author."&amp;pagenumber=1&amp;searchkind=author&amp;totalpages=-1\">Your Stories</a> | ";
   echo "<a href=\"modules.php?name=$ModName&amp;file=index&amp;options=Help\">Help</a> | ";

   echo "<select name=\"searchkind\">";
   echo "<option value=\"author\">Author</option>";
   echo "<option value=\"title\">Title</option>";
   echo "<option value=\"keywords\">Keywords</option>";
   echo "<option value=\"summary\">Summary</option>";
   echo "</select>";
   echo "<input type=\"text\" name=\"searchterm\" size=\"10\"> ";
   echo "<input type=\"submit\" name=\"search\" value=\"Search\"> ";
   echo "</form>";
   echo "</td></tr></table>";
   CloseTable();
   OpenTable();

}

//Footer

function FictioneerFooter()
{
   global $bgcolor1, $bgcolor2;
   CloseTable();
   echo "<BR><div align=\"center\">Fictioneer Module 0.5 by <a href=\"http://www.fictioneer.net\">Theresa Sanchez</a>, and <a href=\"http://bigcloset.ateros.com\">Joyce Melton</a></div>";
   echo "<div align=\"center\">Original FanFiction Module by <a href=\"http://orodruin.sourceforge.net\">Rebecca Smallwood</a></div>";
   echo "<div align=\"center\">Version for phpnuke by <a href=\"http://www.tremorsfan.com\">Rob Wolf</a> Dev v0.2</div>";
   include("footer.php");
}

//Helpfile for clueless people

function Help()
{
   global $bgcolor1, $bgcolor2, $ModName;
   FictioneerHeader();
   include ("modules/$ModName/help.txt");
   FictioneerFooter();
}

//listing of all the top level categories

function ListCategories()
{
   global $bgcolor1, $bgcolor2, $prefix, $ModName;
   $result = $mysqli->query("select * from ".$prefix."_fictioneer_categories WHERE parent=-1");
   while($catlist = $result->fetch_assoc)
   {
      echo "<a href=\"modules.php?name=$ModName&amp;file=index&amp;options=DisplayStories&amp;pagenumber=1&amp;categoryid=".$catlist[categoryid]."&amp;totalpages=-1\">".$catlist[category]."</a><BR>";
      echo "".$catlist[description]."<BR><BR>";
   }
}


//this is here so that the admin can view the story without having the header junk and all that

function AdminViewStory($storyid, $author, $title)
{
   global $bgcolor1, $bgcolor2, $prefix, $ModName, $nukeurl, $user, $cookie, $admin;
   $result = $mysqli->query("select * from ".$prefix."_fictioneer_stories WHERE storyid=$storyid");
   $storyresults = $result->fetch_assoc;
   if (is_admin($admin))
   {
      echo "<table width=\"100%\"><tr><td>";
      echo "".$storyresults[title]." by <a href=\"user.php?op=userinfo&uname=".$storyresults[author]."\">".$storyresults[author]."</a></td><td>";
      echo "</td><td align=\"right\">";
      $result = $mysqli->query("select * from ".$prefix."_fictioneer_stories WHERE parentstoryid='$storyresults[parentstoryid]' ORDER by storyid ASC");
      echo "<form name=\"jump\">";
      echo "<select name=\"jumpmenu\" OnChange=\"location.href=jump.jumpmenu.options[selectedIndex].value\">";
      echo "<option>Chapters</option>";
      while ($chapterdisplay = $result->fetch_assoc)
      {
         echo "<option value=\"modules.php?name=$ModName&amp;file=index&amp;options=DisplayStory&amp;storyid=".$chapterdisplay[storyid]."\">$chapterdisplay[title]</option>";
      }
      echo "</select>";
      echo "</form>";
      echo "</td></tr></table>";
      //writes out the story, and replaces the carriage returns with <BR> tags

      $file = "modules/$ModName/stories/$storyresults[author]/$storyresults[storyid].txt";
      $log_file = fopen($file, "r");
      $file_contents = fread($log_file, filesize($file));
      echo(nl2br(htmlspecialchars($file_contents)));
      fclose($log_file);
      echo "<hr>";
      echo "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"modules.php?op=modload&name=Fictioneer&file=index&options=SubmitVauthorStory&amp;storyid=".$storyresults[storyid]."\">";
      echo ""._FNTITLE.": <INPUT type=\"text\" name=\"title\" value=\"$storyresults[title]\"><BR><BR>";
      echo ""._FNKEYWORDS.": <TEXTAREA name=\"keywords\" COLS=40 ROWS=3>".$storyresults[keywords]."</textarea><BR><BR>";
      echo ""._FNSUMMARY.": <TEXTAREA name=\"summary\" COLS=40 ROWS=3>".$storyresults[summary]."</textarea><BR><BR>";
      echo "<INPUT type=\"hidden\" name=\"storyid\" value=\"$storyresults[storyid]\">";
      echo "<INPUT type=\"hidden\" name=\"author\" value=\"$storyresults[author]\">";
      echo "<INPUT type=\"hidden\" name=\"categoryid\" value=\"$storyresults[categoryid]\">";
      echo "<INPUT type=\"hidden\" name=\"parentstoryid\" value=\"$storyresults[parentstoryid]\">";
      echo "<INPUT type=\"hidden\" name=\"ratingid\" value=\"$storyresults[ratingid]\">";
      echo "<INPUT type=\"hidden\" name=\"char1\" value=\"$storyresults[char1]\">";
      echo "<INPUT type=\"hidden\" name=\"char2\" value=\"$storyresults[char2]\">";
      echo "<INPUT type=\"hidden\" name=\"genre\" value=\"$storyresults[genre]\">";
      echo "<INPUT type=\"hidden\" name=\"roundrobin\" value=\"$storyresults[roundrobin]\">";
      echo ""._FNTEXT.": <TEXTAREA wrap=\"virtual\" name=\"story\" COLS=40 ROWS=6>";
      include ("modules/$ModName/stories/$storyresults[author]/$storyresults[storyid].txt");
      echo "</textarea><BR><BR>";
      echo "<INPUT type=\"submit\" name=\"buttonaction\" value=\"Update Story\">";
}
}

//notes for public
//add previous and next 2 pages and have it show what page you're on
//if no results when sorting, have it say so.
//if no results on search, say so
//if no stories by author, say so

//notes for admin
//fix weird e-mail return address
//figure out fatal head error


switch($options)
{
   case "Help":
   Help();
   break;

   case "ViewRules":
   include_once ("modules/$ModName/fn-submitstory.php");
   ViewRules();
   break;

   case "ChooseCategory":
   include_once ("modules/$ModName/fn-submitstory.php");
   ChooseCategory();
   break;

   case "SearchResults":
   include_once ("modules/$ModName/fn-displaystory.php");
   SearchResults($searchterm, $searchkind, $pagenumber, $totalpages);
   break;

   case "SortResults":
   include_once ("modules/$ModName/fn-displaystory.php");
   SortResults($categoryid, $ratingid, $char1, $char2, $genre, $pagenumber, $totalpages);
   break;

   case "SubmitVauthorStory":
   include_once ("modules/$ModName/fn-submitstory.php");
   SubmitVauthorStory($categoryid, $parentstoryid, $title, $keywords, $summary, $story, $ratingid, $char1, $char2, $genre, $author, $email, $roundrobin, $buttonaction, $imgfile, $imgfile_name, $storyid, $unvalidated);
   break;

   case "SubmitUnvalidAuthorStory":
   include_once ("modules/$ModName/fn-submitstory.php");
   SubmitUnvalidAuthorStory($categoryid, $parentstoryid, $title, $keywords, $summary, $story, $ratingid, $char1, $char2, $genre, $author, $roundrobin, $buttonaction, $imgfile, $imgfile_name, $storyid, $unvalidated);
   break;

   case "SubmitStory":
   include_once ("modules/$ModName/fn-submitstory.php");
   SubmitStory($author, $user, $categoryid, $parentstoryid, $roundrobin);
   break;

   case "EditStory":
   include_once ("modules/$ModName/fn-submitstory.php");
   EditStory($storyid, $categoryid);
   break;

   case "DeleteStory":
   include_once ("modules/$ModName/fn-submitstory.php");
   DeleteStory($deleteall, $storyid, $author, $submit, $transmit);
   break;

   case "DisplayStories":
   include_once ("modules/$ModName/fn-displaystory.php");
   DisplayStories($summary, $pagenumber, $categoryid, $totalpages);
   break;

   case "DisplayReviews":
   include_once ("modules/$ModName/fn-reviews.php");
   DisplayReviews($parentstoryid);
   break;

   case "DeleteReviews":
   include_once ("modules/$ModName/fn-reviews.php");
   DeleteReviews($reviewid, $submit);
   break;

   case "SubmitReview":
   include_once ("modules/$ModName/fn-reviews.php");
   SubmitReview($parentstoryid, $submit, $comment, $reviewer, $vote);
   break;

   case "DisplayStory":
   include_once ("modules/$ModName/fn-displaystory.php");
   DisplayStory($storyid, $author, $title);
   break;

   case "AdminViewStory":
   //include_once ("modules/$ModName/fn-submitstory.php");
   AdminViewStory($storyid, $author, $title);
   break;

   case "SendAcceptance":
   include_once ("modules/$ModName/fn-letters.php");
   SendAcceptance($submit, $author, $email, $subject, $yesletter);
   break;

   case "SendNoThankYou":
   include_once ("modules/$ModName/fn-letters.php");
   SendNoThankYou($submit, $author, $email, $subject, $noletter);
   break;

   default:
   FictioneerMain();
   break;
}

?>


Last edited by giantmidget on Sun Jun 02, 2013 8:42 am; edited 1 time in total 
View user's profile Send private message
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1775

PostPosted: Sat Jun 01, 2013 4:52 pm Reply with quote

Add in each function where you are build a sql-query the globals $db and $prefix.

To create a query you need only this one:

Code:
$result = $db->sql_query('SELECT * FROM `' . $prefix . '_fictioneer_settings`');


To call the data use this one:

Code:
$row = $db->sql_fetchrow($result);


Try a look into the file /db/mysqli.php, there you can find all what you need.

http://rnwiki.ravennuke.com/wiki/RavenNuke2:Database_Class

Here a example of your file how i would write it (untested): https://gist.github.com/anonymous/aa5f0165d7658f1c2120

_________________
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message
giantmidget







PostPosted: Sun Jun 02, 2013 9:00 am Reply with quote

Thank you. That gave me enough guidance to fix 90% of my issues and get the module working.

I have two new issues to address.

The first issue is the module is supposed to assign a story number and save it as a text file on the server. It is not naming the new file. It saves it, but without a title. Just .txt and nothing else when it should be something like 5397.txt. The code is the same in a few spots and neither works - meaning neither admin story input or user story input works. If someone can help me with one, I can fix the others.

Here is the code from the section that allows an Admin to input the story:



Code:
//Allows admin to add a story and input any author in that field


function FictioneerAdminAddStory($transmit, $submit, $categoryid, $parentstoryid, $title, $keywords, $summary, $story, $ratingid, $char1, $char2, $genre, $author, $email, $date, $roundrobin)
{
   global $bgcolor1, $bgcolor2, $prefix, $ModName, $db;
   FictioneerAdminHeader();
   if ($submit)
   {
      $db->sql_query("INSERT INTO ".$prefix."_fictioneer_stories (categoryid, parentstoryid, title, keywords, summary, ratingid, char1, char2, genre, author, email, date, updated, roundrobin, unvalidated) VALUES ('$categoryid', '$parentstoryid', '$title', '$keywords', '$summary', '$ratingid', '$char1', '$char2', '$genre', '$author', '$email', now(), now(), '$roundrobin', '$unvalidated')");
      $storytitle = mysql_insert_id();
      if( $parentstoryid )
         $db->sql_query("UPDATE ".$prefix."_fictioneer_stories SET parentstoryid ='$parentstoryid' WHERE storyid='$storytitle'");
      else
         $db->sql_query("UPDATE ".$prefix."_fictioneer_stories SET parentstoryid ='$storytitle' WHERE storyid='$storytitle'");
      $result =  $db->sql_query("select * from ".$prefix."_fictioneer_stories");
        if( !file_exists( "modules/$ModName/stories/$author/" ) )
           mkdir("modules/$ModName/stories/$author", 0777);

        $handle = fopen("modules/$ModName/stories/$author/$storytitle.txt", 'w');

        if ($handle)
        {
            fwrite($handle, stripslashes ($story));
            fclose($handle);
            $story = "";
        }
        else
            $story = "";
      echo "The story has been added.";
      FictioneerFooter();
   }
   else if ($transmit)
   {
      echo "<table><tr><td>";
      echo "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?op=FictioneerAdminAddStory\">";
      echo "<INPUT type=\"hidden\" name=\"unvalidated\" value=\"0\">";
      echo "Author: </td><td><INPUT type=\"text\" name=\"author\" length=\"30\">";
      echo "</td><td>Spaces are not recommended.</td></tr><tr><td>";
      echo "Author's E-mail: </td><td><INPUT type=\"text\" name=\"email\" length=\"30\">";
      echo "</td><td>You <b>must</b> input an author e-mail, if the author is not a member of the site.</td></tr><tr><td>";
      echo "<INPUT type=\"hidden\" name=\"categoryid\" value=\"$categoryid\">";
      $result =  $db->sql_query("select * from ".$prefix."_fictioneer_categories WHERE categoryid=$categoryid");
      $catresults = $db->sql_fetchrow($result);
      echo "Category </td><td>$catresults[category]";
      echo "</td></tr><tr><td>";
      echo "Title: </td><td><INPUT type=\"text\" name=\"title\" length=\"30\"></td><td>";
      echo "If you intend to have multiple chapters for your story, it is recommended that you include the chapter number in the title.</td></tr><tr><td>";
      echo "Keywords:  </td><td><TEXTAREA wrap=\"virtual\" cols=50\" rows=\"2\" name=\"keywords\"></TEXTAREA></td><td>";
      echo "Please include a few keywords and seperate the with spaces.</td></tr><tr><td>";
      echo "Summary: </td><td><TEXTAREA wrap=\"virtual\" cols=50\" rows=\"2\" name=\"summary\"></TEXTAREA></td><td>";
      echo "Please include a one or two sentence summary that describes your story.</td></tr><tr><td>";
      echo "Story Text: </td><td><TEXTAREA wrap=\"virtual\" cols=50\" rows=\"6\" name=\"story\"></TEXTAREA></td><td>";
      echo "Copy and paste your story text here.</td></tr><tr><td>";
      $result2 = $db->sql_query("select * from ".$prefix."_fictioneer_ratings ORDER by ratingid ASC");
      echo " Rating: </td><td><select name=\"ratingid\">";
      while($ratingsdisplay = $db->sql_fetchrow($result2))
      {
         echo "<option value=\"".$ratingsdisplay[ratingid]."\">".$ratingsdisplay[rating]."</option><br><br>";
         $ratingsdisplay++ ;
      }
      echo "</select></td><td ROWSPAN=4>";
      echo "Please fill out the appropriate rating, character and genre information.</td></tr><tr><td>";

      $result3 = $db->sql_query("select * from ".$prefix."_fictioneer_characters WHERE categoryid=$categoryid");
      echo "Character 1: </td><td><select name=\"char1\">";
      while($char1display = $db->sql_fetchrow($result3))
      {
         echo "<option  value=\"".$char1display[characterid]."\">".$char1display[charname]."</option><br><br>";
         $char1display++ ;
      }
      echo "</select></td>";
      echo "</tr><tr><td>";

      $result4 = $db->sql_query("select * from ".$prefix."_fictioneer_characters WHERE categoryid=$categoryid");
      echo "Character 2: </td><td><select name=\"char2\">";
      while($char2display = $db->sql_fetchrow($result4))
      {

         echo "<option  value=\"".$char2display[characterid]."\">".$char2display[charname]."</option><br><br>";
         $char2display++ ;
      }
      echo "</select></td>";
      echo "</tr><tr><td>";

      $result5 = $db->sql_query("select * from ".$prefix."_fictioneer_genres");
      echo "Genre: </td><td><select name=\"genre\">";
      while($genredisplay = $db->sql_fetchrow($result5))
      {

         echo "<option value=\"".$genredisplay[genreid]."\">".$genredisplay[genre]."</option><br><br>";
         $genredisplay++ ;
      }
      echo "</select></td>";
      echo "</tr><tr><td>";
      echo "Roundrobin? </td><td><select name=\"roundrobin\">";
      echo "<option value=\"1\">No</option>";
      echo "<option value=\"0\">Yes</option>";
      echo "</select></td><td>";
      echo "A roundrobin is a story in which other people may add onto what you've written.</td></tr><tr><td COLSPAN=3><center>";
      echo "<BR><INPUT type=\"submit\" name=\"submit\" value=\"Submit Story\"></center>";
      echo "</form>";
      echo "</td></tr></table>";
   }
   else
   {
      echo "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?op=FictioneerAdminAddStory\">";
      echo "<select name=\"categoryid\">";
      echo "<option>Choose a category</option>";
      $result = $db->sql_query("select * from ".$prefix."_fictioneer_categories ORDER by category");
      while($categorychoose = $db->sql_fetchrow($result))
      {
         if ($categorychoose[parent] != "-1")
         {
            $parent = $db->sql_query("select * from ".$prefix."_fictioneer_categories WHERE categoryid='$categorychoose[parent]'");
            $parentname = $db->sql_fetchrow($parent);
            $parentname = $parentname[category]." >>";
         }
         else
            $parentname = "";
         echo "<option value=\"".$categorychoose[categoryid]."\">";
         echo "$parentname $categorychoose[category]";
         echo "</option>";
         $categorychoose++ ;
      }
      echo "</select> ";
      echo "<INPUT type=\"submit\" name=\"transmit\" value=\"Add Story!\">";
      echo "</form>";
   }

   FictioneerFooter();

}




The second problem involves the admin view on story approval. The way this used to work before upgrading to 2.51 RN from 2.10 was that when you click to review it, the entire story was displayed like test on a sheet of paper, and at the bottom it had a number of boxes showing how the story was input. One of those boxes was the text of the story.

Now, when I review this, it does not display a page of text at the top. It skips right to the bottom and just shows the input boxes, which do contain the correct entries.

Here is the section of the code that deals with this:

Code:
function AdminViewStory($storyid, $author, $title)

{
   global $bgcolor1, $bgcolor2, $prefix, $ModName, $nukeurl, $user, $cookie, $admin, $db;
   $result = $db->sql_query("select * from ".$prefix."_fictioneer_stories WHERE storyid=$storyid");
   $storyresults = $db->sql_fetchrow($result);
   if (is_admin($admin))
   {
      echo "<table width=\"100%\"><tr><td>";
      echo "".$storyresults[title]." by <a href=\"user.php?op=userinfo&uname=".$storyresults[author]."\">".$storyresults[author]."</a></td><td>";
      echo "</td><td align=\"right\">";
      $result = $db->sql_query("select * from ".$prefix."_fictioneer_stories WHERE parentstoryid='$storyresults[parentstoryid]' ORDER by storyid ASC");
      echo "<form name=\"jump\">";
      echo "<select name=\"jumpmenu\" OnChange=\"location.href=jump.jumpmenu.options[selectedIndex].value\">";
      echo "<option>Chapters</option>";
      while ($chapterdisplay = $db->sql_fetchrow($result))
      {
         echo "<option value=\"modules.php?name=$ModName&amp;file=index&amp;options=DisplayStory&amp;storyid=".$chapterdisplay[storyid]."\">$chapterdisplay[title]</option>";
      }
      echo "</select>";
      echo "</form>";
      echo "</td></tr></table>";
      //writes out the story, and replaces the carriage returns with <BR> tags

      $file = "modules/$ModName/stories/$storyresults[author]/$storyresults[storyid].txt";
      $log_file = fopen($file, "r");
      $file_contents = fread($log_file, filesize($file));
      echo(nl2br(htmlspecialchars($file_contents)));
      fclose($log_file);
      echo "<hr>";
      echo "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"modules.php?op=modload&name=Fictioneer&file=index&options=SubmitVauthorStory&amp;storyid=".$storyresults[storyid]."\">";
      echo ""._FNTITLE.": <INPUT type=\"text\" name=\"title\" value=\"$storyresults[title]\"><BR><BR>";
      echo ""._FNKEYWORDS.": <TEXTAREA name=\"keywords\" COLS=40 ROWS=3>".$storyresults[keywords]."</textarea><BR><BR>";
      echo ""._FNSUMMARY.": <TEXTAREA name=\"summary\" COLS=40 ROWS=3>".$storyresults[summary]."</textarea><BR><BR>";
      echo "<INPUT type=\"hidden\" name=\"storyid\" value=\"$storyresults[storyid]\">";
      echo "<INPUT type=\"hidden\" name=\"author\" value=\"$storyresults[author]\">";
      echo "<INPUT type=\"hidden\" name=\"categoryid\" value=\"$storyresults[categoryid]\">";
      echo "<INPUT type=\"hidden\" name=\"parentstoryid\" value=\"$storyresults[parentstoryid]\">";
      echo "<INPUT type=\"hidden\" name=\"ratingid\" value=\"$storyresults[ratingid]\">";
      echo "<INPUT type=\"hidden\" name=\"char1\" value=\"$storyresults[char1]\">";
      echo "<INPUT type=\"hidden\" name=\"char2\" value=\"$storyresults[char2]\">";
      echo "<INPUT type=\"hidden\" name=\"genre\" value=\"$storyresults[genre]\">";
      echo "<INPUT type=\"hidden\" name=\"roundrobin\" value=\"$storyresults[roundrobin]\">";
      echo ""._FNTEXT.": <TEXTAREA wrap=\"virtual\" name=\"story\" COLS=40 ROWS=6>";
      include ("modules/$ModName/stories/$storyresults[author]/$storyresults[storyid].txt");
      echo "</textarea><BR><BR>";
      echo "<INPUT type=\"submit\" name=\"buttonaction\" value=\"Update Story\">";
}
}


THANK YOU IN ADVANCE!
 
neralex







PostPosted: Sun Jun 02, 2013 11:01 am Reply with quote

If you are working on a local test system like wamp, xampp etc or on a live page with this module? You can enable the error-reporting in RN to see the errors. But do not enable the errror reporting on a livepage because everyone can see it.

to see all php errors open rnconfig.php find:

Code:
$error_reporting = E_ALL^E_NOTICE;


change it to:

Code:
$error_reporting = E_ALL;


find:

Code:
$loglevel = 0;


change it to:

Code:
$loglevel = 1;


Follow the instructions above and check the file /rnlogs/dblog

But again: Do not enable this options on a livepage. Download better WAMP, install a fresh RN on it and then you can enable all error reportings to check and find all errors. http://www.wampserver.com

Without to know what are you getting is it hard to say what could be wrong because the whole module is very old and have many bugs. You must compare your php-errors with the sql-errors and your database.

Store content-data in a file is not the best practise. Do not create a folder or file with chmod 777. 777 is a bad value because everyone can write on it. Use in every case 755 - more is not needed. I would create a new db-table for the stories and remove the whole file-creating stuff in the module.


Last edited by neralex on Sun Jun 02, 2013 11:43 am; edited 1 time in total 
giantmidget







PostPosted: Sun Jun 02, 2013 11:43 am Reply with quote

I am struggling with it, that's for sure.

My skill level precludes writing anything from completely. This website already has 2000+ stories added with multiple chapters.

I will adjust the settings to 755.

Here are some of my errors from submitting the story.

Code:
Notice: Use of undefined constant Fictioneer - assumed 'Fictioneer' in /home/*******/public_html/phpnuke/modules/Fictioneer/index.php on line 36


Notice: Undefined variable: imgfile in /home/*******/public_html/phpnuke/modules/Fictioneer/index.php on line 237

Notice: Undefined variable: imgfile_name in /home/*******/public_html/phpnuke/modules/Fictioneer/index.php on line 237

Notice: Undefined variable: storyid in /home/*******/public_html/phpnuke/modules/Fictioneer/index.php on line 237

Notice: Constant _USERLOGIN already defined in /home/*******/public_html/phpnuke/modules/Your_Account/language/lang-english.php on line 465
Notice: Undefined variable: email in /home/*******/public_html/phpnuke/modules/Fictioneer/fn-submitstory.php on line 213

Notice: Undefined variable: mysql in /home/*******/public_html/phpnuke/modules/Fictioneer/fn-submitstory.php on line 214

Notice: Trying to get property of non-object in /home/*******/public_html/phpnuke/modules/Fictioneer/fn-submitstory.php on line 214

 
neralex







PostPosted: Sun Jun 02, 2013 12:56 pm Reply with quote

It sounds for me, you have changed some of them and through your changes you have some values destroyed. Compare the error messages with the line-numbers in your files:

1. error - solution for this is in my example

2., 3. and 4. error - find in index:

Code:
switch($options) {

add before, but check also why are the values undefined before you do this:

Code:
if (!isset($imgfile)) $imgfile = '';

if (!isset($imgfile_name)) $imgfile_name = '';
if (!isset($storyid)) $storyid = '';


5th error - open the language file of the module and search:

Code:
define('_USERLOGIN','xxxxx');


change it to:

Code:
if (!defined('_USERLOGIN'))  define('_USERLOGIN','xxxxx');


6. and 7. error same issue as in your first post. You must use the explained way.


Last edited by neralex on Sun Jun 02, 2013 1:08 pm; edited 2 times in total 
giantmidget







PostPosted: Sun Jun 02, 2013 1:04 pm Reply with quote

Thank you.

I'll work out the smaller error issues.

I managed to fix the major issue of generating the text file name.

I had to change it to this -

Code:
mysql_insert_id ()


changed to

$db->sql_nextid($idfield)

() blank will no longer work either, so I added the $idfield
 
neralex







PostPosted: Sun Jun 02, 2013 1:18 pm Reply with quote

At this point i can't no more follow you. I don't know the module and without to know the whole module nobody can help you. It sounds for me, you have changed some of them and through your changes you have some values destroyed. $db->sql_nextid is not really needed but how i have it written, now we come on a point where only you must find a way because only you know that module. To rewrite a whole module like this and to remove your own errors, that can be costs some days. I hope you are working not on a live page...
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Sun Jun 02, 2013 2:21 pm Reply with quote

I remember re-writing this module for a friend who ran a Harry Potter fan club website some years ago but sadly I no longer have the files.
 
View user's profile Send private message Send e-mail
giantmidget







PostPosted: Sun Jun 02, 2013 2:42 pm Reply with quote

It is functional. I still have to work out those "undefined" errors, but that looks to be fairly straight forward, as detailed above.

It may not be the cleanest code anymore, but maybe I'll get some more time out of it.

This all came about due to updating from RN 2.10 to 2.51

Guardian, the website is a Harry Potter fanfiction website. December will make 10 years that it has been up and running. I barely touch it anymore and the traffic has dropped considerably, but I do not intend to let is die as it contains an extremely large collection.

I think this was the first major revision of that module on my end, but I know I've had a lot of help here over the years, there's just too much time in between questions.

Thanks again all. I'm done for the weekend. Need to relax a few hours so I can get back to work tomorrow at my non-technical job.
 
neralex







PostPosted: Sun Jun 02, 2013 4:04 pm Reply with quote

Ok if you want, ZIP me the files of the module, make a dump with the structures of the needed db-tables and put the db-tables also in the ZIP. Send me the data via PM an i will try a look. We should get it ready for RN251. Smile
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©