-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
in_array always returning false, when it should be true?
PFMaBiSmAd replied to cyberkiller's topic in PHP Coding Help
You should remove duplicates in $results['info'] BEFORE you start processing the data - array_unique Where is $results['info'] coming from, because there may be a better way of doing this? -
A) It's HTTP:X_FORWARDED_FOR (yes it matters) B) Does your proxy server set the X_FORWARDED_FOR header so that doing this will even work? What HTTP headers does your proxy set? C) If you provided information about which ip address/range should be permitted and which should be blocked, someone can probably help you. D) Is there some reason you aren't using a real login/authentication system to prevent unauthorized access?
-
You are using IIS7. There is a different set of conditions to get it to work - All this information is in the php.net documentation. There's no need to switch your operating system, unless you want to.
-
^^^ Do you happen to know which web server you are running and if php is running as an Apache Module or as a CGI application?
-
noob needs help.. no errors, but code not functioning
PFMaBiSmAd replied to phpnoob123's topic in PHP Coding Help
That's in the <form> tag. All the does is give your form a name. <input class="button" type="submit" name="submit" value="Submit"> -
noob needs help.. no errors, but code not functioning
PFMaBiSmAd replied to phpnoob123's topic in PHP Coding Help
Your form does not have a field named submit, so your code is never being executed because if(isset($_POST['submit'])) { will never be TRUE. Fix your form so that it actually contains a form field with name='submit' -
Since you didn't post the code that produces (reproduces) the symptom so that someone can see what you are actually doing, best guess is you aren't using the 4th parameter in the setcookie() function call and the cookie is only available in the same path where it was set.
-
DavidAM told and showed you in his post how you would change $C1. However, you should NOT be making a series of numbered variables to hold individual data arrays. You should be directly storing that data as an array of arrays (the $S array, using index values that identify which data set it belongs to.) If you post what you are really trying to do (where the data is coming from and where you are trying to put the results) you will get to the final solution quicker.
-
Ummm. Clearly that prevented your code on your page from executing fully, either directly due to fatal runtime errors (functions on longer being defined), or indirectly because you altered the remainder of the code on the page somehow. It would take seeing all the code that produces/reproduces the the symptom in order to be able to specifically help you (in programming that is rarely one answer that fits every situation, without knowing exactly what that situation is.)
-
Prepared statements and slashes ... Please advise.
PFMaBiSmAd replied to jtorral's topic in PHP Coding Help
With prepared statements, an 's' field type will be escaped for you, so you would not use mysql_real_escape_string() on the data. strip_tags() has nothing to do with sql injection and it would be up to how you are using the data if you need to use strip_tags() on it. -
Error: Cannot send session cache limiter - headers already sent
PFMaBiSmAd replied to hedgehog90's topic in PHP Coding Help
^^^ Line 3005 of your class.phpmailer.php is outputting something to the browser. What is at line 3005 in that file? -
Prepared statements and slashes ... Please advise.
PFMaBiSmAd replied to jtorral's topic in PHP Coding Help
Are the \ characters actually in the data in the database table (when you look directly using your favorite database management tool) or only when you retrieve the data? Which database class you are using in your code? Any chance you are calling some filter/clean function that is also escaping the data? -
HELP - Inserting two same variables into the same row of DB
PFMaBiSmAd replied to spaceman12's topic in PHP Coding Help
There's really no way that the error you posted came from the query you are posting. -
HELP - Inserting two same variables into the same row of DB
PFMaBiSmAd replied to spaceman12's topic in PHP Coding Help
Without the whole query that is part of, it's kind of impossible to help you. -
To operate on the actual elements of the array $S, you need to use a reference (otherwise $cluster is a copy of the data) - foreach ($S as &$cluster) You could also use the foreach ($S as $key => $cluster) syntax and then use the $key to modify $S directly - $S[$key][0] = $number;
-
If the script is in the document root folder and the paths stored in the database are relative to the document root folder, just using the saved path in the unlink() statement should work. In this case, there should be no leading slash / on the path you put into the unlink() statement.
-
@sooner, since is_file() does not work with a HTTP URL, like unlink does not work with a HTTP URL, your code will produce the same exact error.
-
Can't connect to mysql DB from PHP code on localhost
PFMaBiSmAd replied to MiRed's topic in PHP Coding Help
The server only reads the files in the document root folder that it has been configured to use. It does sound however like what you are seeing in the browser is a cached version of the page and that changes to the php source are not taking effect immediately. Try forcing your browser to refresh the page and see if that causes the expected output. How did you obtain and install your local development system? Are there any .htaccess files present that could be modifying the cache settings (either that the web server is doing or that the browser is doing?) Is there a server side byte-code cache present, such as APC? -
Unlink expects the file system path to the file, not a URL to the file. It would probably be better if you stored the file system path (relative to your document root folder) in the database without the http://www.mysite.com as part of it so that if you ever change domains, you don't need to change the data (in those cases where you need to output a link, you can prepend the http://www.mysite.com to the data before you output the link.) You are also apparently using eval() for this code, which is rarely needed. Why are you using eval()?
-
Can't connect to mysql DB from PHP code on localhost
PFMaBiSmAd replied to MiRed's topic in PHP Coding Help
If you are still getting an error message, posting it and the relevant code would be the best way of getting help. Your code should not generate ANY error messages during its normal execution, for a few reasons - 1) Each statement in your code that generates an error takes 10-20 times longer to execute than if the statement was error free. The error message that gets displayed or logged is just the final stage of the error response code. Even if the error_reporting/display_errors/log_errors settings hide the error messages, php must still handle each error as it occurs. 2) The errors are likely getting logged and code that regularly generates a long list of error messages every time it executes quickly produces a multi-gigabyte error log file. 3) Code that regularly generates a long list of error messages every time it executes makes finding actual problems harder, such as when you make a typo in a variable name or on a live site when a hacker starts trying to break into your code by feeding it all kinds of unexpected data. You want to get error messages for UNEXPECTED things so that you can find and fix what is causing the problem. You don't want a score of error messages every time you execute your code just because your code has fixable problems in it. -
Is this really this simple? html purifier
PFMaBiSmAd replied to fortnox007's topic in Other Libraries
Yes, that's how you would use a method of a class. If the code is completely secure, would require seeing the code in the class. I have seen login code, email form validation code, ... that claims to be the ultimate 'secure' code and someone went to a lot of work to produce a lot of lines of code in it, but the code contains either intentional or accidental holes in it (makes me think that some of the free code that obviously took a lot of effort to write was actually written and posted by hackers.) -
Can't connect to mysql DB from PHP code on localhost
PFMaBiSmAd replied to MiRed's topic in PHP Coding Help
Those are actually notices (you will likely see notice, warning, fatal runtime, or fatal parse error messages) and the exact wording of the error message and the code that produces the error is important. If the code that BlueSkyIS posted didn't change the error message at all, then it is likely you didn't save the code change to the actual file running on the server or you have a similar error on a line number close to the previous line with an error. -
PHP w/XML n00b. Fatal Error loading XML
PFMaBiSmAd replied to ins0mniac_74's topic in PHP Coding Help
I'm wondering what lines 1-9 are that could be causing the code to run for 30 seconds. -
Can't connect to mysql DB from PHP code on localhost
PFMaBiSmAd replied to MiRed's topic in PHP Coding Help
Actually the best place would be in the same place where you are setting error_reporting to what it currently is (so that you don't need to keep putting the setting into your code.) You should be doing this on a local development system and the best place to set this is in your master php.ini (stop and start your server to get any changes made to the master php.ini to take effect.) -
You need to use Fields enclosed by "