search
HomeBackend DevelopmentPHP TutorialCommon PHP codes_PHP tutorial

Common PHP codes_PHP tutorial

Jul 21, 2016 pm 04:00 PM
phpsessionstartcannotcodeoverall situationaddvariableCommonly usedsubmitdatadocument



Use ob_start(); when redirection is not possible; add it to the header file
// Write global variables
session_start(); // If data cannot be submitted, add: extract($_POST );extract($_GET);extract($_SESSION);

session_register('pt_usr_nm');//Write to browser global variables

//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 "Unable to connect to database";
}
//Disconnect the MySQL database
function dbclose($link)
{
global $link;
if(mysql_close($link))
{}
}
$quer8 = "select url,image from cpc_ad where id='$cid'";//Database call
$sult8 = mysql_query($quer8);//Send a query string.
$bank8 = mysql_fetch_array($sult8);//Return array data.
$no=mysql_num_rows($sult8);//Get the number of returned columns.Can be used to check whether there is data that meets the conditions

//Count the number of qualified data
$qrym="select count(*) from a_cip where TO_DAYS(date)=TO_DAYS(NOW())-1 ";
if($mres=mysql_query($qrym))
{
$mres=mysql_fetch_array($mres);
$membercount11=$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);
$membercount1=$mres[0];
}

// Insert new database data
$query = "INSERT INTO ptr_ptoc_clicks SET mem_id = '$pt_usr_nm', banner_id = $bank5[banner_id], click_date = now(),ip='$ip'";
mysql_query($ query);
//Modify 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 the source URL
if ($a=="") { echo " The link or code must be placed on the website You can get points";} else{
$b=parse_url($a);//Get the source URL data
$b[host];//Get the source URL domain name
//Automatically refresh in 3 seconds
print"";
/ /Transfer to other web pages
header("Location:$url")
// Remember variables
$a=number_format($money*0.00001,6)//Format data, keep 6 decimal places
//Loop flag
if ($output5==""){
session_register(' output5');
$output1=file("qizi.txt");
}
$show5=rand(0,count($output1)-1);
session_register('show5' );
print

$output1[$show5]

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

?>

//Time to mark

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.