Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 41

Thread: djr33's php message board

  1. #11
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Haha, my message board....
    I suppose... more of just comments, though.

    You need to have a storage system for the data.

    If you have a free site, wonderful. Enjoy. You get what you pay for, though, generally.

    find a better one, or find, really, like $2 each month to pay for something.


    You can use cookies without server side stuff, but that is only for one user.. you're pretty much stuck.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. #12
    Join Date
    Mar 2006
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

    Default

    Ok I got it to work Here:
    http://benslayton.110mb.com/index.php
    But the comments aren't showing up.

  3. #13
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    The php source was changed and the name of the text document now doesn't match the one being created.

    OR there's an error in the php code because of some lack of functionality on your server. For example, there may be a restriction against modifying files with php.
    One of my hosting accounts doesn't allow php to send emails. Weird, but up to the host, I suppose.

    Since you can't view php source except through access to the server, I can't know what's wrong.

    Not really sure what to say...


    Would you duplicate all three files on your server and rename them ".phps" so the source can be viewed?
    (index.php>index.phps)
    But leave the originals too... so you can fix them when we figure out what's wrong.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #14
    Join Date
    Mar 2006
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

    Default

    The codes are directly copied and pasted from the original fourm.

  5. #15
    Join Date
    Mar 2006
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

    Default

    Index.php
    Code:
    <html>
    <head>
    <title>Comment Demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <div align="center"> 
      <p><font size="+1">Comments Demo:</font></p>
      <table width="80%" border="1" cellspacing="0" cellpadding="5">
        <tr>
          <td align="left">
              <?php
                   if ($file = @file_get_contents("comments.phpdata")) {
                    echo $file."\n";
                    }
                else {echo "Sorry, but no comments were found.";}
            ?>
          </td>
        </tr>
      </table>
      <p><a href="add.php">Add Comment</a></p>
    </div>
    </body>
    </html>
    Add.php
    Code:
    <html>
    <head>
    <title>Add Comment Demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <div align="center"> 
      <p><font size="+1">Add Comment Demo:</font></p>
    <form name="form1" method="post" action="sent.php">
        Name: <input name="name" type="text"> -- Email: <input name="email" type="text"><br>
        <textarea name="comment" cols="60" rows="10"></textarea><br>
        <input type="submit" value="submit"> - <input type="reset" value="reset">
        </form>
        <a href="index.php">Back</a>
    </div>
    </body>
    </html>
    sent.php
    Code:
    <?php
    $filename = "comments.phpdata";
    if ($name = stripslashes($_POST['comment'])) {
        $comment = str_replace("<","&lt;",$comment); //security
        $comment = str_replace(">", "&gt;", $comment); //security
        if ($email = stripslashes($_POST['email'])) {
            $email = str_replace("<","&lt;",$email); //security
            $email = str_replace(">", "&gt;", $email); //security
            $email = "<a href=\"mailto:".$email."\">".$email."</a>";
            }
        else {
            $email = "(No Email supplied.)";
            }
        $name = stripslashes($_POST['name']);
        $name = str_replace("<","&lt;",$name); //security
        $name = str_replace(">", "&gt;", $name); //security
        if (!$name) {
            $name = "<i>Anonomous</i>";
            }
        $hr = "";    
        if (strlen(@file_get_contents($filename)) > 0) $hr = "\n<hr>";
        $add = $hr."Posted by: <b>".$name."</b> -- ".$email."<br>".$comment;
        $comments = @file_get_contents($filename).$add;
        $file = @fopen($filename, "w+");
        @fwrite($file, $comments);
        @fclose($file);
        $message = "Your comment was successfully added.<br>Redirecting to index.php";
        }
    else {
        $message = "You either entered no data or it was entered incorrectly.<br>Redirecting to index.php";
        }
    ?>
    <html>
    <head>
    <title>Comment Added Demo</title>
    <meta http-equiv="refresh" content="3;url=index.php">
    </head>
    <body>
    <div align="center"> 
    <p><font size="+1">Comment Added Demo:</font></p>
    <?php echo $message; ?>
    </div>
    </body>
    </html>
    the free server I have used is specifically for php.

  6. #16
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    No changes?

    then there's a compatibility issue.

    Hmm.... I'm not sure what's going wrong.

    Make a new file, put it in that directory, called "test.php".
    Add the following and upload:
    PHP Code:
    <?php
    echo php_version();
    file_get_contents("index.php") or echo "problem with file_get_contents\n";
    $file fopen("index.php""w+") or die("problem with fopen");
    fclose($file);
    echo 
    "fopen ok";
    ?>
    Just want to find what gives errors.. those are random guesses at problems... we'll see if they work. If they do, it's something else. It'll also check php version so we can see if there's an issue with a new/old version of php.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #17
    Join Date
    Mar 2006
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

    Default

    Here it is...test.php

    It does nothing...

  8. #18
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    er.... try this...

    PHP Code:
    <?php
    die("PHP WORKS");
    ?>
    This host is screwed up.
    (Paste everything in the code box, including the last line)
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #19
    Join Date
    Mar 2006
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

    Default

    Ok done that.

    It says "PHP Works".

  10. #20
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Umm.... no clue, then.

    That just verifies that php functions, but the above code can't be blank... it would give errors if nothing else.

    Try this:

    <?php
    phpinfo();
    ?>

    EDIT: had php_info first... it's phpinfo... probably the same with phpversion above.

    Try that code and also try:
    <?php
    echo phpversion();
    file_get_contents("index.php") or echo "problem with file_get_contents\n";
    $file = fopen("index.php", "w+") or die("problem with fopen");
    fclose($file);
    echo "fopen ok";
    ?>



    by the way, gotta run... back later.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •