php/jsp Riff1__js

Source: Internet
Author: User

Practicing the piano when the riff called a small piece of music, then I define the program's riff is a small piece of the program, put some of these days to write their own, later also long-term update, as their own accumulation and future programming reference.

1. Format URL, if no HTTP headers inserted HTTP header

<?php//add http head to URL function addhttphead (& $s) {$exist = Strstr ($s, "http://"); if (! $exist) $s = "htt p://". $s; }?>

2. Link MySQL Database

<?php $conn =mysql_connect ("IP", "username", "password"); mysql_select_db ("database name");?>

3. SELECT MySQL Database

$exec = "SELECT * from movie"; $result = mysql_query ($exec); while ($rs =mysql_fetch_object ($result)) {//access to each record, such as Echo $rs->name;}

4. WINDOWS Named pipe Communications (pipelines are established by other processes)

function Sendtoclient ($msg) {$fp = @fopen ("////.//pipe//tongxun", ' w+r+b '), @fwrite ($fp, $msg),//write $result = @fread ($fp, 256)//Read fclose ($FP); }

5. Judge check box result

function Isselect ($index, $select _tag) {for ($i =0; $i <count ($select _tag); $i + +) {if ($index = = $select _tag[$i]) return TRUE; return FALSE; }

6. Page token generation and processing

Generate page tokens to prevent duplicate submission of forms $pagecode = Mt_rand (0,10000000); $_session[' Code ' = $pagecode; ...///To obtain a token to operate the page if ($_session[' code '] = = $_post[' Pagecode ']) {//token meets} else//token not conforming

7. JSP take form content

Note here that IE has a innerhtml trap, the result needs to trim a bit.

$data = document.all. Table Id.rows (line number). Cells (column number). InnerHTML;

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.