public function run(&$param) { // 已经登陆了,不需要自动登陆 if (session('?user')) { return; } $cookieText = cookie('user_autoSignIn'); // 没有自动登陆cookie,也不需要自动登陆 if (!$cookieText) { return; } // 解密,正常格式为“phone|md5(password)” $rawText = my_decrypt($cookieText); $arr = explode('|', $rawText); // 这可能是非法cookie了 if (!is_array($arr) || count($arr) != 2) { return; } list($phone, $md5Passwd) = $arr; $row = D('Common/User')->handleAutoSignIn($phone, $md5Passwd); // 校验失败了,这个cookie肯定有问题,删掉 if (!is_array($phone)) { cookie('user_autoSignIn', null); return; } // 自动登陆成功了,将用户数据放进session session('user', $row); }
function GetLocalSafeList() { include "ObsceneClean.settings.php"; DebugToLog('DEBUG: in GetLocalSafeList - Load local safe list'); /*-------------------------------------------------- Define data files location ------------------------------------ */ $TheFileToOpen = 'LocalSafeList.dat'; if ($DataDir == "") { $app_root = dirname(__FILE__); $FTfile = $app_root . '/' . 'dat' . '/' . $TheFileToOpen; } else { $FTfile = $DataDir . '/' . $TheFileToOpen; } putenv("ALPHADATA9=TRUE"); $thefile = fopen($FTfile, 'r'); if ($thefile) { $FileContents = fread($thefile, filesize($FTfile)); } fclose($thefile); putenv("ALPHADATA9="); /* ----------------------------- setup encryption parms, modules then decrypt all ----------------------------------- */ $AllSafeWords = my_decrypt($FileContents, $key); /* ----------------------------- put em in an array -------------------------------------------------------------------------- */ $LocalSafeList = explode("\n", $AllSafeWords); $WhitespacesCount = count($WhitespaceArray); for ($x = 0; $x < $WhitespacesCount; $x++) { $ReplaceArray[$x] = "\\s{0,3}"; } $array_elements = count($LocalSafeList); for ($i = 0; $i < $array_elements; $i++) { $LocalSafeList[$i] = '/' . preg_quote(rtrim($LocalSafeList[$i])) . '/i'; $LocalSafeList[$i] = str_replace($WhitespaceArray, $ReplaceArray, $LocalSafeList[$i]); } DebugToLog('DUMP: Local safe list: ' . print_r($LocalSafeList, TRUE)); return $LocalSafeList; }
function _send_amazon_contact($merchant, $credentials, $violation_message) { $seller_id = $merchant['seller_id']; $merchant_url = "http://www.amazon.com/gp/help/seller/home.html?seller=" . $seller_id; //echo "merchant_url: $merchant_url\n"; $html_contents = $this->HTTP_fetch($merchant_url, 'amazon', 'GET'); $this->saveAmazonCommentFormHtml('seller_home', $html_contents); // parse A tag and get merchant ID if (!preg_match_all('/<a href=.*?<\\/a>/is', $html_contents, $atags)) { return 'Failed to find A-tags!'; } //echo "atags\n"; print_r($atags); $contact_page_url = ""; for ($i = 0; $i < count($atags[0]); $i++) { $text = trim(strip_tags($atags[0][$i])); //echo "text: $text\n"; if ($text == 'Contact the seller') { $str = str_replace(array("\r", "\n"), '', $atags[0][$i]); if (preg_match_all('/<a[^>]+href=([\'"])(.+?)\\1[^>]*>/i', $str, $result)) { //echo "hrefs\n"; print_r($result); exit; $contact_page_url = $result[2][0]; break; } } } if ($contact_page_url == '') { return 'Failed to find a "Contact the seller" URL!'; } $contact_page_url = str_replace("&", "&", $contact_page_url); $temp = explode("?", $contact_page_url); $temp = explode("&", $temp[1]); $parameters = array(); for ($i = 0; $i < count($temp); $i++) { $p = explode("=", $temp[$i]); $parameters[$p[0]] = isset($p[1]) ? $p[1] : ""; } if (!isset($parameters['marketplaceID']) || !isset($parameters['sellerID'])) { return "Failed to find marketplaceID or sellerID from URL: " . $merchant_url; } $contact_page_url = "https://www.amazon.com/gp/help/contact/contact.html?ie=UTF8&asin=&isCBA=&marketplaceID=" . $parameters['marketplaceID'] . "&orderID=&ref_=aag_m_fi&sellerID=" . $parameters['sellerID']; $signin_page_url = "https://www.amazon.com/ap/signin?_encoding=UTF8&openid.assoc_handle=usflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=900&openid.return_to=" . urlencode($contact_page_url); $html_contents = $this->HTTP_fetch($signin_page_url, 'amazon'); $this->saveAmazonCommentFormHtml('signin_page', $html_contents); /******************************************* * * Signin Form * *******************************************/ if (!preg_match('/<form name="signIn".*?<\\/form>/is', $html_contents, $form)) { return "Failed to find a signin form"; } $form = $form[0]; //echo "form: $form\n"; // find the action of the login form if (!preg_match('/action="([^"]+)"/i', $form, $action)) { return 'Failed to find login form url'; } $signin_form_action = $action[1]; // this is our new post url //echo "signin_form_action: $signin_form_action\n"; $postFields = $this->extract_hidden_inputs_from_html_form($form); // add our login values $postFields['email'] = $credentials['email']; $postFields['create'] = 0; $postFields['password'] = my_decrypt($credentials['password']); //print_r($postFields); exit; $html_contents = $this->HTTP_fetch($signin_form_action, 'amazon', 'POST', $postFields, $signin_page_url); $this->saveAmazonCommentFormHtml('signin_form', $html_contents); if (strpos($html_contents, 'we limit the number of e-mails sent between buyers and sellers per day') !== false) { // There were > 20 msgs to the same seller return "Amazon has blocked us temporarily"; } /******************************************* * * Contact Option Form * *******************************************/ if (!preg_match('/<form action="\\/gp\\/help\\/contact\\/contact.html".*?<\\/form>/is', $html_contents, $form)) { $message = 'Failed to find a contact form'; //$this->AmazonSetting->updateStatus($credentials['id'], 1, $message); return $message; } $form = $form[0]; // find the action of the contact form if (!preg_match('/action="([^"]+)"/i', $form, $action)) { $message = 'Failed to find contact form url'; return $message; } $contact_form_action = $action[1]; // this is our new post url if (substr($contact_form_action, 0, 4) != 'http') { $contact_form_action = "https://www.amazon.com" . $contact_form_action . "?"; } // find all hidden fields // add our contact option values $formFields = $this->extract_hidden_inputs_from_html_form($form); $formFields['assistanceType'] = "asin"; $formFields['subject'] = 5; $formFields['writeMessageButton'] = "Write message"; $contact_form_action .= http_build_query($formFields); //echo "contact_form_action: $contact_form_action\n"; $html_contents = $this->HTTP_fetch($contact_form_action, 'amazon', 'GET'); $this->saveAmazonCommentFormHtml('contact_form', $html_contents); if (!preg_match('/<form id="writeMessageForm".*?<\\/form>/is', $html_contents, $form)) { $message = 'Failed to find a write form'; return $message; } /******************************************* * * Write Message Form * *******************************************/ $form = $form[0]; // find the action of the contact form if (!preg_match('/action="([^"]+)"/i', $form, $action)) { $message = 'Failed to find write form url'; return $message; } $write_form_action = $action[1]; // this is our new post url if (substr($write_form_action, 0, 4) != 'http') { $write_form_action = "https://www.amazon.com/gp/help/contact/contact.html" . $write_form_action; } // add our contact option values $form_fields = $this->extract_hidden_inputs_from_html_form($form); $form_fields['sendEmailButton'] = "Send e-mail"; $form_fields['commMgrComments'] = $violation_message; if ($this->_test_violator_notifications) { $message = "We got to the final step in amazon POST, {$credentials['email']} {$this->_amazon_connection_ctr}. Looks OK so far :) <br>\n"; //$message .= $violation_message . "<hr><br>\n<br>\n"; return $message; } $html_contents = $this->HTTP_fetch($write_form_action, 'amazon', 'POST', $form_fields); $this->saveAmazonCommentFormHtml('write_form', $html_contents); /******************************************* * * Check result * *******************************************/ if (preg_match('/<div class="message success.*?<\\/div>/is', $html_contents, $divSucces)) { //echo "<h1>Success</h1>"; } else { $message = 'Failed to send amazon message to violator.'; return $message; } return TRUE; }
function show_checksum($path) { show_header(); $_SESSION['last_seen'] = my_encrypt(time()); $username = my_decrypt($_SESSION['username']); $fullname = my_decrypt($_SESSION['fullname']); echo "<div class='row'>\n"; echo "\t<h1 class='col-md-7'><a href='/'>" . htmlentities($GLOBALS['config']['my_site_name']) . "</a></h1>\n"; echo "\t<div class='col-md-5 text-right my-userinfo'>\n"; echo "\t\t" . htmlentities($fullname) . " \n"; echo "\t\t(" . htmlentities($username) . ") \n"; echo "\t\t<a class='btn btn-primary' href='/index.php?logout'>Sign out <i class='fa fa-sign-out'></i></a>\n"; echo "\t</div>\n"; echo "</div>\n"; echo "<div class='panel panel-default'>\n"; echo "\t<div class='panel-heading'>" . basename($path) . "</div>\n"; echo "\t<table class='table'>\n"; echo "\t<tbody>\n"; if (filesize($path) > 1 * 1024 * 1024 * 1024) { echo "\t\t<tr><td>[ File too large to hash online ]</td></tr>\n"; } else { echo "\t\t<tr><td class='col-md-1'>MD5</td><td class='col-md-11'>" . hash_file('md5', $path) . "</td></tr>\n"; echo "\t\t<tr><td class='col-md-1'>SHA1</td><td class='col-md-11'>" . hash_file('sha1', $path) . "</td></tr>\n"; } echo "\t</tbody>\n"; echo "\t</table>\n"; echo "</div>\n\n\n\n\n"; show_footer(); }
<label class="label_email" for="email">Login Name:</label> <input type="text" name="ID<?php echo $ctr; ?> _email" id="email" class="validate[email] medium input_email" value="<?php echo @$arr['email']; ?> " /> </fieldset> <fieldset> <label class="label_password" for="password">Login Password:</label> <input type="text" name="ID<?php echo $ctr; ?> _password" id="password" class="medium input_password" value="<?php echo @my_decrypt($arr['password']); ?> "/> </fieldset> </div> <?php } ?> <?php if ($ctr >= 5) { ?> <!-- max 5 login accounts allowed --> <hr /> <p>