-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
First method, use the name_x or name_y variable - <input type='image' name="submit" src="your_image_here..." > if(isset($_POST['submit_x'])){ // the form was submitted } Second method, use a hidden field - <input type='hidden' name='submit' value='submit'> <input type='image' src="your_image_here..." > if(isset($_POST['submit'])){ // the form was submitted } Third method, detect any POST submission - <input type='image' src="your_image_here..." > if ($_SERVER['REQUEST_METHOD'] == "POST"){ // a form was submitted }
-
Yes, remove the quotes. The definition of how numbers within quotes get operated on could change at any point in time. Put string data in quotes. Don't put numbers in quotes.
-
Image submit buttons send the x,y coordinates where the image was clicked. The browsers that send the value="..." using the name="..." attribute are not actually following the w3.org specification. You can either detect the name_x or name_y value (see this link http://www.php.net/manual/en/faq.html.php#faq.html.form-image) or you can put in a hidden field with a name/value that you want to use to detect if the form was submitted, or you could use the method BlueSkyIS posted.
-
What you described is exactly what you do. There are literally 10's of millions of php based web sites that put database settings and functions into files that the main file includes and then uses what was included.
-
Your database information in the form of php code in a .php file is inherently safe. If you browse to the file, you only get any output sent by that file, not the php code in the file. It would require someone to find a way of causing php code to not be parsed without also breaking the web server. What exactly are you trying to accomplish?
-
LOL, when you put numeric data inside quotes in the query, mysql first converts that data to floating point. If that data happens to have a fractional part, you end up with floating point precision conversion errors. AND, you should define your columns as a DECIMAL data type if they are not already, as the same problem will occur if the columns themselves are defined as a FLOAT data type.
-
If you have setup your web server to parse .html files as php code files, they will be passed through the php language parser every time they are requested (unless the web server has also been setup with a php bytecode/opcode cache) , the same as if they were .php files. When php parses a file it must scan through every group of characters in the file looking for opening/closing php tags, even if there are none. Php is a parsed, tokenized, interpreted language. This is a multi-pass process. The file is scanned for opening/closing php tags. The php code between the php tags is converted into bytecode/opcode tokens. On the second pass, the php bytecode is fetched and interpreted. Anything in the file that is not between php opening/closing tags is literally output during the second interpretation phase. So yes, doing this does add overhead to every file requests, even if the file does not contain any php code.
-
Yes, that's a link to your web site, not the author's site of the script you are using.
-
A) I don't think that is the template in question. B) I tried searching for the author's web site based on the bits of information in the comments in that code, but did not find anything. Could you post a link to that script's web site?
-
The error message is fairly self explanatory - there is an unexpected < on line 1 of the php code being passed through the eval() statement. What is line one of the file that is being processed? Given that you appear to be passing it a .html template and not php code, you would need to put a closing php tag ?> to drop out of php mode. If your template does not contain any php code, there's no point in using eval() on it.
-
Ummm. What math? As always, in programming, what you are actually doing determines the best way of doing it.
-
Are you testing with an 08 or 09 month value? Be advised that leading zeros on numbers cause php to treat them as octal and 08 and 09 are invalid octal values. You would want to enclose the values in quotes so that they are treated as strings, especially the '08' and '09'.
-
I need help passing form variables to a second page.
PFMaBiSmAd replied to dj262501's topic in PHP Coding Help
When you do a 'view source' in your browser of the second form, does it contain what you expect? That would be the first step, get that form to be produced correctly so that it will submit the correct information to the add_activity.php page. -
I need help passing form variables to a second page.
PFMaBiSmAd replied to dj262501's topic in PHP Coding Help
It's the second form (that gets produced when the first form is submitted) that is the issue - Aside from the fact that the hidden field name is name="exerciseid", and not "exercise", you should get what ever values you enter into the duration and distance fields. -
Upload script not working online but A ok on server?
PFMaBiSmAd replied to esandra's topic in PHP Coding Help
You already have a recent thread for this. Don't start another one for the same problem. Surprisingly, creating more threads for the same problem actually reduces the chances of your question getting answered. -
You can put the actual host/user/password/database string into the mysqli() statement and it has nothing directly to do with security (if someone has direct access to your source php files, it does not matter where you put or define the values), but - 1) If you are just learning and happen to post your code, they will get posted on a public forum, 2) If you have more than one file that makes a database connection, you will need to repeat the values and any time you change any of the values you must edit them in all the files. So, if you use variables or defined constants and then set those variables or define the constants in a file that is included into your main code you can avoid both those problems. The actual settings are only in one place. Putting the settings into a .php file that is included is also not directly a security issue, as long as you use a .php file. The php code that is setting the variables or defining the constants is parsed if the file is directly browsed to and the only output would be due to any HTML or echo/print... statements in the file. As long as you don't echo "My db password is: $password"; your information is safe. However, you generally want to prevent the needless execution of your code in your included files so you would use one of the following methods - 1) Put code into the file to detect direct request/browsing to the file and die/exit. 2) Put the files into a folder that is outside (closer to the disk root) so that they cannot be browsed to. 3) Put the files into a folder that you have secured to prevent all http requests to the files in that folder.
-
experiance mysql help in data transfer required
PFMaBiSmAd replied to otuatail's topic in MySQL Help
Somewhat off topic, but queries are executed on the database server, so queries that reference databases that are on different servers are not possible unless you have your database set up as a cluster. -
For a table without an auto-increment key, the limit on the number of rows in a table would be the amount of data that can be stored in a file on your file system. If you are using an auto-increment key, the limit would for the size of the key (4,294,967,295 for an INT.) As long as you are not doing anything terribly wrong in your table design, you won't have any problem with 500,000 to 5,000,000 rows in a table.
-
Your queries are failing due to some kind of error and assuming you have not changed your code, it is likely a problem with the database server, with your database, or with your table. If you echo mysql_error(); on the next line after the line with your mysql_query() statements, it will tell you why the query(ies) are failing.
-
^^^^ Should be $_POST The symptom is that of the php code being skipped over (i.e. none of the $firstname... variables have been set.) You should be developing and debugging your php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that all the php detected errors will be reported and displayed. You will save a ton of time.
-
Could you edit your post and post the code without the line numbers so that someone would have a chance at helping you.
-
experiance mysql help in data transfer required
PFMaBiSmAd replied to otuatail's topic in MySQL Help
mysql_select_db() returns a TRUE/FALSE value depending on if the an error occurred while selecting the database, so some of that code is nonsense. Also, the query in that code has nothing to do with what you are attempting. Don't execute code that you find posted on a forum unless you understand what that code does. -
experiance mysql help in data transfer required
PFMaBiSmAd replied to otuatail's topic in MySQL Help
http://php.net/mysql_query -
experiance mysql help in data transfer required
PFMaBiSmAd replied to otuatail's topic in MySQL Help
The second parameter in the mysql_query() is an optional database link resource. You can create both connections and simply use the variable that you assign the connection to as the second parameter in the appropriate mysql_query() statement. -
You already have a thread for this problem. Stop creating new threads for the same thing.