Closed Thread
Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: [REQ][300] Need someone to finish up a comment box script

  1. #1
    Wizet's Avatar
    Wizet is offline x10 Elder Wizet is an unknown quantity at this point
    Join Date
    May 2008
    Location
    Brooklyn, New York.
    Posts
    644

    [REQ][300] Need someone to finish up a comment box script

    I just need someone to help me finish a commenting box script. The comment box can be found on the "new additions" link. http://mfhome.us.to

  2. #2
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: [OFF][300] Need someone to finish up a comment box script

    Do you have any code to work off of or is it all being built from the ground up? I can build one for you if you need it built.

    Also, do you have a defined table for the comments? What other features do you want? Do you want an email address to accompany every post, a time stamp (kinda a given though). I can build a simple basic one real quick if you want basics...

    PS. I've noticed that you switched from SMF to phpBB. Have you ever heard of Pun/FluxBB? it's very easy to integrate, and an excellent piece of forum software. I'm using it on my website, and it's very, I repeat, very easy to modify, given the fact you've got PHP experience (which unfortunately, by the looks of it, not much...)

  3. #3
    Wizet's Avatar
    Wizet is offline x10 Elder Wizet is an unknown quantity at this point
    Join Date
    May 2008
    Location
    Brooklyn, New York.
    Posts
    644

    Re: [OFF][300] Need someone to finish up a comment box script

    HTML Code:
    <!-- HTML codes by Quackit.com -->
    <form action="/html/tags/html_form_tag_action.cfm" method="post">
      Comments:<br />
      <textarea name="comments" id="comments">
      Hey... say something!
      </textarea><br />
      <input type="submit" value="Submit" />
    </form>
    <p style="font-family:verdana,arial,sans-serif;font-size:10px;"><a href="http://www.quackit.com/html/codes/comment_box_code.cfm">Comment Box</a></p>
    That is the code. And yes i Don't have any experience in php whatsoever.

  4. #4
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: [REQ][300] Need someone to finish up a comment box script

    Sorry about the late response. I didn't want to leave XP because of Google Chrome, and linux is where I develop everything.

    Try this:
    PHP Code:
    <?php
    mysql_connect
    ("localhost""cpuser_dbuser""password"); //practice placing your db information in a non web-accessible directory
    mysql_select_db("cpuser_dbname"); // such as the parent directory of public_html (your home directory) 
    if ($_POST['add_comment']) {
        if (!empty(
    $_POST['comments']) && !empty($_POST['email']) && !empty($_POST['name'])) {
            
    $comments mysql_real_escape_string($_POST['comments']);
            
    $email mysql_real_escape_string($_POST['email']);
            
    $name mysql_real_escape_string($_POST['name']);
            
    $time time();
            
    $result mysql_query("INSERT INTO comments (id, comments, email, name, time) VALUES(NULL, $comments$email$name$time)");
            if (
    $result) {
                echo 
    'Comment Posted<br /><br />
                Click <a href="http://forums.x10hosting.com/marketplace/?">here</a> to return'
    ;
            }
        } else {
            echo 
    'You Forgot a Field<br /><br />
            Click <a href="javascript:history.go(-1)">here</a> to return'
    ;
        }
    } else {
    ?>
    <form action="?submit" method="post">
      Comments:<br />
      <textarea name="comments">
      Hey... say something!
      </textarea><br />
      Name: <input name="name" type="text" /><br />
      Email (hidden): <input name="email" type="text" /><br /><br />
      <input type="submit" value="Submit" name="add_comment" />
    </form>
    <?php
    }
    ?>
    I'll be back with the SQL code for a one click db install ;).

    [EDIT]
    Back, just go to the database you want this table in, click SQL on the top nav, and copy/paste this in the box
    Code:
     CREATE TABLE `comments` (
    `id` INT( 3 ) NOT NULL AUTO_INCREMENT ,
    `comments` VARCHAR( 255 ) NOT NULL ,
    `email` VARCHAR( 255 ) NOT NULL ,
    `name` VARCHAR( 255 ) NOT NULL ,
    `time` INT( 10 ) NOT NULL ,
    PRIMARY KEY ( `id` )
    ) ENGINE = MYISAM
    If something doesn't work right, let me know. I haven't tested it, although I should, but I'm confident in the code
    -xP
    Last edited by xPlozion; 09-03-2008 at 08:45 PM. Reason: there's your mysql code

  5. #5
    Wizet's Avatar
    Wizet is offline x10 Elder Wizet is an unknown quantity at this point
    Join Date
    May 2008
    Location
    Brooklyn, New York.
    Posts
    644

    Re: [REQ][300] Need someone to finish up a comment box script

    [quote by xploxzon]Sorry about the late response. I didn't want to leave XP because of Google Chrome, and linux is where I develop everything.

    Try this:
    PHP Code:
    HTML Code:
    [PHP]<?php
    mysql_connect("localhost", "cpuser_dbuser", "password"); //practice placing your db information in a non web-accessible directory
    mysql_select_db("cpuser_dbname"); // such as the parent directory of public_html (your home directory) 
    if ($_POST['add_comment']) {
        if (!empty($_POST['comments']) && !empty($_POST['email']) && !empty($_POST['name'])) {
            $comments = mysql_real_escape_string($_POST['comments']);
            $email = mysql_real_escape_string($_POST['email']);
            $name = mysql_real_escape_string($_POST['name']);
            $time = time();
            $result = mysql_query("INSERT INTO comments (id, comments, email, name, time) VALUES(NULL, $comments, $email, $name, $time)");
            if ($result) {
                echo 'Comment Posted<br /><br />
                Click <a href="http://forums.x10hosting.com/marketplace/?">here</a> to return';
            }
        } else {
            echo 'You Forgot a Field<br /><br />
            Click <a href="javascript:history.go(-1)">here</a> to return';
        }
    } else {
    ?>
    <form action="?submit" method="post">
      Comments:<br />
      <textarea name="comments">
      Hey... say something!
      </textarea><br />
      Name: <input name="name" type="text" /><br />
      Email (hidden): <input name="email" type="text" /><br /><br />
      <input type="submit" value="Submit" name="add_comment" />
    </form>
    <?php
    }
    ?>[/PHP]
    [/quote]

    Where do I put this?
    Last edited by Wizet; 09-03-2008 at 09:37 PM.

  6. #6
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: [REQ][300] Need someone to finish up a comment box script

    the php code you would put in the page that you want to have the comment box on. I don't know where you want the comments results at, but I'll do that tomorrow, as it's late, and i have to get up early tomorrow.

    -xP

  7. #7
    freecrm's Avatar
    freecrm is offline x10 Elder freecrm is an unknown quantity at this point
    Join Date
    May 2008
    Location
    UK
    Posts
    629

    Re: [REQ][300] Need someone to finish up a comment box script

    All in the same file... - your comment form/insert page.

    This is a good, basic script that can be inserted anywhere in the "body" of the page

    i.e. after

    <body>

    and before

    </body>

    The first two lines of the script are connection parameters.

    The remaining 1st half asks "if something has been put in the form, then insert it into the database. If nothing has been submitted, go to the next half of the page."

    The middle bit checks that all fields have been completed and gives you a warning if they haven't.

    The last half of the script produces the form if nothing has been submitted (by default). This is the bit that you will actually see in your page.

  8. #8
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: [REQ][300] Need someone to finish up a comment box script

    working off of the original code i posted above, this also displays comments above the comment box

    PHP Code:
    <?php
    mysql_connect
    ("localhost""cpuser_dbuser""password"); //practice placing your db information in a non web-accessible directory
    mysql_select_db("cpuser_dbname"); // such as the parent directory of public_html (your home directory) 
    if ($_POST['add_comment']) {
        if (!empty(
    $_POST['comments']) && !empty($_POST['email']) && !empty($_POST['name'])) {
            
    $comments mysql_real_escape_string($_POST['comments']);
            
    $email mysql_real_escape_string($_POST['email']);
            
    $name mysql_real_escape_string($_POST['name']);
            
    $time time();
            
    $result mysql_query("INSERT INTO comments (id, comments, email, name, time) VALUES(NULL, $comments$email$name$time)");
            if (
    $result) {
                echo 
    'Comment Posted<br /><br />
                Click <a href="http://forums.x10hosting.com/marketplace/?">here</a> to return'
    ;
            }
        } else {
            echo 
    'You Forgot a Field<br /><br />
            Click <a href="javascript:history.go(-1)">here</a> to return'
    ;
        }
    } else {
        
    $result mysql_query("SELECT comments, name, time FROM comments ORDER BY id DESC LIMIT 20");
        while (
    $result mysql_fetch_assoc($result)) {
        
    $comment str_replace("\n"'<br />'$result['comments']);
            
    $name $result['name'];
            
    $time_offset = (-5*3600); // If your target base is located in the east-coast (EST -5), then leave alone.  If it's different, then modify -5 to the proper offset
            
    $date date('M j, Y g:i a', ($result['time']+$time_offset)); // For date format information, see http://www.php.net/date
            
    echo '<p>'.$comment.'<br /><strong>By: '.$name.' on '.$date.'</strong></p>';
        }
    ?>
    <form action="?submit" method="post">
      Comments:<br />
      <textarea name="comments">
      Hey... say something!
      </textarea><br />
      Name: <input name="name" type="text" /><br />
      Email (hidden): <input name="email" type="text" /><br /><br />
      <input type="submit" value="Submit" name="add_comment" />
    </form>
    <?php
    }
    ?>

  9. #9
    Wizet's Avatar
    Wizet is offline x10 Elder Wizet is an unknown quantity at this point
    Join Date
    May 2008
    Location
    Brooklyn, New York.
    Posts
    644

    Re: [REQ][300] Need someone to finish up a comment box script

    So you just put the php code in the top of the page right? Im'a test it out first. Maybe it's the way I put it but the code looks all messy with errors and that stuff.
    Last edited by Wizet; 09-04-2008 at 04:04 PM.

  10. #10
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: [REQ][300] Need someone to finish up a comment box script

    OK, looking at your page, your error is that the page is an htm file, when it needs to be a php file. Rename new_additions.htm to new_additions.php . also, put the proper values in the top 2 lines where there's mysql_connect and mysql_select_db.
    Last edited by xPlozion; 09-04-2008 at 04:56 PM.

Closed Thread
Page 1 of 3 123 LastLast

Similar Threads

  1. Comment Box Script
    By dbqclassof2012 in forum Programming Help
    Replies: 10
    Last Post: 09-01-2008, 03:29 PM
  2. How do you create a Comment Box? Script help please
    By pandaxx in forum Programming Help
    Replies: 10
    Last Post: 08-19-2008, 02:15 AM
  3. Access to 300+ PHP scripts (2500 credits)
    By jonathanyaniv in forum The Marketplace
    Replies: 11
    Last Post: 06-03-2008, 10:58 PM
  4. Replies: 8
    Last Post: 12-03-2007, 04:12 PM
  5. Server UP time Script
    By dharmil in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 04-03-2006, 04:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers