This article mainly introduces the small program PHP back-end Form Submission example details of the relevant information, the need for friends can refer to the following
Small program php Backend form forms
1. Small program compared to the previous web+php station , the pe
Recently found to do a PHP program form data submission to the content of the database, as long as the content with single or double quotes, a backslash will be added later. And every time you save a backslash, it's depressing.
So from the Internet to search the original PHP program in order to prevent injection or ov
PHP prevents forms from repeating the method analysis by recording IP, IP form
In this paper, we analyze how PHP can prevent form recurrence by recording IP. Share to everyone for your reference. The specific analysis is as follows:
The simple comparison of this principle is that when the user first commits, we record
Php solves the problem of repeated submission of forms. Php solves the problem of repeated submission of forms. Repeated submission is a common problem during development. in addition to using js to prevent repeated submission of forms, you can also use php to solve the problem of repeated form submission.
Repeated su
variable $ user_password and assign the value of user_password in the POST request to it
// The. operator connects two string variables. the following two statements show the user name and password of the submitted form.
If ($ user_id = 'admin' $ user_password = '000000') // judgment statement, operator, must both be true
{
Echo "successful login after verification ";
}
Else
Echo "failed to verify, logon failed ";
?>
My sister
This article is a PHP to prevent form recurrence of the method of the detailed analysis of the introduction, the need for friends under the reference
PHP prevents forms from repeating instances:
Copy Code code as follows:
session_start ();
$_session[' fsess ']= ($_session[' fsess ') $_session[' fsess ']:time ();
?gt;
//*****javascript anti-repea
Reasons for automatically adding a backslash before a PHP form submission quotation mark and three methods to disable the php magic quotation mark. Reasons why PHP forms are automatically added with backslashes before quotation marks and three ways to disable php magic quote
data, while post is an implicit transfer of data, but there is a big difference is that the post supports more and larger data transfer.
Next, when the form code is written, let's write the server script (PHP here). Very simple ~
code is as follows
copy code
if (isset ($_post[' submit ')) { /form Submit processing $data =
Example of a Drupal file upload form
Copy Code code as follows:
function Upload_form () {
$form = Array ();
If This #attribute isn't present, upload'll fail on submit
$form [' #attributes '] [' enctype '] = ' multipart/form-data ';
$form [' file_uploa
Php implements the voting survey form in multiple steps. This article introduces how to implement php multi-step voting survey form filling, which roughly stores the content entered by the user in a hidden place, then, the last step is submitted to this article to introduce the implementation method of
Working with form data in PHP is simpler than other Web programming languages-if you use the language for a while, you'll find it an indisputable fact. The simplicity of this operation makes it easy to handle more complex form events, including the topic discussed today, where multiple buttons are used to handle different tasks in the same
This example describes the form validation classes that are encapsulated in PHP. Share to everyone for your reference, specific as follows:
More about PHP Interested readers can view the site topics: "PHP Design Security Course", "PHP Security Filtering Skills
//Select Database
*mysql_select_db ($db) or Die ("Unable to select database!"); $
Panax Notoginseng //constructs a SQL query
-$query ="INSERT into symbols (country, animal, CNAME) VALUE (' $country ', ' $animal ', ' $cname ')"; the
+ //Execute the query
A$result = mysql_query ($query) or Die ("Error in query: $query.". Mysql_error ()); the
+
1. What is MysqliPhp-mysql function library is PHP operation MySQL Database The most primitive extension library, php-mysqli I for improvement , the equivalent of the former improvement of the enhanced version, also contains the relative advanced function, in addition to increase the security itself, For example, it can greatly reduce the occurrence of SQL inject
The following is a summary of common form special character processing:
Test string:
The code is as follows
Copy Code
$dbstr = ' D:test'!= ' 1 ' OR ' 1 '
Test code:
The code is as follows
Copy Code
Header ("content-type:text/html; Charset=utf-8 ");echo "------------------------------------------------------echo $dbstr. " $str =fnaddslashes ($_post[' DD ']);echo $str. " $str = Preg_r
PHP form submit data get, post instance details. This article will introduce you to the get and post instances of PHP form submission data. For more information, see reference. 1. what is a form? Simply put, this article will introduce you to a Getting Started Tutorial on th
Creation of course, it's not over here. After all, if you can create multiple forms on a single page, why can't you build a form across multiple pages?
Unfortunately, it's not easy to send data from one page to another page with HTTP. Because there is no built-in mechanism in the HTTP protocol to define the concept of a series of pages. However, with some clever techniques and some useful functions of PHP,
uploaded. the relative path is used.
Note:
3rd rows ~ Row 6th: sets the size of the image file to be uploaded, the MIME type and extension of the file. because this code is an image file upload program, all the image types are listed in the two arrays, for example, PNG, GIF, and JEPG.
17th rows ~ Row 24th: If the file is empty, the size is equal to 0. If the image file extension or type does not match, the file jumps out.
Row 26th: the move_uploaded_file function moves the files in the temporar
Prevents PHP programs from MySQL injection or HTML form abuse. The intention of MySQL injection is to take over the website database and steal information. Common open-source databases, such as MySQL, have been used by many website developers to store important information, such as passwords and personal information. the intention of MySQL injection is to take ov
"]) {Setcookie ("tempcookie", "", 0); echo "you have submitted a form ";}
4. Jump using the header Function
Once the user clicks the submit button, after the data is processed, the page jumps to another page.
If (isset ($ _ POST ['submit ']) {Header ('location: success. php'); // after processing data, go to other pages}5. Use the database to add Constraints
Dire
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.