MyBB Community Forums

Full Version: Completely screwed up...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
Can you paste all the file please. Use "[code]" when posting it please.
Ok, now I'm getting these errors:

Quote:Warning: main(./inc/cash_mod.php): failed to open stream: No such file or directory in /home/pokejung/public_html/forums/upload/newreply.php on line 16

Fatal error: main(): Failed opening required './inc/cash_mod.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/pokejung/public_html/forums/upload/newreply.php on line 16

v.v;;
<html>
<head>
<title>CashMod SQL Install v 0.1.0</title>
</head>
<body>
<?php
$file_name = 'CashMod_sql_install_v0_1_0.php';
$mod_name = "CashMod v 0.1.0";

if(!isset($_GET['lock']) && !isset($_GET['fin'])){
   echo 'Would you like to close your forum whilst you update it? (will have option to unlock at the end)<br/>';
   echo '<a href="' . $file_name . '?lock=1">Yes</a><br/>';
   echo '<a href="' . $file_name . '?lock=0">No</a><br/>';
   exit();
}


require "./global.php";

if(isset($_GET['fin']) && $_GET['fin'] == "1"){
   $sql_lock = "UPDATE `" . TABLE_PREFIX . "settings` SET value='no' WHERE name = 'boardclosed'";
   if($result = $db->query($sql_lock)){
      echo "<em>Opened forums</em>";
   }
   else{
      echo "<em>Could not open forums</em>";
   }
   echo '<p>&nbsp;</p>';
   echo "Thank you for installing " . $mod_name . "!<br/>";
   exit();
}
if($_GET['lock'] == "1"){
   $sql_lock = "UPDATE `" . TABLE_PREFIX . "settings` SET value='yes' WHERE name = 'boardclosed'";
   if($result = $db->query($sql_lock)){
      echo "<em>Closed forums</em>";
   }
   else{
      echo "<em>Could not close forums</em>";
   }
   echo '<p>&nbsp;</p>';
}
////////////////
$sql = "ALTER TABLE `" . TABLE_PREFIX . "adminoptions` ADD `canmanagecashmod` VARCHAR(3) DEFAULT 'yes' NOT NULL";
if($result = $db->query($sql, 1)){
   echo "Altered table " . TABLE_PREFIX . "adminoptions<br>";
}
else{
   echo "Could not alter table " . TABLE_PREFIX . "adminoptions<br>";
   $error = TRUE;
}
////////////////
$sql = "ALTER TABLE `" . TABLE_PREFIX . "forums` ADD `cash_value` DECIMAL( 9, 2 ) DEFAULT '-1.00' NOT NULL";
if($result = $db->query($sql, 1)){
   echo "Altered table " . TABLE_PREFIX . "forums<br>";
}
else{
   echo "Could not alter table " . TABLE_PREFIX . "forums<br>";
   $error = TRUE;
}
////////////////
$sql = "ALTER TABLE `" . TABLE_PREFIX . "users` ADD `cash` DECIMAL( 9, 2 ) DEFAULT '0.00' NOT NULL";
if($result = $db->query($sql, 1)){
   echo "Altered table " . TABLE_PREFIX . "users<br>";
}
else{
   echo "Could not alter table " . TABLE_PREFIX . "users<br>";
   $error = TRUE;
}
////////////////
$sql = "INSERT INTO `" . TABLE_PREFIX . "settinggroups` (gid, name, description, disporder) VALUES(NULL, 'Cash Mod', 'You can control the settings for the cash mod here', 1)";
if($result = $db->query($sql, 1)){
   echo "Inserted cash mod setting category<br>";
   $sql = "SELECT gid FROM " . TABLE_PREFIX . "settinggroups WHERE name = 'Cash Mod'";
   $query = $db->query($sql);
   $result = $db->fetch_array($query);
   $setting_id = $result['gid'];
////////////////
   $sql = "INSERT INTO `" . TABLE_PREFIX . "settings` (sid, name, title, description, optionscode, value, disporder, gid) VALUES(NULL, 'cash_mod_active', 'Cash mod active?', 'If you turn the cash mod off, noone will get cash when they post', 'yesno', 'no', 1, " . $setting_id . ");";
   if($result = $db->query($sql, 1)){
      echo "Inserted setting: Cash active<br>";
   }
   else{
      echo "Could not insert setting: Cash active<br>";
      $error = TRUE;
   }
////////////////
   $sql = "INSERT INTO `" . TABLE_PREFIX . "settings` (sid, name, title, description, optionscode, value, disporder, gid) VALUES(NULL, 'cash_mod_character', 'Cash per character (default)', 'This setting is used as a global default for your forums. You can assign each forum a different cash value if you so wish', 'text', '1.00', 2, " . $setting_id . ");";
   if($result = $db->query($sql, 1)){
      echo "Inserted setting: Value/character<br>";
   }
   else{
      echo "Could not insert setting: Value/character<br>";
      $error = TRUE;
   }
////////////////
   $sql = "INSERT INTO `" . TABLE_PREFIX . "settings` (sid, name, title, description, optionscode, value, disporder, gid) VALUES(NULL, 'cash_mod_round', 'Round currency?', 'This will round any decimal values. Useful if you just want currency in whole numbers', 'yesno', 'no', 3, " . $setting_id . ");";
   if($result = $db->query($sql, 1)){
      echo "Inserted setting: Round value<br>";
   }
   else{
      echo "Could not insert setting: Round value<br>";
      $error = TRUE;
   }
////////////////
   $sql = "INSERT INTO `" . TABLE_PREFIX . "settings` (sid, name, title, description, optionscode, value, disporder, gid) VALUES(NULL, 'cash_mod_name', 'Cash name', 'Name of currency/cash', 'text', 'Gold:', 4, " . $setting_id . ");";
   if($result = $db->query($sql, 1)){
      echo "Inserted setting: Cash name<br>";
   }
   else{
      echo "Could not insert setting: Cash name<br>";
      $error = TRUE;
   }
////////////////
   $sql = "INSERT INTO `" . TABLE_PREFIX . "settings` (sid, name, title, description, optionscode, value, disporder, gid) VALUES(NULL, 'cash_mod_finished', 'Posted message', 'This is the string that will appear when you have posted a message.<br/>(%s is used to signify the number)', 'text', 'You have received %s gold', 5, " . $setting_id . ");";
   if($result = $db->query($sql, 1)){
      echo "Inserted setting: Reply string<br>";
   }
   else{
      echo "Could not insert setting: Reply string<br>";
      $error = TRUE;
   }
}
else{
   echo "Could not insert cash mod setting category<br>";
   $error = TRUE;
}
////////////////
$sql = "SELECT template FROM `" . TABLE_PREFIX . "templates` WHERE title = 'postbit'";
if($result = $db->query($sql, 1)){
   echo "Found postbit template in " . TABLE_PREFIX . "templates table<br>";
   $row = $db->fetch_array($result);
   $template = $row['template'];

   $before_string = '$lang->postbit_posts $post[postnum]<br />';
   $replace_string = "\n" . '$settings[cash_mod_name] $post[cash]<br />';

   $str_pos = strpos($template, $before_string);
   if($str_pos){
      $template_finish = str_replace($before_string, $before_string . $replace_string, $template);
      if($template_finish){
         echo "Was able to find and insert cash mod value in postbit<br/>";
         $sql_template = "UPDATE `" . TABLE_PREFIX . "templates` SET template='" . $template_finish . "' WHERE title = 'postbit'";
         if($result = $db->query($sql_template, 1)){
            echo "Updated " . TABLE_PREFIX . "templates table.<br/>";
         }
         else{
            echo "Could not update " . TABLE_PREFIX . "templates table.<br/>";
            $error = TRUE;
         }
      }
      else{
         echo "Was unable to find or insert cash mod name in postbit<br/>";
         $error = TRUE;
      }
   }
   else{
      echo "Could not locate right place to insert currency<br/>";
      $error = TRUE;
   }
}
else{
   echo "Could not find postbit template in " . TABLE_PREFIX . "templates table<br>";
   $error = TRUE;
}
////////////////
////////////////
if(!$error){
   echo '<strong><font size="+2">The database has been successfully changed.</font></strong>';
}
else{
   echo "<em>You have encountered errors whilst trying to update the database.</em>";
}

