PHP Common Code _php Tutorial

Source: Internet
Author: User
Do not use Ob_start () when turning, add to header file
Write a global variable
Session_Start ();//cannot submit data after adding: Extract ($_post); extract ($_get); extract ($_session);

Session_register (' pt_usr_nm ');//write Browser global variable

Connect to MySQL Database
function Dbconnect ()
{
Global $site _domain, $db _host, $db _name, $db _user, $db _pass;
if ($link = mysql_connect ($db _host, $db _user, $db _pass))
{
$res =mysql_select_db ($db _name) or Die (Mysql_error ());
if ($res)
return $link;
}
else print "Cannot connect to database";
}
Disconnecting the MySQL database
function Dbclose ($link)
{
Global $link;
if (Mysql_close ($link))
{}
}
$quer 8 = "Select Url,image from Cpc_ad where id= ' $cid '";//Database call
$sult 8 = mysql_query ($quer 8);//Send a query string.
$bank 8 = mysql_fetch_array ($sult 8);//returns array data.
$no =mysql_num_rows ($sult 8);//Gets the number of returned columns. Can be used to check for any data that meets the criteria

Count the number of eligible
$qrym = "SELECT count (*) from A_CIP where to_days (date) =to_days (now ())-1";
if ($mres =mysql_query ($qrym))
{
$mres =mysql_fetch_array ($mres);
$membercount 11= $mres [0];
}
$qrym = "SELECT count (*) from A_CIP where ipuse=" and time_to_sec (date) >time_to_sec (now ()) -1800 and to_days (date) =to_ Days (now ()) ";
if ($mres =mysql_query ($qrym))
{
$mres =mysql_fetch_array ($mres);
$membercount 1= $mres [0];
}

Inserting new database data
$query = "INSERT into ptr_ptoc_clicks SET mem_id = ' $pt _usr_nm ', banner_id = $bank 5[banner_id], click_date = Now (), ip= ' $ip '";
mysql_query ($query);
modifying database data
$query = "UPDATE ptr_member_clicks SET self_banner_click =self_banner_click+ $clamt WHERE mem_id = ' $pt _usr_nm '";
mysql_query ($query);

$a =$_server[' http_referer '];//get an unsolicited website
if ($a = = "") {echo "link or code must be placed on the website to get Points";} else{
$b =parse_url ($a);//Obtain the data of the antecedents URL
$b [host];//access to the URL domain name
3 seconds Auto Refresh
Print ";
Transfer to other pages
Header ("Location: $url")
Remember variables
$a =number_format ($money *0.00001,6)//Format data, retain 6 decimal places
Cycling Banner
if ($output 5== "") {
Session_register (' output5 ');
$output 1=file ("Qizi.txt");
}
$show 5=rand (0,count ($output 1)-1);
Session_register (' show5 ');
Print << $output 1[$show 5]

HTM;
Text link
if ($textad = = "") {
Session_register (' output ');
$textad =file ("Text.txt");}
for ($i =0; $i
";

?>

To the time of remembering

Weak window control
onload=//activating when loading a page
window.open (//Referencing Window object, open method
' Blogchina. COM ',//URL address of the window that will pop up
' Detail ',//window name
' Toolbar=yes,//whether to display the browser's toolbar (forward back and so on button), yes= display, no= not show
Location=yes,//Whether the address bar is displayed, yes= display, no= not displayed
Status=yes,//Whether the status bar is displayed, yes= display, no= not displayed
Menubar=yes,//Whether the menu bar is displayed, yes= display, no= not displayed
Scrollbars=yes,//Whether the scroll bar is displayed, yes= display, no= not displayed
Resizable=yes,//whether to allow drag change size, yes= display, no= not display
The width of the width=100,//pop-up window, in pixels, px
The height of the height=100 '//pop-up window, in pixels, px
)"

http://www.bkjia.com/PHPjc/317070.html www.bkjia.com true http://www.bkjia.com/PHPjc/317070.html techarticle If you cannot turn the Ob_start (), add the header file//write the global variable session_start ();//cannot submit data after adding: Extract ($_post); extract ($_get); Extract ($_ SESSION); Session_regis ...

  • 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.