-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
Going Nuts...Uplload Scipt...File Not allowed!
PFMaBiSmAd replied to kelleyi's topic in PHP Coding Help
When validating user supplied data, it is always a good idea to display the offending value that does not match an expected value so that the visitor can see what the code actually used for a value. In your case, either it is empty because the upload failed and the code is not checking for upload errors before it attempts to access any of the uploaded data or you have a letter case problem where the actual value is .JPG instead of .jpg (code should convert everything to lower case before making a comparison.) -
Images as submit buttons send the x,y coordinates where they were clicked on, per the W3.org specification. See this link how that can be accessed in php code - http://us3.php.net/manual/en/faq.html.php#faq.html.form-image
-
Since that is not actual working code, nor does it contain a sample of the data and what results you are actually getting, it is impossible to tell you what could be causing the symptom. Some guesses - 1) register_globals are on, 2) you only have one value, so all you get is that one/last value in the results.
-
I'll guess (I did a quick search of the php4/5 change log and the bug reports and did not see anything relevant) one of the following - 1) There in a prepended script file (cheap hosting) that is changing the values under certain conditions. 2) Register_globals are ON (which is about the only time I have seen unexpected values in variables when there was no actual code changing the values.) 3) A bad/corrupted build of php or extensions from the wrong version or a patched/hacked php (the Hardened PHP Project.) Are there any other unexplained problems or errors? 4) There is a server module (such as a proxy) that is not supplying an actual IP address to php under some conditions.
-
The per-connection section at the link I posted shows an example query that you would execute after your script makes a connection to the database server.
-
php is a server side scripting language. I'm not sure what you are trying to do, but the editor you are using and all the other web based 'content' editors are client-side browser applications. They simply submit data to the server.
-
Are you sure it is working, because a lot of people's security code does not actually prevent the 'protected' code on the page from being executed while the browser is requesting the new URL due to a redirect. Nope. You would need to log the actual information being generated for the emails (edit: and comment out the line that is actually sending the email) - http://us.php.net/manual/en/function.error-log.php If you include a date/time and the IP address where the page request came from as part of the information you log, you should be able to determine if this is due to your browser making multiple page requests. If these people have supplied their email address and they are receiving duplicates, that would not be considered spamming, unless the email is spam.
-
Also, the code you posted is not checking in any way how or who requested the page, so, anytime the page is requested, by a search engine or some other bot script, it will send emails. You would need to add login/authentication logic to insure that the code on the page only executes when YOU submit or browse to the page.
-
The mysql server is compltely separate from the web server/php. You would need to set the mysql time zone. Unless you have administrative access to the mysql server, you would need to use a per-connection setting - http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html
-
http://us.php.net/manual/en/function.number-format.php or http://us.php.net/manual/en/function.sprintf.php
-
'NULL' is a string containing the characters N, U, L, and L. NULL (no quotes) is the keyword meaning a null value. Remove the single-quotes from around the value or if your intent is to get the database to use the default value for the column, one way would be to simply not list it in the columns/values - $query="INSERT INTO tasks (task_id,task) VALUES ('','$task')";
-
Exporting/Importing mysql data using PHPmyadmin
PFMaBiSmAd replied to waynew's topic in Miscellaneous
Since PHPmyadmin is just a php script, it is subject to the same upload file size, memory limit, and execution time limit settings and restrictions as any other php script. Do you have external/remote access to the database server(s) so that you could use a tool like the Mysql Administrator to perform the backup/restore? http://dev.mysql.com/downloads/workbench/5.2.html -
I doubt that your entire $_POST array is just a list of id's and their prices. Post an example of what data your form submits. You should move the code that is reading the file so that it is before the first foreach() loop. Where it is now causes it to re-read the file on every post value. Your code is not accumulating or adding up the values inside of the conditional test when a match is found. You would need something like - $var += $price; And then $var would be the total at the end of the posted logic.
-
Then it is likely your browser is requesting the page twice. Different browsers do this for different reasons and you can also have some url rewriting that is causing it. FF is the biggest offender because some of the add-on debugging tools cause a page to be requested twice and it used to (I think this bug has been fixed) request a page twice when the default character encoding set in the browser does not match the page encoding. The best general purpose solution is to use a session variable to allow the page to only be processed once per 'browser session', something like this - <?php session_start(); if(isset($_SESSION['oneshot'])){ die('The page has already been requested this browser session.'); } $_SESSION['oneshot'] = TRUE; // the remainder of your code on the page here... ?>
-
Are you only receiving one copy at the "[email protected]" address? Have you examined the list stored in the file to make sure it does not contain duplicates for those members that have indicated they are receiving duplicates?
-
What is your code that is inserting the value into the table? date_default_timezone_set() only affects the php functions that convert into or out of a Unix Timestamp in your php code.
-
Alphabetising removing "The " from the beginning of results
PFMaBiSmAd replied to almightyegg's topic in PHP Coding Help
http://www.arraystudio.com/as-workshop/how-to-sort-mysql-results-ignoring-definite-and-indefinite-articles-the-a-an.html -
Your example implies the need for three columns. Without specific information about what the data is and how it is used, we cannot directly help you. The solution might range from a single table with some of the data in discrete columns and some of it stored as a list in one column all the way to some of the data separated out into separate tables.
-
Read the Warning at this link - http://us.php.net/float
-
Despite the color highlighting being shown in the forum post, there is nothing wrong with the "<?php" and "?>" since they are simply strings that are enclosed in quotes. That your later line of code echoes the error message means that the math being performed in that statement resulted in a TRUE if() result. What does adding the following two lines of code immediately after the first opening <?php tag in that file show - ini_set("display_errors", "1"); error_reporting(E_ALL); Also, how is the file being included/referenced by your main code, because unless $calendar is an instance of some class, the code will halt execution at the first reference to $calendar.
-
What does the following show (i.e. you are asking someone to attempt to tell you why a comparison is not working without any information about the actual values being compared) - var_dump($bid); echo '<br />'; var_dump($next_bid);
-
There is nothing technically wrong with the str_replace() (just tested.) What exact error or symptom do you get.
-
Listing Records Sorted By Alphabetic Dividers Problem
PFMaBiSmAd replied to DannGrant's topic in PHP Coding Help
Your query needs to have an ORDER BY term that will cause the rows to be returned in the order you want them. Assuming you have columns named last_name and first_name, you would need something like this - "SELECT * FROM members ORDER BY last_name, first_name" Each call to a mysql_fetch_xxxxx() function only returns one row from the result set, so your existing mysql_fetch_array() statement would need to be moved down and put into a while(){} loop, which would replace the existing foreach(){} loop. -
You already told us that was not all of the form - If the combined code works, but other code does not, there is something wrong with the code or with what you are doing, such as browsing directly to the file instead of using the URL of the file on your server.
-
That does indicate that php is working on your server and that there is either something wrong with your form or your form processing code. You would need to post all of both files for anyone one to have a chance at seeing what is causing the problem.