Why can't the red part be obtained? it can be obtained from other places!

Source: Internet
Author: User
Why can't the red part be obtained? it can be obtained from other places! Why can't the red part be obtained? it can be obtained from other places!

Global $ fdyu, $ db;
$ Tp_id = intval ($ _ GET ['TP _ id']);
$ Hd_id = intval ($ _ GET ['HD _ id']);
$ All_toupiao = $ _ GET ['all _ toupiao '];
$ Tp_star_time = $ _ GET ['TP _ star_time '];
$ Tp_end_time = $ _ GET ['TP _ end_time '];

$ Ajax = array ();

If (strtotime (date ('Y-m-d H: I: S', time ()> strtotime ($ tp_end_time ))
{
$ Ajax ['record '] ['all _ tp'] = 3;
Echo json_encode ($ ajax );
Exit;
}

If (strtotime (date ('Y-m-d H: I: S', time ()))
{
$ Ajax ['record '] ['all _ tp'] = 4;
Echo json_encode ($ ajax );
Exit;
}

// Obtain the number of votes
$ SQL _c = "select cishu from". $ fdyu-> table ('cms '). "as cms
Where cms. cms_id = ". $ hd_id ."";
$ Row_c = $ db-> getRow ($ SQL _c, true );

If ($ row_c ['cihu '] = 0)
{
$ Cs = '';
}
Else
{
$ Cs = "and DATE_FORMAT (add_time, '% Y-% m-% d') = '". date ('Y-m-D', time ()). "'";
}

If ($ all_toupiao = 0)
{
// Single-choice prompt
$ Tp_count = $ db-> getOne ("select count (*) FROM ". $ fdyu-> table ('oa _ toupiao_xx '). "WHERE tp_ip = '". $ _ SERVER ["REMOTE_ADDR"]. "'and huodong_id = ". $ hd_id. "". $ cs. "");
If ($ tp_count> 0)
{
If ($ row_c ['cihu '] = 0)
{
$ Ajax ['record '] ['all _ tp'] = 1;
}
Else
{
$ Ajax ['record '] ['all _ tp'] = 5;
}
Echo json_encode ($ ajax );
Exit;
}
}

$ Tp_count_1 = $ db-> getOne ("select count (*) FROM ". $ fdyu-> table ('oa _ toupiao_xx '). "WHERE tp_ip = '". $ _ SERVER ["REMOTE_ADDR"]. "'and huodong_id = ". $ hd_id. "and toupiao_id = ". $ tp_id. "". $ cs. "");
If ($ tp_count_1> 0)
{
If ($ row_c ['cihu '] = 0)
{
$ Ajax ['record '] ['all _ tp'] = 2;
}
Else
{
$ Ajax ['record '] ['all _ tp'] = 6;
}
Echo json_encode ($ ajax );
Exit;
}

$ SQL = "update". $ fdyu-> table ('oa _ huodong_toupiao '). "set count = count + 1
WHERE toupiao_id = ". $ tp_id;
$ Db-> query ($ SQL );

$ Field_values = array (
"Toupiao_id" => $ tp_id,
"Huodong_id" => $ hd_id,
"Tp_ip" = >$ _ SERVER ["REMOTE_ADDR"],
"Add_user" = >$ _ SESSION ['username'],
"Add_time" => date ('Y-m-d H: I: S', time ())
);
$ Db-> autoExecute ($ fdyu-> table ('oa _ toupiao_xx '), $ field_values );

$ SQL _t = 'SELECT count FROM '. $ fdyu-> table ('oa _ huodong_toupiao'). "where toupiao_id =". $ tp_id;
$ Row_t = $ db-> getRow ($ SQL _t, true );
If ($ row_t! = False)
{
$ Ajax ['record'] ['TP _ count'] = $ row_t ['count'];

$ Ajax ['status'] ['code'] = '1'; // success

Echo json_encode ($ ajax );
Exit;


Reply to discussion (solution)

A braces are missing.
If ($ row_t! = False)
{
$ Ajax ['record'] ['TP _ count'] = $ row_t ['count'];
}

$. Get ("/show. php? Act = get_toupiao ",{
Tp_id: tp_id,
All_toupiao: all_toupiao,
Hd_id: hd_id,
Tp_star_time: tp_star_time,
Tp_end_time: tp_end_time,
Async: false,
Rand: Math. random ()
}, Function (data ){
If (data. record. all_tp = "5 ")
{
Alert ("You have voted today. please try again tomorrow! ");
Return false;
}
If (data. record. all_tp = "6 ")
{
Alert ("You have voted today. please try again tomorrow! ");
Return false;
}
If (data. record. all_tp = "3 ")
{
Alert ("The voting time has passed and cannot be voted ");
Return false;
}
If (data. record. all_tp = "4 ")
{
Alert ("The voting time has not arrived, and you cannot vote ");
Return false;
}
If (data. record. all_tp = "1 ")
{
Alert ("You have already voted for this activity and cannot vote again ");
Return false;
}
If (data. record. all_tp = "2 ")
{
Alert ("You have already voted for this project and cannot vote again ");
Return false;
}
If (data. status. code = "1 ")
{
// Succeeded
$ ("# Tp _" + tp_id + ""). empty ();
$ ("# Tp _" + tp_id + ""). append ("" + data. record. tp_count + "");
Alert ("vote successful! ");
Return false;
}
}, "Json ");

If (data. status. code = "1 ")
{
// Succeeded
$ ("# Tp _" + tp_id + ""). empty ();
$ ("# Tp _" + tp_id + ""). append ("" + data. record. tp_count + "");
Alert ("vote successful! ");
Return false;
}
Why is there no prompt here!

First check the content of $ SQL _t

Toupiao_id name huodong_ID user_id time count
31 Zhang San 62 Peng Bin 23:23:27 21

It seems that there is no problem with the content. it's strange!

Another problem is that the IP address is the same for machines on the same vro. Only one ticket can be sent to machines on the same network. what should I do?

I also found that the IP addresses opened by the QQ browser are different from those obtained by different mobile phones on the same vro. the IP addresses obtained by other browsers on different mobile phones on the same route network are the same.

Wifi access, the ip address will not be the same!
For traffic access, the ip address should be the same
You need to have a unique identifier (via cookie or url) for user identification)

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.