| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| New Member Join Date: May 2005
Posts: 3
![]() | New to PHP - and don't get this.... I'm going to make a page where i register documents and then lists them on a page to easy access. I use a form (<input type="FILE"....) to register the document and into the database (MySql) it looks fine. (I:\IT\Brukerbeskrivelser\passord.doc) Then when i'm going to show this on a page and make a link, the link looks like: I://IT//Brukerbeskrivelser//passord.doc - and this will ofcource not work. Does anyone know what I have not learned in PHP yet... Why do i get the extra "/"? and how does i get rid of it? Hope someone have a easy answer to this.. and if this is basic in the world of PHP, i'm sorry i asked... |
| |
| | #3 (permalink) |
| NamePros Regular Join Date: Jun 2004
Posts: 563
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | You are getting the double slashes because the magic_quotes() setting is ON. Basically, what this does is escape special characters in any form field. All you need to do is call stripslashes() on the field name. For example, if you have this: <input type=file name=fn> Then in your PHP code, do this: $_POST[fn] = stripslashes($_POST[fn]); That SHOULD eliminate the extra slashes. -Bob
__________________ Want a way to monitor your website against hacking? Check out CrossCheck.net |
| |
| | THREAD STARTER #4 (permalink) | ||||
| New Member Join Date: May 2005
Posts: 3
![]() | Thanks! This was the solution of my problem! Should i keep the magic_quotes_gpc setting in php.ini ON, or could i set it OFF without major problems elsewhere? RoH
| ||||
| |
| | #7 (permalink) |
| Domains my Dominion Join Date: Aug 2005 Location: Web 1.0
Posts: 9,963
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Magic quotes are the bane of PHP. It is highly recommended not to depend on those settings. If you port your script to another server they may not work anymore or misbehave. Always stripslash whenever needed.
__________________ NameNewsletter.com - free lists of available domain names ZoneFiles.net (beta) - ccTLD and gTLD droplists |
| |