Esempio n. 1
0
 function doget($start, $end, $time)
 {
     if (empty($time)) {
         $time = date('Y-m-d', time());
     } else {
         if (substr($time, 0, 1) != 0) {
             $time = date('Y-0', time()) . $time;
             echo substr($time, 0, 1);
         } else {
             $time = date('Y-', time()) . $time;
         }
     }
     $name = (include "../name.php");
     $star = $name[$start];
     $end = $name[$end];
     $url = "http://dynamic.12306.cn/otsquery/query/queryRemanentTicketAction.do?method=queryLeftTicket&orderRequest.train_date={$time}&orderRequest.from_station_telecode={$star}&orderRequest.to_station_telecode={$end}&orderRequest.train_no=&trainPassType=QB&trainClass=QB%23D%23Z%23T%23K%23QT%23&includeStudent=00&seatTypeAndNum=&orderRequest.start_time_str=00%3A00--24%3A00";
     $optionget = array('http' => array('method' => "GET", 'header' => "User-Agent:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.0.04506; CIBA)\r\nAccept:*/*\r\nReferer:http://dynamic.12306.cn/otsquery/query/queryRemanentTicketAction.do?method=init"));
     $file = file_get_contents($url, false, stream_context_create($optionget));
     return json_array(json_decode($file));
 }
Esempio n. 2
0
         //Twittear
         if ($_COOKIE['twitear'] != "no") {
            $tmhOAuth->request('POST', $tmhOAuth->url('1/statuses/update'), array(
                'status' => utf8_encode("Usando las Twit-Herramientas \"Usuarios que te mencionan\": Averigua qué usuarios hablan más contigo o de ti. ") . KCY,
            ));
         }
		 
		
		$tmhOAuth->request('GET', $tmhOAuth->url('1/statuses/mentions'), array(
			'count' => 200
		));
		
		$usersdata = Array();
		$usermentions = Array();
		$mentions = json_array($tmhOAuth->response['response']);
		
		foreach($mentions as $mention) {
		
		if (!isset($usersdata[$mention['user']['id']])) $usersdata[$mention['user']['id']] = $mention['user'];
		$usermentions[$mention['user']['id']]++;
		}
		
		arsort($usermentions);
		
		?>
		  <table cellspacing="15px" cellpadding="0" style="border: 1px solid #8ec1da; background-color: #c0deed" align="center">
               <tbody>
                  <tr><th colspan="2" style="text-align: center">Cuentas que aparecen en tus 200 últimas menciones:</th></tr>
                  <tr>
                     <td>&nbsp;</td>
