| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| DomainersUniversity.com Join Date: Feb 2005 Location: Oswego, NY
Posts: 4,735
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Write FORM data to text file? I'd like to create a form with 3 fields, which will take the contents of each of the 3 fields and store them in a text file. ============================================== Form ============================================== Enter Website URL Here: [_________________] ????: NamePros.com http://www.namepros.com/programming/592866-write-form-data-to-text-file.html Enter Account ID# Here: [_________________] Enter Email Address Here: [_________________] [ SUBMIT ] ============================================== When the user submits that form, the information gets written to a text file containing only this: ============================================== Text file named info.inc ============================================== <?php $weburl = "WebSiteName.com"; $accountid = "12345"; $email = "usersemail@anymailaddress.com"; ?> ============================================== Any time the user goes back to the form above and changes the data in any of the 3 fields, the text file will be overwritten accordingly. Note: The text file will have the CHMOD permission set to 644 so nobody else can write to it. Note: The form will be in a password protected folder. No help needed to create the form and password protected folder. I just need to know how to get the form SUBMIT to overwrite the text file to contain the new form data. Thanks! Gene
__________________ . . Expired Domain Search -- ExpiredDomainBoss.com | Sell Domain Names -- DomainProfitsClub.com ----------------------------------------------------------------------------------------------- |
| | |
| | #3 (permalink) | ||||
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | is it only supposed to hold those 3 pieces of info at one time? (as in different text files for different users). if so, this should work. (untested, written on-the-fly): PHP Code: ????: NamePros.com http://www.namepros.com/showthread.php?t=592866 ????: NamePros.com http://www.namepros.com/showthread.php?t=592866 That should be the action of the form, the inputs should be named "weburl", "accountid", and "email". This is the example text file populated:
Do you need to be worrying about sanitizing your data (incase it will be used for other scripts), because that is VERY open to injections?
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! | ||||
| | |
| | THREAD STARTER #4 (permalink) | ||||||||
| DomainersUniversity.com Join Date: Feb 2005 Location: Oswego, NY
Posts: 4,735
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
---------- Post added at 07:45 AM ---------- Previous post was at 07:43 AM ----------
__________________ . . Expired Domain Search -- ExpiredDomainBoss.com | Sell Domain Names -- DomainProfitsClub.com ----------------------------------------------------------------------------------------------- | ||||||||
| | |
| | #5 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | ![]() (for the $accountid, I'm assuming this is a number?) PHP Code: |
| | |
| | #6 (permalink) | ||||||||
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | sanitizing your input means that, for example, if the user were to put something like
????: NamePros.com http://www.namepros.com/showthread.php?t=592866
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! | ||||||||
| | |
| | THREAD STARTER #7 (permalink) |
| DomainersUniversity.com Join Date: Feb 2005 Location: Oswego, NY
Posts: 4,735
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | I see. Thank you both for your valuable input. Do you have any suggestions on how to accomplish this in a better, more secure way (without using MySQL)?
__________________ . . Expired Domain Search -- ExpiredDomainBoss.com | Sell Domain Names -- DomainProfitsClub.com ----------------------------------------------------------------------------------------------- |
| | |
| | #8 (permalink) |
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | honestly, (if the way i understand it is correct), it may not matter that much. if you are selling a website to a client, then sending that client to a portal page where they will input the information that they want (login/info/accountid), i assume that your clients can be trusted (to the point where COMPLETE sanitization shouldn't be necessary) and that will never be edited/populated again (once it is initially set). i suggest just making sure that magic quotes are enabled in PHP (put <?php phpinfo(); ?> in a php file and go to it on your server, it'll show the config of your server. look for the enable_magic_quotes (or something w/ magic quotes in it) and make sure it's enabled).
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! |
| | |
| | THREAD STARTER #9 (permalink) |
| DomainersUniversity.com Join Date: Feb 2005 Location: Oswego, NY
Posts: 4,735
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
__________________ . . Expired Domain Search -- ExpiredDomainBoss.com | Sell Domain Names -- DomainProfitsClub.com ----------------------------------------------------------------------------------------------- |
| | |
| | #10 (permalink) |
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | The way Eric edited it makes it more secure (since you're validating the input). You shouldn't need to worry about sanitizing the data as much, now. Also, thanks for showing me filter_var, Eric. I had no idea that existed and I've always HATED having to use regexp to validate things. Rep+
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! |
| | |
| | #11 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | PHP 5 has some awesome features |
| | |
| | THREAD STARTER #12 (permalink) |
| DomainersUniversity.com Join Date: Feb 2005 Location: Oswego, NY
Posts: 4,735
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Thanks again to both of you. I guess I've repped you both too much in the past so can't do it again yet, but I sincerely appreciate your help.
__________________ . . Expired Domain Search -- ExpiredDomainBoss.com | Sell Domain Names -- DomainProfitsClub.com ----------------------------------------------------------------------------------------------- |
| | |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Portfolio 4 Sale/Trade Category-Killers, Adult, Traffic, Aged, LLL, LLLLL, Dictionary | Archangel | Domains For Sale - Make Offer | 1 | 05-20-2009 05:18 PM |
| I'll pay $25 to code up a contact form with a php file | helloypi | Web Development Wanted | 7 | 01-05-2008 01:31 AM |
| Need help in reading from a text file in VB | mattonline | Programming | 3 | 07-02-2007 08:33 AM |
| Text file retrieval | Alpha | Programming | 2 | 08-15-2003 01:23 AM |