if($_GET['lock'] == 1){
   echo '<p>&nbsp</p>';
   echo '<p>&nbsp</p>';
   echo "Would you like to open your forums again?<br/>";
   echo '<a href="' . $file_name . '?fin=1">Yes</a><br/>';
   echo '<a href="' . $file_name . '?fin=0">No</a><br/>';
}
else{
   echo '<p>&nbsp;</p>';
   echo "Thank you for installing " . $mod_name . "!<br/>";
   exit();
}
?>
</body>
</html>

I had it in the wrong directory. But now I'm getting the errors I just posted >>;
I think I know why. Its to go in the root directory, not the inc/ folder?
Ok, I did. But now I get the following:

Quote:Warning: Cannot modify header information - headers already sent by (output started at /home/pokejung/public_html/forums/upload/CashMod_sql_install_v0_1_0.php:6) in /home/pokejung/public_html/forums/upload/inc/functions.php on line 1428

Warning: Cannot modify header information - headers already sent by (output started at /home/pokejung/public_html/forums/upload/CashMod_sql_install_v0_1_0.php:6) in /home/pokejung/public_html/forums/upload/inc/functions.php on line 1429

Warning: Cannot modify header information - headers already sent by (output started at /home/pokejung/public_html/forums/upload/CashMod_sql_install_v0_1_0.php:6) in /home/pokejung/public_html/forums/upload/inc/functions.php on line 1430

