簡體   English   中英

使用cURL函數后,會話將無法正常工作

[英]After using cURL function, the session won't work

我有一個具有登錄用戶的腳本,因此用戶只能使用其用戶名/密碼登錄!

一切正常,唯一的問題是,在頁面中我使用了cURL函數,一旦我離開該頁面並移至另一個頁面,它將不再識別用戶會話。

這是cURL文件代碼:

<?php session_start(); 
require_once('db.php'); 
include('functions.php'); 
checkLogin('1'); 
$query = 'SELECT * FROM users WHERE ID="'.$_SESSION['user_id'].'"';
$result = mysql_query($query) or die(mysql_error());


while($row = mysql_fetch_array($result)){
    $id_user=$row['user_id'];
    $phone=$row['phone'];
    $name=$row['first_name'];


}

?>

<?php
    if ($points == 250) {
     $b = time (); 
 $date1 =date( "Y-m-d;h:i:s" , mktime(date("h")+6, date("i"), date("s"), date("m") , date("d"), date("Y"))); 
 $str_time = ""; 
 $str_msg = ""; 
 $str_from = ""; 
 $str_zip = ""; 

$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://testext.i-movo.com/api/receivesms.aspx?".$str_from.$str_zip.$phone.$str_time.$date1.$str_msg);
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);
}
else if ($points == 500) {
     $b = time (); 
 $date1 =date( "Y-m-d;h:i:s" , mktime(date("h")+6, date("i"), date("s"), date("m") , date("d"), date("Y"))); 
 $str_time = ""; 
 $str_msg = ""; 
 $str_from = ""; 
 $str_zip = ""; 

$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://testext.i-movo.com/api/receivesms.aspx?".$str_from.$str_zip.$phone.$str_time.$date1.$str_msg);
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);
}
else {
    echo "We are sorry, you don't possess enough points in order to take the coupon";

}
echo '</div>';

?>

這是非常有趣的...您知道在調用curl之前關閉了php嗎???

刪除?>從中間放在頁面末尾

其次,我不建議繼續使用mysql_query

從PHP DOC

不鼓勵使用此擴展名。 相反,應使用MySQLi或PDO_MySQL擴展。 另請參見MySQL:選擇API指南和相關的FAQ,以獲取更多信息。 此功能的替代方法包括:

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM