Welcome to Geeklog, Anonymous Monday, December 05 2022 @ 10:11 pm EST

Geeklog Forums

Suggestion block error, need troubleshooting advice


Status: offline

jordydme

Forum User
Full Member
Registered: 11/03/05
Posts: 135
Hi,

I have installed a suggestion box which appears to be working well on my site:
here however, there is a small problem. when a suggestion is submitted, the confirmation appears and states that your message was successfully submitted but unfortunatley another message follows 3 seconds later that says "Error please try agian." There is nothing in my error log pertaining to this. There is no whitespace in my lib-custom. The emails do in fact get sent to me. The block seems to work graeat but the user thinks the suggestion was not submitted successfully.

This is the readme file that came with the block:

Text Formatted Code

-----------------
Suggestion Box-------www.gxblock.com
--------------------------

    Simply this block allows users to give you insight to what they'd like to see on your website without having to go through a long email form. This file contains two scripts and this readme file.

-suggest.txt
-suggest.php


1.  Upload suggest.php to your geeklog public_html directory.

2.   Add the function in suggest.txt to your lib-custom.php file located in the geeklog /system directory. Upload that file back into your geeklog system directory.

3. Login and click the link that says 'Blocks' on the Admin Block. On the Block Manager click 'New Block'. In the Block editor...

                [Block Editor]

Block Title:
-Insert whatever you want the Block to be called. I use Suggest Box.
...
Block Name:
-You can use SuggestBox
...
Block Type:
-Select 'PHP Block' from the option box.
...
PHP Block Options
Block Function:
-Insert phpblock_suggest in the Block Function field.

Then scroll back up and click save. Go back to your homepage. When you scroll down you should see your new suggestion box. If you have any questions, email me at sdaystorm@charter.net and I'd be glad to help. Enjoy! NOTE: In the updated version you can change the message that displays in the function in suggest.txt by changing the $message variable.

 


Here is the code for the sugestion box that I pasted in my Lib-custom:
Text Formatted Code

//begin suggestion block
function phpblock_suggest(){
   global $_TABLES, $_CONF, $_USER;
   $message="Want to send us some quick feedback about this site?";
   $siteurl = $_CONF['site_url'];  
   $display .="<CENTER>";
   if($_USER['username'] != ''){
   $display .="<B>$_USER[username], $message<B><BR>";
   }elseif($_USER['username'] == ''){
   $username = 'Guest';
   $useremail = 'anonymous@anonymous.com';
   $display .="<B>Hello Guest, $message<B><BR>";
   }
   if($_USER['username'] != ''){
        $result = DB_query("SELECT * FROM {$_TABLES['users']} WHERE username = '{$_USER['username']}'");
        $U = DB_fetchArray($result);
                $username = "$U[username]";
                $useremail = "$U[email]";
                if($useremail == ''){
                  $useremail = 'anonymous@anonymous.com';
                }
    }
   $display .="<FORM ACTION="$siteurl/suggest.php" METHOD="POST">";
   $display .="<TEXTAREA ROWS="3" COLS="15" NAME="suggest">

 


This is the suggest.php file that I uploaded to my public geeklog direstory:

Text Formatted Code

<?php
   include('lib-common.php');
   global $_CONF;  
   $email="anonymous@anonymous.com";
   $adminemail = $_CONF['site_mail'];
   // Suggestion Box phpBlock created by Mr.GxBlock of http://www.gxblock.com Please don't remove this message.    
   echo COM_siteHeader();
   if($suggest != ''){
     if(strlen($suggest) < 10){
          echo COM_startBlock('Error');
          printf("Please go back and enter insert at unique message with at least 10 characters.");
          echo COM_endBlock();
          echo COM_siteFooter(true);
          exit();
          }
         if($suggest == '$textareamessage'){
          echo COM_startBlock('Error');
          printf("Please go back and enter insert at unique message with at least 10 characters.");
          echo COM_endBlock();
          echo COM_siteFooter(true);
          exit();
          }
          $suggest = str_replace(array(">", "<",""", "&"), array(">","<", "\"", "&"), $suggest);
          $suggest = stripslashes($suggest);
          $suggest = COM_checkWords($suggest);
      mail
      (
      "$adminemail",
      "From Your Suggestion Box - A New Request",
      "Name : $username from $REMOTE_ADDR
       Email : $useremail
       Note:
       $suggest
       ",
       "From: $useremail\n"
      );
         echo COM_refresh($HTTP_REFERER);
         echo COM_startBlock('Your suggestion has been proccessed');
         printf("Thank you $username, you are now being transferring back to previous page. You may also <A HREF=\"$HTTP_REFERER\">click here</A>.");
         echo COM_endBlock();
         echo COM_siteFooter(true);
         exit();
   }else{
         echo COM_startBlock('Error');
         printf("Please try again.");
         echo COM_endBlock();
         echo COM_siteFooter();
         exit();
   }
 ?>

 



Any help would be appreciated.
 Quote

All times are EST. The time is now 10:11 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content