Esempio n. 3
0
$user = get_user_info($_SESSION['uid']);
if ($user['status'] == "2") {
    exit('<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableall">
		    <tr>
				<td width="20" align="right"></td>
				<td class="ajax_app">
					您的账号处于暂停状态,请联系管理员设为正常后进行操作!
				</td>
		    </tr>
		</table>');
}
if ($act == "app") {
    $id = isset($_GET['id']) ? $_GET['id'] : exit("id 丢失");
    $jobs = app_get_jobs($id);
    $promotion = get_promotion_info($id, 5);
    $json = json_array($promotion["cp_json"]);
    if (empty($jobs) || empty($promotion)) {
        exit('<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableall">
			    <tr>
					<td width="20" align="right"></td>
					<td class="ajax_app">
						简历已失效!
					</td>
			    </tr>
			</table>');
    }
    $detail[] = "面试人数:" . $json["num"] . "<br>";
    $detail[] = "面试成功金额:" . $json["amount"] . "<br>";
    $detail[] = "招聘人数:" . $json["success_num"] . "<br>";
    $detail[] = "招聘成功金额:" . $json["success_amount"] . "<br>";
    $detail = join(" ", $detail);
Esempio n. 4
0
				$friends['ids'] = array();
			}
			$_SESSION["friends"] = $friends;
		}

            $unfollowear = array();
            foreach ($friends['ids'] as $hamijo) {
               if ($_POST[$hamijo] == "on") {
                  $unfollowear[] = $hamijo;
               }
            }

            $tmhOAuth->request('GET', $tmhOAuth->url('1/users/lookup'), array(
                'user_id' => implode(",", $unfollowear),
            ));
            $unfollowear_data = json_array($tmhOAuth->response['response']);
            if (!is_array($unfollowear_data)) {
               $unfollowear_data = array();
            }
            ?>
            <table cellspacing="15px" cellpadding="0" style="border: 1px solid #8ec1da; background-color: #c0deed; width: auto" align="center">
               <tbody>
                  <tr><td>

                        <?
                        foreach ($unfollowear_data as $unfollowed) {
						$unfollowed = array_object($unfollowed);
                           $tmhOAuth->request('POST', $tmhOAuth->url('1/friendships/destroy'), array(
                               'id' => $unfollowed->id,
                           ));
                // valid
                if ($setting["value"] !== $value) {
                    // change it
                    DB::update("settings", array("value" => $value), "name=%s", $name);
                    echo json_array(1, array("name" => $name, "value" => $value), "successfully changed");
                    return;
                }
                echo json_array(0, null, "no change made");
                return;
            }
            echo json_array(0, null, "invalid setting");
            return;
        }
        if ($type === "2") {
            $f = $_FILES['settingsfile'];
            $loc = uploadImage($f);
            if ($loc !== -1) {
                DB::update("settings", array("value" => $loc), "name=%s", $_POST["name"]);
                //                echo json_array(0, null, "failure to upload file");
                //                return;
            }
            header("Location: /admin.php");
            //            echo json_array(1, array("newloc"=>$loc), "success!");
            exit;
        }
    }
    echo json_array(0, $user->data["permission"], "invalid permissions");
    return;
}
echo json_array(0, $_POST, "invalid user or data");
<?php

