Jump to content

majocmatt

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Contact Methods

  • AIM
    ESPwarlord
  • Website URL
    http://

Profile Information

  • Gender
    Not Telling

majocmatt's Achievements

Member

Member (2/5)

0

Reputation

  1. I have a simple form here (code that I actually got from someone else), and what I'm doing is retrieving this file from another remote server and showing it in a textarea field. That works lovely. It shows up just fine in the textarea. The problem is when I submit the form, and it tries to connect to the other remote server again, it fails on fopen, fwrite, fclose and ftp_put. What I want to happen is that when you submit, it alters that file on the other server. Here is the code I'm using, followed by the errors I've received. Any ideas why it works when connecting and reading the first time, but then it can't open or write the second pass. I've chmodded the file and every directory in its path to 777. I have gotten this to work, only by moving the file to the root directory, which is pointless for the reasons I need to use it. So, it sounds like a permissions issue, but I've chmodded everything, and even before I did, the directories were set to 755, which should have allowed the file to read. Anyhow.. any ideas? Thank you. <?php $config = array ( 'ftp_user' => '*******', 'ftp_pass' => '*******', 'domain' => 'mydomain.com', 'file' => 'path/to/my/file.txt', ); if(isset($_POST['submit'])) { $fp = fopen($config['file'],'w'); fwrite($fp,stripslashes($_POST['newd'])); fclose($fp); $ftp = ftp_connect($config['domain']); ftp_login($ftp,$config['ftp_user'],$config['ftp_pass']); ftp_put($ftp,$config['file'],$config['file'],FTP_ASCII); ftp_close($ftp); } ?> <form method="post" action="<?=( $_SERVER['PHP_SELF'] )?>"> <textarea name="newd" cols="40" rows="15"><?=( file_get_contents('ftp://'.$config['ftp_user'].':'.$config['ftp_pass'].'@'.$config['domain'].'/'.$config['file']) )?></textarea> <input type="submit" name="submit" value="Save"> </form> Errors received: Warning: fopen(css/8.6.193.84:27015/cstrike/maplist.txt) [function.fopen]: failed to open stream: No such file or directory in /home/thepwned/public_html/test.php on line 13 Warning: fwrite(): supplied argument is not a valid stream resource in /home/thepwned/public_html/test.php on line 14 Warning: fclose(): supplied argument is not a valid stream resource in /home/thepwned/public_html/test.php on line 15 Warning: ftp_put(css/8.6.193.84:27015/cstrike/maplist.txt) [function.ftp-put]: failed to open stream: No such file or directory in /home/thepwned/public_html/test.php on line 19
  2. I have a database full of user input, some users enter in URLs.. when I display this information, I would like to go through the text, look for URLs and turn those into real hyperlinks... so I need to take http://www.whatever.com and make it a real hyperlink. Am I in the right place? If so, how would I go about doing this? I am using php/mysql and I would like to simply wrap a function around, for instance, my $output variable which holds the data retrieved from a user input.
  3. Sorry for the late reply, but thank you both. The Options -Indexes works like a charm, exactly how i needed it
  4. I'm not sure if this is appropriate here, but here goes. I have a website that users can sign up, when they do, it create a photos subdirectory for them according to their unique user id (i.e. photos_271), and then it creates them a thumbnail folder too. All of these user photos folders are in a main 'photos' folder. I would like to block people from seeing all of the photo_userids folders within the photos folder, and all of the sub folders. I don't just want a index.php file because I would need one in every folder thats dynamically generated. Instead, is there a way to not let people directly typing a URL get past anything with a URL prefix of http://www.mydomain.com/photos/ ???
  5. I have a table with date of births and I'm trying to select the next 3 upcoming birthdays and display them. I'm trying to use this ORDER BY clause but it seems not to want to listen to me. Can anyone help me figure out why? ORDER BY DATE_FORMAT('profile_dob', '%m-%d') > DATE_FORMAT(NOW(), '%m-%d') DESC, DATE_FORMAT('profile_dob', '%m-%d') LIMIT 3 Currently, it returns them in no particular order at all.. haha. Here is what I'm getting as the result: Sep 25, May 25, Sep 5, July 1, Sep 21, Mar 18 Any suggestions would be great.. thanks!
  6. I'll assume your just using YYYY-MM-DD, the DATE format in a database. If not, you can adapt your timestamp to the following: Create a variable for $now where $now = date("Y-m-d"); And query the database SELECT * FROM myTable WHERE date >= $now
  7. There's a few things you could do. Firstly, you need to run $_POST['password'], and username if you have one, through $password = mysql_real_escape_string($_POST['password']) Since someone can spoof the session $_SESSION['active'], I would also add the password session upon login: $_SESSION['password'] = $password; and on each page put in the if statement add: if ($_SESSION['active'] != 'TRUE' && !isset($password)) { Also, instead of isset($_POST['submit']), you could add a unique token. On the form you could start a session like $token = mt_rand() and on the processor page, make sure that session is there and the value is the same and it was on the previous page. That's a few ideas
  8. I have a site where I let users input text into my mysql database. I run their inputs through mysql_real_escape_string before I enter it into the DB and on the output I run it through htmlspecialchars. My question is: How can I add the ability for users to add things such as hyperlinks or images when all the <> brackets and such are converted to their entity counterpart? I don't want them to actually be able to input HTML, or scripts, but I would like to give them the freedom to insert hyperlinks and images, that will parse correctly on the viewing page. What's the best way around this?
  9. I have a list of country names in a database that is constantly being updated - countries are being added and deleted. It's for a client, and this is the way it has to be. My problem is getting USA to always be on top of the select dropdown list I populate on the admin page. Is this possible in a query? Can I ORDER BY countries in aplha order then force USA to be on top? I cannot order them by ID because, like I said, countries are coming and going, and it would screw up the order. I just need to know if it's possible in the query to do this? Thanks, Matt
  10. I store as a SQL DATE format (YYYY-MM-DD) ... so if I call something like this: $month_now = date("m"); SELECT * FROM myTable WHERE date > DATEADD(m, -3, $month_now) How do I get it to recognize each entires Month, and display as I listed above?
  11. It doesn't have to be a blog, but how would I go about making a script that grabs entries out of my mysql database by month, like current blogs do? January 2007 December 2006 November 2006 etc,etc I've searched on mysql's website, but i don't really understand how it works, still. I don't even care if there's nothing in one of those months, I would just like to display the last 3 months or so. Any help?
  12. Ok, i will do seperate cookies for each string, however, i dont think sessions alone will work since i want them to be persistent even if they leave and come back later. i realize this wont work if they use a diff computer but im simply trying to minimize the problems
  13. Users are able to vote via text input on my site, but they only are allowed to vote for a certain string once per day, but as many different strings per day as they like. I want to force this by setting cookies, what though, is the best way to do this since there will be multiple strings? One string per cookie or can you set an array of strings in a single cookie? Thanks.
  14. I'm curious to learn how sites, such as this one, track users so precisely. I have a web site that has a large amount of registered users, and most of these users set their login information to be 'remembered' at initial login time. I would like to show users what is new since their last visit, and also, when they surf through the different pages and come back to the 'Whats New' module on the front page, everything isn't gone, just what they have viewed during that session. Now, I think I have a solution to part of this problem I'm facing. Since user's are theoritcally always logged in (remember-me cookie), I think I would just have atop every page a: if -> is not set -> session -> send a query to the database and update the last_viewed field for the user with this instanced timestamp. Then I would compare that time to all the different entities my web site displays (blog, photos, etc) and show what is new. Is this sufficient? The second part of the problem, I do not understand well. How do I then track, only during the current session, what has been viewed from the 'whats new' list? Is this best accomplished via sessions paired with cookies?
  15. cool thanks, i got it thank you all for the valuable input, its much appreciated.
×
×
  • 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.