Jump to content

Elusid

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Elusid's Achievements

Member

Member (2/5)

0

Reputation

  1. I changed the permissions to 777 and also then the comments/ should have worked because it was in the same folder as the file I was reading...
  2. Ok so i recently found some code on this site http://tjw.org/discust/ that lets you have a comment system. I downloaded it, installed it on the server, and ran it... ok great then they said that you can change the defalt location to something out side your temp folder. Here is the code to inc it all together... [code]<?php session_start(); $_SESSION["DISCUST_USER"] = "testing"; require("discust.php"); $discust = new discust("/tmp/discust_test"); $discust->display(); ?>[/code] I did the same thing but replaced /tmp/discust_test with /comments/ and comments/ and /comments... none of them worked. I have the folder on the server. If I did the comments/ one it would let me get through all the form stuff but when I hit post I got this. "Warning: fopen(comments/): failed to open stream: Is a directory in /home/www/flamelicker.com/test/discust.php on line 106 ERROR: could not write comments/" any ways here's what the whole code is... [url=http://tjw.org/discust/discust.phps]http://tjw.org/discust/discust.phps[/url]
  3. Ok so I solved the problem on my own. It ends up that the "i" needed a $ because it's a variable woops... so here is the code that writes the file to the right place. [code] <?php $dir = 'reviews/'; $review = $_POST['review']; for ($i=0;$i<1000;$i+=1) {     if (!file_exists($dir . $i+'')) { $file = fopen($dir . $i . '.txt', "a+");   fwrite($file, $review); break;}} fclose($file); echo "<meta http-equiv='refresh' content='2;url=http://flamelicker.com/commentsuccess.html'>"; ?>[/code] but now I have another problem. It's suposed to make the first text file writen in the folder 1 then 2 then 3 and so on. Only problem right now is that it makes file 0.txt which is right butn then I go to make a file again with this code and it's SUPOSED to make a file 1.txt but it just adds to 0.txt... what's wrong with this code?
  4. Ok so I am trying that right now. I assume you wanted 'DOCUMENT_ROOT' to be replaced with a URL so this is what I have now. [code] <?php $review = $_POST['review']; $dir = $_SERVER['http://flamelicker.com/media/wips/tds/'] .'/reviews';   for ($i=0;$i<1000;$i+=1) {    if (!file_exists($dir . i+'')) { $file = fopen($dir . i+'', "a");   fwrite($file, $review);break;}} fclose($file); echo "<meta http-equiv='refresh' content='2;url=http://flamelicker.com/commentsuccess.html'>"; ?>[/code] EDIT and no it still writes to the root and now reviews/
  5. So here is my code [code] <?php $review = $_POST['review']; $dir = 'reviews/';   for ($i=0;$i<1000;$i+=1) {    if (!file_exists($dir . i+'')) { $file = fopen($dir . i+'', "a");   fwrite($file, $review);break;}} fclose($file); echo "<meta http-equiv='refresh' content='2;url=http://flamelicker.com/commentsuccess.html'>"; ?> [/code] and it's writing to the root directory and not reviews/ what's wrong with it?
  6. Ok thanks. Yeah if any one can point me to a place that has this type of system then please tell me. I am off to the freelance forum too haha.
  7. Arg... well then could someone make it for me :) I could offer something like a subdomain and affiliation :P
  8. Which I can't do... I know practicly no PHP... I have seen it before. Basicly I want this type of system (see the bottom) http://www.freewebs.com/resi_fan-fic/games.htm
  9. Yes I have tryed google dugh. I am looking for one that is free... and besides what do I search? Comment and rating system? That turns back a bunch of crap. Can someone please just point me in the right direction?
  10. Does any one know where I can find a comment and rating system that lets someone post a comment allong with a rating and it will show their message on that page as well as add what they rated it. I really need to find one of these. Thanks!
  11. Yes it just displays this <h1>Registration Failed</h1> <p>We're sorry, but an error has occurred and your registration for the username <b><? echo $uname; ?></b>, could not be completed.<br> Please try again at a later time.</p> but if I do the die command with it == insted of !== it displays it just fine when the passwords are the same...
  12. Hmmmm nope I still get the error message that this file makes if something goes wrong... here is the full file and the only things that are changed basicly all that is changed from the origonal which can be found here http://evolt.org/article/comment/17/60265/index.html is this [code]     if(!$_POST['user'] || !$_POST['pass'] || !$_POST['passcon']){       die('You didn\'t fill in a required field.');     } if($_POST['pass'] !== $_POST['passcon']){ die("This is just a test");} [/code] and this [code] <tr><td><input type="password" name="passcon" maxlength="30"></td></tr> [/code] Other then that it's all the same so somthing is going wrong... The origonal works great! But this... [code]<? session_start(); function usernameTaken($username){   global $conn;   if(!get_magic_quotes_gpc()){       $username = addslashes($username);   }   $q = "select username from users where username = '$username'";   $result = mysql_query($q,$conn);   return (mysql_numrows($result) > 0); } function addNewUser($username, $password){   global $conn;   $q = "INSERT INTO users VALUES ('$username', '$password')";   return mysql_query($q,$conn); } function displayStatus(){   $uname = $_SESSION['reguname'];   if($_SESSION['regresult']){ ?> <html> <body bgcolor='000000' text='ffffff' link='ff0000' vlink='880000'> <h1>Registered!</h1> <p>Thank you <b><? echo $uname; ?></b>, your information has been added to the database, you may now <a href="main.php" title="Login">log in</a>.</p> </body> </html> <?   }   else{ ?> <html> <body bgcolor='000000' text='ffffff' link='ff0000' vlink='880000'> <h1>Registration Failed</h1> <p>We're sorry, but an error has occurred and your registration for the username <b><? echo $uname; ?></b>, could not be completed.<br> Please try again at a later time.</p> </body> </html> <?   }   unset($_SESSION['reguname']);   unset($_SESSION['registered']);   unset($_SESSION['regresult']); } if(isset($_SESSION['registered'])){ ?> <html> <title>Registration Page</title> <body> <? displayStatus(); ?> </body> </html> <?   return; } if(isset($_POST['subjoin'])){         if(!$_POST['user'] || !$_POST['pass'] || !$_POST['passcon']){       die('You didn\'t fill in a required field.');     } if($_POST['pass'] !== $_POST['passcon']){ die("This is just a test");}     $_POST['user'] = trim($_POST['user']);   if(strlen($_POST['user']) > 30){       die("Sorry, the username is longer than 30 characters, please shorten it.");   }     if(usernameTaken($_POST['user'])){       $use = $_POST['user'];       die("Sorry, the username: <strong>$use</strong> is already taken, please pick another one.");   }     $md5pass = md5($_POST['pass']);   $_SESSION['reguname'] = $_POST['user'];   $_SESSION['regresult'] = addNewUser($_POST['user'], $md5pass);   $_SESSION['registered'] = true;   echo "<meta http-equiv=\"Refresh\" content=\"0;url=$HTTP_SERVER_VARS[PHP_SELF]\">";   return; } else{ ?> <html> <title>Registration Page</title> <body bgcolor='000000' text='ffffff' link='ff0000' vlink='880000'> <h1>Register</h1> <form action="<? echo $HTTP_SERVER_VARS['PHP_SELF']; ?>" method="post"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr><td>Username</td></tr> <tr><td><input type="text" name="user" maxlength="30"></td></tr> <tr><td>Password</td></tr> <tr><td><input type="password" name="pass" maxlength="32"></td></tr> <tr><td>Re-type Password</td></tr> <tr><td><input type="password" name="passcon" maxlength="30"></td></tr> <tr><td colspan="2" align="right"><input type="submit" name="subjoin" value="Join!"></td></tr> </table> </form> </body> </html> <? } ?>[/code]
  13. Why does this work if($_POST['pass'] == $_POST['passcon']){ die("This is just a test");} but not this if($_POST['pass'] != $_POST['passcon']){ die("This is just a test");} or if($_POST['pass'] == !$_POST['passcon']){ die("This is just a test");} or if($_POST['pass'] <> $_POST['passcon']){ die("This is just a test");}
  14. Well I will look on the server I am useing. It's actually a hositng service in Europe and they use Linux would that cause any probs?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.