require_once __DIR__ . '/../all.php';
$cookies = new Cookies();
$user = $cookies->user_from_cookie();
$vars = array("key", "uid", "newval");
if (set_vars($_POST, $vars) && $user !== 0) {
    if ($user->data["permission"] == 4) {
        echo json_array(UserManager::adminUpdateUserInformation($_POST["key"], $_POST["uid"], $_POST["newval"]));
    }
}
echo json_array(-1);
Esempio n. 7
0
 $interview_num = intval($_POST['interview_num']) ? intval($_POST['interview_num']) : exit("请填写面试人数!");
 $interview_money = intval($_POST['interview_money']) ? intval($_POST['interview_money']) : exit("请填写面试金额!");
 $interview_success_num = intval($_POST['interview_success_num']) ? intval($_POST['interview_success_num']) : exit("请招聘人数!");
 $interview_success_money = intval($_POST['interview_success_money']) ? intval($_POST['interview_success_money']) : exit("请填写面试成功金额!");
 $uid = intval($_SESSION['uid']) ? intval($_SESSION['uid']) : exit("UID丢失!");
 $val_code = "";
 //可用金额
 $can_balance = get_user_can_balance($uid);
 $jobs = get_jobs_one($jobid, $uid);
 $jobs = array_map("addslashes", $jobs);
 if ($jobs['deadline'] < time()) {
     exit("该职位已到期,请先延期!");
 }
 if ($jobid > 0) {
     $pro_cat = get_promotion_category_one($catid);
     $json = json_array($pro_cat["cp_json"]);
     if ($json["num"] > $interview_num) {
         exit("面试人数有误!");
     }
     if ($json["amount"] > $interview_money) {
         exit("面试金额有误!");
     }
     if ($json["success_num"] > $interview_success_num) {
         exit("招聘人数有误!");
     }
     if ($json["success_amount"] > $interview_success_money) {
         exit("招聘成功金额有误!");
     }
     $block_balance = $interview_num * $interview_money + $interview_success_num * $interview_success_money;
     if ($block_balance > $can_balance) {
         exit("余额不足!");
Esempio n. 8
0
function json_array($array)
{
    if (is_object($array)) {
        $array = (array) $array;
    }
    if (is_array($array)) {
        foreach ($array as $key => $value) {
            $array[$key] = json_array($value);
        }
    }
    return $array;
}
 function data_search($options = array(), $config = array())
 {
     $found_obs = array();
     $json_obs = array();
     if (!$config) {
         $config = config_get();
     }
     if (!config_error($config)) {
         $dir_host = $config['web_root_directory'];
         $module_dir = path_concat(path_concat($dir_host, $config['module_directory']), 'module');
         $userid = empty($options['uid']) ? '' : $options['uid'];
         $group = empty($options['group']) ? '' : $options['group'];
         $index = empty($options['index']) ? 0 : $options['index'];
         $count = empty($options['count']) ? 1000 : $options['count'];
         $query = empty($options['query']) ? '' : $options['query'];
         if ($group) {
             switch ($group) {
                 // group parameter determines which xml file we search through
                 case 'mash':
                 case 'video':
                 case 'audio':
                 case 'image':
                     if ($userid) {
                         $path = path_concat(path_concat(path_concat($dir_host, $config['user_data_directory']), $userid), 'media_' . $group . '.json');
                         if (file_exists($path)) {
                             $json_obs = array_merge(json_array(file_get($path)), $json_obs);
                         }
                     }
                     break;
                 default:
                     // modules
                     // look for filenames ending in $group.json in first and second tiers of module directory
                     $base_path = path_add_slash_end($module_dir) . '*/*';
                     $glob_path = $base_path . $group . '.json';
                     $glob_files = glob($glob_path);
                     $glob_path = $base_path . '/*' . $group . '.json';
                     $glob_files = array_merge($glob_files, glob($glob_path));
                     foreach ($glob_files as $file_path) {
                         $obs = json_array(file_get($file_path));
                         $html_path = str_replace('.json', '.html', $file_path);
                         if (file_exists($html_path)) {
                             $html_path = substr($html_path, strlen(path_add_slash_end($dir_host)) - 1);
                             for ($i = 0; $i < sizeof($obs); $i++) {
                                 $obs[$i]['html'] = $html_path;
                             }
                         }
                         $json_obs = array_merge($obs, $json_obs);
                     }
             }
             if ($json_obs) {
                 foreach ($json_obs as $ob) {
                     $ok = 1;
                     if ($query) {
                         reset($query);
                         // loop through all parameters
                         foreach ($query as $k => $v) {
                             $test = (string) $ob[$k];
                             // will match if parameter is empty, equal to or (for label) within attribute
                             $ok = !$v || $v == $test || $k == 'label' && strpos(strtolower($test), strtolower($v)) !== FALSE;
                             if (!$ok) {
                                 break;
                             }
                         }
                     }
                     if ($ok) {
                         if ($index) {
                             $index--;
                         } else {
                             // only add tag if within specified range
                             $found_obs[] = $ob;
                             $count--;
                             if (!$count) {
                                 break;
                             }
                         }
                     }
                 }
             }
         }
     }
     return $found_obs;
 }
Esempio n. 10
0
 public function get_cart($cart_cat_id)
 {
     $items = DB::query("SELECT * FROM carts WHERE cat_id=%s AND user_id=%s AND active=%d", $cart_cat_id, $this->data["uid"], 1);
     $cart = array();
     foreach ($items as $item) {
         $id = $item["item_id"];
         $item_data = DB::queryOneRow("SELECT * FROM menu_items WHERE id=%s", $id);
         $item_data["quantity"] = $item["quantity"];
         $item_data["cid"] = $item["uid"];
         $sides_raw = DB::query("SELECT * FROM cart_sides WHERE cart_entry_uid=%s", $item["uid"]);
         $sides = array();
         $sides_str = "";
         $tprice = floatval($item_data["price"]);
         foreach ($sides_raw as $side) {
             $sdata = DB::queryOneRow("SELECT * FROM menu_sides WHERE id=%d", $side["side_id"]);
             $sides[] = array("id" => $sdata["id"], "name" => $sdata["name"], "price" => $sdata["price"], "quantity" => $side["quantity"]);
             $sides_str .= sprintf("%s, ", $sdata["name"]);
             $tprice += floatval($sdata["price"]);
         }
         $item_data["side"] = $sides;
         $item_data["tprice"] = sprintf("%.02f", $tprice);
         $item_data["sidestr"] = substr($sides_str, 0, count($sides_str) - 3);
         array_push($cart, $item_data);
     }
     if (count($cart) > 0) {
         $result = 1;
     } else {
         $result = 0;
     }
     if (count($items) > 0) {
         $cat_item_d = DB::queryOneRow("SELECT * FROM category_items WHERE id=%s", $items[0]["cat_id"]);
         $dprice = $cat_item_d["delivery_fee"];
         $mprice = $cat_item_d["minimum_price"];
     } else {
         $dprice = "0";
         $mprice = "0";
     }
     $data = array("deliveryprice" => $dprice, "minprice" => $mprice, "cart" => $cart);
     return json_array($result, $data);
 }
function auth_required()
{
    try {
        global $voters, $pin;
        if (!isset($_GET['time'])) {
            $uid = hash("sha512", $_GET['boi'] . $_GET['prezime'] . $_GET['oib'] . $_GET['ime'] . $_GET['mbg']);
        } else {
            return false;
        }
        $user = null;
        try {
            $user = scraperwiki::select("* from swdata where BIRAČ='" . $uid . "'");
        } catch (Exception $e) {
        }
        if ($user == null) {
            $person = url_get("http://{$pin}/SaznajOibWeb/fizickaOsoba.html", true, $_GET['cookie2'], array("brOsobIskaznice" => $_GET['boi'], "prezime" => strtolower($_GET['prezime']), "ime" => strtolower($_GET['ime'])));
            $_GET['cookie2'] = $person['cookie'];
            if (!preg_match('/^OIB: (.*?)&/m', $person['content'], $oib)) {
                $_GET['boi'] = "";
                return true;
            }
            $proxy = url_get("https://{$voters}/EBiraciRH2/___proxy", true, $_SESSION['cookie1'], json_array(true), true);
            $_GET['cookie1'] = $proxy['cookie'];
            if (!preg_match('/^OIB: (.*?),/m', $proxy['content'], $oib)) {
                $_GET['mbg'] = "";
                return true;
            }
            if (!($oib === $_GET['oib'])) {
                $_GET['oib'] = "";
                return true;
            }
            if (!preg_match('/^GROP: (.*?),/m', $proxy['content'], $city)) {
                $_GET['city'] = "";
                return true;
            }
            $_GET['city'] = $city;
        }
        return false;
    } catch (Exception $e) {
        return true;
    }
}
Esempio n. 12
0
<?php

require_once __DIR__ . '/../all.php';
$cookies = new Cookies();
$user = $cookies->user_from_cookie();
$vars = array("itemid", "instructions");
// itemid, sideids
if (set_vars($_POST, $vars)) {
    $itemid = $_POST["itemid"];
    $instr = $_POST["instructions"];
    unset($_POST["itemid"]);
    unset($_POST["instructions"]);
    $sides = array();
    foreach ($_POST as $k => $v) {
        if ($k != "side") {
            $sides[] = $k;
        } else {
            $sides[] = $v;
        }
    }
    echo $user->add_to_cart($itemid, $sides, $instr);
} else {
    echo json_array(-1, $_POST);
}
function update_data($old, $new)
{
    if (empty($old) || $old === null || $new === null || empty($new)) {
        return $new;
    }
    $old_type = "default";
    if (is_scalar($old)) {
        $old_type = "scalar";
    } elseif (is_object($old)) {
        $old_type = "object";
    } elseif (is_array($old)) {
        $old_type = "array";
    }
    $old_object = json_object($old);
    if ($old_object === null) {
        return $old;
    }
    $new_object = json_object($new);
    if ($new_object === null) {
        return $old;
    }
    $updated_data = update_data_object($old_object, $new_object);
    switch ($old_type) {
        case "scalar":
            $result = json_string($updated_data);
            break;
        case "object":
            $result = json_object($updated_data);
            break;
        case "array":
            $result = json_array($updated_data);
            break;
        default:
            $result = $updated_data;
    }
    return $result;
}
Esempio n. 14
0
               }
            }
            if (count($exfollowers) != 0) {
               $tmhOAuth->request('GET', $tmhOAuth->url('1/users/lookup'), array(
                   'user_id' => implode(",", $exfollowers),
               ));
               ?>
               <table cellspacing="15px" cellpadding="0" style="border: 1px solid #8ec1da; background-color: #c0deed; width: auto" align="center">
                  <tbody>
                     <tr><th colspan="2" style="text-align: center"><?= count($exfollowers) ?> persona(s) te han dejado de seguir:</th></tr>
                     <tr>
                        <th colspan="2">Nombre (@usuario)</th>
                     </tr>
                     <tr><td colspan="2"><hr style="width: 250px"></td></tr>
                     <?
                     $exfollowers_data = json_array($tmhOAuth->response['response']);
                     if (!is_array($exfollowers_data)) {
                        $exfollowers_data = array();
                     }
					 
					 $unfollows = '';
					 
                     foreach ($exfollowers_data as $exfollower) {
					 $unfollows .= "{$exfollower[id]}=".strtotime($tmhOAuth->response['headers']['date']).";";
					 $exfollower = array_object($exfollower);
                        ?>
                        <tr>
                           <td>
                              <a title="<?= iconv("UTF-8", "ISO-8859-1//TRANSLIT", $exfollower->description) ?>" hreflang="en" target="_blank" href="http://twitter.com/<?= $exfollower->screen_name ?>"><img border="0" width="48" height="48" style="vertical-align: middle;" src="<?= $exfollower->profile_image_url ?>" alt="Imagen"></a>
                           </td>
                           <td>
Esempio n. 15
0
         //Twittear
         if ($_COOKIE['twitear'] != "no") {
            $tmhOAuth->request('POST', $tmhOAuth->url('1/statuses/update'), array(
                'status' => utf8_encode("Usando las Twit-Herramientas \"Retwits de mis twits\": Averigua cuáles de tus twits han sido retwiteados. ") . KCY,
            ));
         }
		 
		
		$tmhOAuth->request('GET', $tmhOAuth->url('1/statuses/retweets_of_me'), array(
			'count' => 100
		));
		
		$usersdata = Array();
		$usermentions = Array();
		$retweets = json_array($tmhOAuth->response['response']);
		
		
		?>
		  <table cellspacing="15px" cellpadding="0" style="border: 1px solid #8ec1da; background-color: #c0deed" align="center">
               <tbody>
                  <tr><th colspan="2" style="text-align: center">Mostrando tus 100 últimos twits con retwits:</th></tr>
                  <?
                  if (!is_array($traidores_data)) {
                     $traidores_data = array();
                  }
					foreach($retweets as $retweet) {
							$user_data = array_object($retweet['user']);
							$retweet_data = array_object($retweet);
                     ?>
                     <tr>
Esempio n. 16
0
                $orderedOrder["timeSince"] = $di->d;
                $orders[] = $orderedOrder;
            }
        }
    }
    $keys = array("category_id", "timeSince", "campus");
    $orders = array_orderby($orders, $keys[$f - 1], SORT_ASC);
    $orders = refineArrayReductively($orders, array("category_id", "campus", "timeSince"));
    return $orders;
    // t = time, s = service, f = filter, c = company
}
function generateHTMLFromData($data)
{
    $html = '';
    $start = $end = "";
    $fmt = "\n        <div class='order-info'>\n            <div class='order-time'>%s</div>\n            <div class='order-restaurant'>%s</div>\n            <div class='order-name'>%s<br>%s<br>%s</div>\n            <div class='order-address'>%s<br>%s<br>%s, %s<br>%s</div>\n            <div class='order-items'>%s</div>\n            <div class='order-total'><span class='pretotal'>TOTAL </span> %s</div>\n            <br><br>\n        </div>\n        ";
    $html .= htmlLoop($data, $start, $fmt, $end);
    return $html;
}
if (set_vars($_POST, $vars)) {
    $orderData = returnOrderedFeed(intval($_POST["0"]), intval($_POST["1"]), intval($_POST["2"]), intval($_POST["3"]));
    if ($orderData === "") {
        echo json_array(0);
    } else {
        $orderHTML = generateHTMLFromData($orderData);
        echo json_array(1, $orderHTML);
    }
    //    return $user->add_address($_POST["street"], $_POST["apartment"], $_POST["city"], $_POST["state"], $_POST["zipcode"]);
} else {
    echo json_array(0);
}