Warning: Cannot modify header information - headers already sent by (output started at /home/pokejung/public_html/forums/upload/CashMod_sql_install_v0_1_0.php:6) in /home/pokejung/public_html/forums/upload/inc/functions.php on line 1431
Could not alter table pokejung_adminoptions
Could not alter table pokejung_forums
Could not alter table pokejung_users
Inserted cash mod setting category
Inserted setting: Cash active
Inserted setting: Value/character
Inserted setting: Round value
Inserted setting: Cash name
Inserted setting: Reply string
Found postbit template in pokejung_templates table
Was able to find and insert cash mod value in postbit
Updated pokejung_templates table.
You have encountered errors whilst trying to update the database.


Thank you for installing CashMod v 0.1.0!
Hmm. This mod needs a serious re-write! Go ask the creator of it for some assistance.
>>; OK. I already PM'd him about it ...
I really don't know what the problem is.....
I can't make the readme file more clear.... maybe I could but that's besides the point... >_>

Warning: main(./inc/cash_mod.php): failed to open stream: No such file or directory in /home/pokejung/public_html/forums/upload/newreply.php on line 16
Means you didn't upload the cash_mod.php file to the inc/ folder. Just for saying, $file_name is initalised a few lines up.

/forums/upload/CashMod_sql_install_v0_1_0.php
Why is there an upload folder? I'm guessing you uploaded the whole contents of the mybb zip to your server? If that's the case then ok. If not, then the CashMod_sql_install_v0_1_0.php should be in the ROOT of your forum directory.

I think the problem lies in the functions.php file.
function pageheaders() {
   global $settings;
   if($settings['sendheaders'] == "yes")
   {
      header("HTTP/1.0 200 OK");
      header("HTTP/1.1 200 OK");
      header("Content-type: text/html");
   }

   if($settings['nocacheheaders'] == "yes" && $settings['sendheaders'] != "yes")
   {
      header("Expires: Sat, 1 Jan 2000 01:00:00 GMT");
      header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
      header("Cache-Control: no-cache, must-revalidate");
      header("Pragma: no-cache");
   }
}
Basically, I haven't set any settings to say "Look, don't send any header information. I want control". I'm guessing that in your admin CP, you've told it to send expiration headers or the like? I'd say turn it off whilst you install it, and then turn it back on.
To be truthful, I had no idea about this function lying there, and I'm not sure which other modders do Wink


If you don't have any other mods, I'd suggest reuploading the files, and I'll talk your through how to get rid of any changes to the DB that have occured. I've not had any other people email problems to me so I'm guessing my mail server bounces or it is this send headers problem.
Upload is my root directory ^.^

OK, it most have installed now that I put cash_mod.php back now >>; The settings are in the ACP. Still more problems though:


Could not alter table pokejung_adminoptions
Could not alter table pokejung_forums
Could not alter table pokejung_users



That's part of what I got in the installation message >>; If it can't alter it, how'd it get installed?!

Here's the rest:

Inserted cash mod setting category
Inserted setting: Cash active
Inserted setting: Value/character
Inserted setting: Round value
Inserted setting: Cash name
Inserted setting: Reply string
Found postbit template in pokejung_templates table
Was able to find and insert cash mod value in postbit
Updated pokejung_templates table.
[B]You have encountered errors whilst trying to update the database.[/B]

 
Thank you for installing CashMod v 0.1.0!

Ok, now back to the Admin CP, the options are a bit wacky. I have four of each question in the options! -.-;;

BTW- I did everything the instructions told me to do >>; The cash_mod.php had been deleted because I was trying to find out my my board wasn't working.
Ok. To get everything fixed for admin CP (and presumably the template has been changed quite a lot for the postbit, ie when viewing a topic). Go to
Admin CP->Change->Manage settings (button at top, NOT modify settings).
You can delete the surplus settings here.

It seems strange that those tables haven't been altered....
Ah. I think you are gettings errors for those tables because the physical table has been altered. Rather than just adding rows (which is why you are getting so many options in admin CP), those tables need the columns to be altered. I don't think that's a worry because the columns are already in the db I think.

EDIT: Basically, the forums should be working apart from the admin cp with the information provided. As I said above, make sure your template entitled 'postbit' doesn't have too many occurences of the cash mod. This makes the "Gold: xx" appear under their avatar. If you have too many then go to
Admin CP->Templates->Modify/Delete->Default Templates->Expand->Postbit Templates->Expand->Postbit->Edit
and delete a few of the lines that contain $post[cash]
Pages: 1 2 3 4 5