示例#1
0
<?php

include "extrakits.inc.php";
include 'zmysqlConn.class.php';
$zconn = new zmysqlConn();
/*
 * the script takes 3 parameters:clientkey, channelid, uid.
 * and it'll delete the record that matches the 3 values passed from above parameters.
 */
require_once './protocolbuf/message/pb_message.php';
require_once './protocolbuf/parser/pb_proto_weibousers_protos.php';
$mappings = new UCMappings();
if (!array_key_exists('clientkey', $_GET) || !array_key_exists('channelid', $_GET) || !array_key_exists('uid', $_GET)) {
    $mappings->set_flag(0);
    //0 means parameters are kind of wrong or something
    echo $mappings->SerializeToString();
    exit;
}
$clientkey = $_GET['clientkey'];
$uid = $_GET['uid'];
$channelid = $_GET['channelid'];
$sql = sprintf("select * from clients where `key` = '%s'", $clientkey);
$rs = mysql_query($sql, $zconn->dblink);
if ($rs === false) {
    $mappings->set_flag(-1);
    //-1 means there is some db related errors
    echo $mappings->SerializeToString();
    exit;
}
$clientid = 0;
if (mysql_num_rows($rs) == 0) {
示例#2
0
include "extrakits.inc.php";
include 'zmysqlConn.class.php';
include_once "weibo/expkits.inc.php";
$zconn = new zmysqlConn();
/*
 * the script takes 3 parameters:user, channelid, clientkey.
 * and it'll update or insert one record into table users according them:
 * if the clientkey from table users according to "user[id], channelid" is 
 * different with the one passed from "GET", do nothing to table users but 
 * just return the clientkey from table users. //and at the same time set
 * the flag of the one passed from "GET" in table clients into -1. 
 */
require_once './protocolbuf/message/pb_message.php';
require_once './protocolbuf/parser/pb_proto_weibousers_protos.php';
$mappings = new UCMappings();
if (!array_key_exists('user', $_GET) || !array_key_exists('channelid', $_GET) || !array_key_exists('clientkey', $_GET)) {
    $mappings->set_flag(0);
    //0 means parameters are kind of wrong or something
    echo $mappings->SerializeToString();
    exit;
}
$user = $_GET['user'];
if (!is_array($user)) {
    $mappings->set_flag(0);
    //0 means parameters are kind of wrong or something
    echo $mappings->SerializeToString();
    exit;
}
$profile_updated = false;
$sql = __get_user_insert_update_sql($user);