1. Simple judgment of IP address legitimacy
2. Regular judgment of email
3. Example of checking whether IP address and mask are legal
4. About form refresh
5. About form refresh
1. Simple judgment of the legality of the IP address
if(!strcmp(long2ip(sprintf("%u",ip2long($ip))),$ip)) echo "is ipn";
----
2. Regular judgment of email
eregi("^[_.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z_-] +.)+[a-zA-Z]$", $email);
----
3. Example of checking whether the ip address and mask are legal
$ip = '192.168.0.84' ;
$mask = '255.255.255.0';
$network = '192.168.0';
$ip = ip2long($ip);
$mask = ip2long($mask);
$network = ip2long($network);
if( ($ip & $mask) == $network) echo "valid ip and maskn";
?>
----
4. A huge depressing problem was solved today
ipb’s add user page toadduser.php seems to be submitted repeatedly, causing it to always report that the user already exists when adding a new user... It’s already frustrating me 3 Oh my god, I finally got it done, I’m so happy!
----
5. About form refresh
Question: Why is the information in all fields cleared after I click the browser’s back button?
A: This is because you used the session_start function in your form submission page. This function will force the current page to not be cached. The solution is to add header("Cache-control: private"); after your Session_start function; Note that your PHP program cannot have any output before this line.
Supplement: There is also a session-based solution, add
session_cache_limiter('nocache');//Clear the form before session_start; //Clear the form
session_cache_limiter('private'); //Do not clear the form, only in During the session's validity period
session_cache_limiter('public'); //Do not clear the form, as if the session is not used
You can add session_cache_limiter("private,max-age=10800");
Excerpted from phpe.net
----
6. Quickly get the file download header output
header("Content-type: application/x-download");
header("Content -Disposition: attachment; filename=$file_download_name;");
header("Accept-Ranges: bytes");
header("Content-Length: $download_size");
echo 'xxx'
......2004-08-19 11:50:30
----
7. Use header to output ftp download method, and support breakpoint resume download
An example:
header('Pragma: public');
header('Cache-Control: private');
header('Cache-Control: no-cache, must-revalidate');
header ('Accept-Ranges: bytes');