function InsertNewNode() { global $splayTree; // Insert new node with a unique key. $key = null; do { $key = GenerateKey(); } while (!is_null($splayTree->find($key))); $payload = GeneratePayloadTree(kSplayTreePayloadDepth, (string) $key); $splayTree->insert($key, $payload); return $key; }
function GetVideo_HTML5($key, $hdstyle) { //高清格式信息 $hdstr = array(0 => "720P", 1 => "350", 2 => "1080P", 3 => "1000"); $video['Nowhds'] = $hds = $hdstyle >= 0 && $hdstyle < 4 ? $hdstyle : 0; $video['mixhds'] = 4; //许可 $url = 'http://api.letv.com/time?tn=' . microtime(); $content = getfile($url, 'http://www.letv.com'); $content = json_decode($content); if (empty($content->stime)) { return; } $tkey = GenerateKey($content->stime); //GenerateKey(time()) if (!is_numeric($tkey)) { return; } //加载信息..// http://api.letv.com/mms/out/common/geturl/http://api.letv.com/mms/out/video/playJson $info = getfile('http://api.letv.com/mms/out/video/playJson?id=' . $key . '&platid=1&splatid=101&domain=www.letv.com&tkey=' . $tkey, 'http://m.letv.com', null); $json = json_decode($info); $playurl = $json->playurl; //视频路径 $hd = $hdstr[$hds]; //乐视域名 $domain = $playurl->domain[0]; $ur = $json->playurl->dispatch; $dispatch = get_object_vars($ur); //Ultra-clear format if (array_key_exists("1000", $dispatch)) { $vurl = $dispatch["1000"][0]; } elseif (array_key_exists("1080P", $dispatch)) { $vurl = $dispatch["1080P"][0]; } elseif (array_key_exists("720P", $dispatch)) { $vurl = $dispatch["720P"][0]; } else { $vurl = $dispatch["350"][0]; } $url = str_replace("tss=ios", "tss=no", $vurl) . '&format=1&sign=letv&expect=3000&rateid=' . $hd; $dour = $domain . $url; $vid = getfile($dour, 'http://www.letv.com'); $content = json_decode($vid); $video['data'][0]['src'] = $content->location; if (empty($video['data'][0]['src'])) { return false; } return $video; }
WHERE k.table LIKE "items" AND i.id=' . $_POST['item_id']); //unsalt previous pw and encrupt with personal key $pw = substr(decrypt($original_data['pw']), strlen($original_data['rand_key'])); $pw = encrypt($pw, mysql_real_escape_string(stripslashes($_SESSION['my_sk']))); //update pw $db->query_update('items', array('pw' => $pw, 'perso' => 1), "id='" . $_POST['item_id'] . "'"); //Delete key $db->query_delete('keys', array('id' => $_POST['item_id'], 'table' => 'items')); } else { if ($data_source['personal_folder'] == 1 && $data_destination['personal_folder'] == 1) { //NOTHING TO DO => just update is needed. Item key is the same } else { if ($data_source['personal_folder'] == 1 && $data_destination['personal_folder'] == 0) { //generate random key $random_key = GenerateKey(); //store key $db->query_insert('keys', array('table' => 'items', 'id' => $_POST['item_id'], 'rand_key' => $random_key)); //update item $db->query_update('items', array('pw' => encrypt($random_key . decrypt($data_source['pw'], mysql_real_escape_string(stripslashes($_SESSION['my_sk'])))), 'perso' => 0), "id='" . $_POST['item_id'] . "'"); } } } } break; } } if (isset($_POST['type'])) { //Hide the ajax loader image //echo 'document.getElementById(\'div_loading\').style.display = "none";'; }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with phpMCWeb. If not, see <http://www.gnu.org/licenses/>. */ ?> <pre>Enter the password that you require a salt for.<br /> Passwords must be more 8 or more characters.<br /> You require both the salt and original password to use phpMCWeb & JSONAPI</pre> <form id="form1" name="form1" method="post" action="saltgenerator.php"> <input type="text" name="password" /> <input type="submit" name="button" value="Generate!" /> </form> <?php $password = $_POST["password"]; function GenerateKey() { $string = ""; $possible = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; for ($i = 0; $i < 40; $i++) { $char = $possible[mt_rand(0, strlen($possible) - 1)]; $string .= $char; } return $string; } echo "<pre>"; if ($password != "" && strlen($password) >= 8) { $key = GenerateKey(); echo "Salt: " . crypt($password, "\$5{$rounds}=" . rand(1000, 999999) . "\$" . $key . "\$"); } echo "</pre>";