/** * Class instantiator * * @return captcha */ function __construct() { global $plugin_is_filter; if (OFFSET_PATH == 2) { setOptionDefault('zenphoto_captcha_length', 5); setOptionDefault('zenphoto_captcha_font_size', 18); setOptionDefault('zenphoto_captcha_key', sha1($_SERVER['HTTP_HOST'] . 'a9606420399a77387af2a4b541414ee5' . getUserIP())); setOptionDefault('zenphoto_captcha_string', 'abcdefghijkmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWXYZ'); } }
/** * * Logs User searches * @param array $search_statistics the search criteria * @param string $type 'album', 'image', etc. * @param bool $success did the search return a result * @param bool $dynamic was it from a dynamic album * @param int $iteration count of the filters since the search engine instantiation */ static function handler($search_statistics, $type, $success, $dynamic, $iteration) { if (!$dynamic) { // log unique user searches $store = array('type' => $type, 'success' => $success, 'iteration' => $iteration, 'data' => $search_statistics); $sql = 'INSERT INTO ' . prefix('plugin_storage') . ' (`type`, `aux`,`data`) VALUES ("search_statistics", ' . db_quote(getUserIP()) . ',' . db_quote(serialize($store)) . ')'; query($sql); } return $search_statistics; }
/** * Adds default values to comment form data * * NOTE: the indices available are: * 'name' * 'website' * 'anon' * 'street' * 'city' * 'state' * 'country' * 'postal' * 'private' * * @param array $defaults */ function example_comment_form_defaults($defaults) { // set the web field to the browser IP if it is not otherwise set. if (empty($defaults['data']['website'])) { $defaults['data']['website'] = 'http://' . getUserIP(); } // disable the anonymous and private checkboxes (could also reset the options, but this is an example after all!) $defaults['data']['anon'] = 0; $defaults['disabled']['anon'] = ' disabled="disabled"'; $defaults['data']['private'] = 0; $defaults['disabled']['private'] = ' disabled="disabled"'; return $defaults; }
/** * Login * @return bool */ public function login() { if ($this->_identity === null) { $this->_identity = new UserIdentity($this->username, $this->password); $this->_identity->authenticate(); } if ($this->_identity->errorCode === UserIdentity::ERROR_NONE) { $duration = $this->rememberMe ? 3600 * 24 * 30 : 0; // 30 days if (($user = $this->user) !== null) { $user->saveAttributes(array('login_time' => $user->login_time + 1, 'login_ip' => getUserIP(), 'login_attempts' => NULL)); } Yii::app()->user->login($this->_identity, $duration); return true; } }
/** * Check the user IP if we need to ban him */ protected function checkIPBlock() { // array's of banned IP addresses $bannedIPS = getParam('ban_ips'); $userIP = getUserIP(); $blockedAddresses = explode("\n", $bannedIPS); $redirectTo = getParam('ban_ips_redirect_url'); // Check every ip address if ($bannedIPS && is_array($blockedAddresses) && count($blockedAddresses)) { if (in_array($userIP, $blockedAddresses)) { // this is for exact matches of IP address in array header("Location: " . $redirectTo); exit; } else { // this is for wild card matches foreach ($blockedAddresses as $ip) { if (preg_match('~' . $ip . '~', $userIP)) { header("Location: " . $redirectTo); exit; } } } } }
/** * Logs setup actions * @param bool $success * @param string $action * @param string $file */ function security_logger_log_setup($success, $action, $txt) { list($user, $name) = security_logger_populate_user(); security_logger_loginLogger($success, $user, $name, getUserIP(), $action, 'zp_admin_auth', $txt); return $success; }
function handleOption($option, $currentValue) { switch ($option) { case 'hitcounter_set_defaults': ?> <script language="javascript" type="text/javascript"> // <!-- <![CDATA[ function hitcounter_defaults() { $('#hitcounter_ignoreIPList').val(''); $('#hitcounter_ip_button').removeAttr('disabled'); $('#hitcounter_ignoreIPList_enable').removeAttr('checked'); $('#hitcounter_ignoreSearchCrawlers_enable').removeAttr('checked'); $('#hitcounter_searchCrawlerList').val('<?php echo $this->defaultbots; ?> '); } // ]]> --> </script> <label><input id="hitcounter_reset_button" type="button" value="<?php echo gettext('Defaults'); ?> " onclick="hitcounter_defaults();" /></label> <?php break; case 'hitcounter_ignoreIPList': ?> <input type="hidden" name="<?php echo CUSTOM_OPTION_PREFIX; ?> 'text-hitcounter_ignoreIPList" value="0" /> <input type="text" size="30" id="hitcounter_ignoreIPList" name="hitcounter_ignoreIPList" value="<?php echo html_encode($currentValue); ?> " /> <script language="javascript" type="text/javascript"> // <!-- <![CDATA[ function hitcounter_insertIP() { if ($('#hitcounter_ignoreIPList').val() == '') { $('#hitcounter_ignoreIPList').val('<?php echo getUserIP(); ?> '); } else { $('#hitcounter_ignoreIPList').val($('#hitcounter_ignoreIPList').val()+',<?php echo getUserIP(); ?> '); } $('#hitcounter_ip_button').attr('disabled','disabled'); } jQuery(window).load(function(){ var current = $('#hitcounter_ignoreIPList').val(); if (current.indexOf('<?php echo getUserIP(); ?> ') < 0) { $('#hitcounter_ip_button').removeAttr('disabled'); } }); // ]]> --> </script> <label><input id="hitcounter_ip_button" type="button" value="<?php echo gettext('Insert my IP'); ?> " onclick="hitcounter_insertIP();" disabled="disabled" /></label> <?php break; } }
$_SESSION['userid'] = $lologin4['ids']; $_SESSION['username'] = $lologin4['username']; $_SESSION['status'] = $lologin4['status']; $_SESSION['team'] = $lologin4['team']; $_SESSION['readSticky'] = $lologin4['readSticky']; $_SESSION['acceptedRules'] = $lologin4['acceptedRules']; $_SESSION['hasLicense'] = $lologin4['hasLicense']; $_SESSION['transferGesperrt'] = FALSE; $_SESSION['last_forumneu_anzahl'] = 0; // LOGIN-LOG ANFANG if (isset($_SERVER['HTTP_USER_AGENT'])) { $loginLog_userAgent = mysql_real_escape_string(trim(strip_tags($_SERVER['HTTP_USER_AGENT']))); } else { $loginLog_userAgent = ''; } $loginLog_ip = getUserIP(); if (isset($_COOKIE['uniqueHash'])) { $loginLog_uniqueHash = mysql_real_escape_string(trim(strip_tags($_COOKIE['uniqueHash']))); } else { $loginLog_uniqueHash = $loginLog_ip; setcookie('uniqueHash', $loginLog_ip, getTimestamp('+30 days'), '/', str_replace('www.', '.', CONFIG_SITE_DOMAIN), FALSE, TRUE); } if (!in_array($lologin4['ids'], unserialize(CONFIG_PROTECTED_USERS))) { $loginLog1 = "INSERT INTO " . $prefix . "loginLog (user, zeit, ip, userAgent, uniqueHash) VALUES ('" . $lologin4['ids'] . "', " . time() . ", '" . $loginLog_ip . "', '" . $loginLog_userAgent . "', '" . $loginLog_uniqueHash . "')"; $loginLog2 = mysql_query($loginLog1); } // LOGIN-LOG ENDE // MAXIMALGEBOT ANFANG $tageHier = (time() - $lologin4['regdate']) / 86400; if ($tageHier < 0.08) { $_SESSION['pMaxGebot'] = 0;
$sql2 = mysql_query($sql1); } else { $sql1 = "UPDATE " . $prefix . "users SET last_login = 1, last_urlaub_kurz = 0, last_urlaub_lang = 0, last_uagent = '', infotext = '', username = CONCAT('GELOESCHT', id) WHERE ids = '" . $cookie_id . "'"; $sql2 = mysql_query($sql1); } $sql11 = "DELETE FROM " . $prefix . "pn WHERE von = '" . $cookie_id . "' OR an = '" . $cookie_id . "'"; $sql12 = mysql_query($sql11); $sql11 = "DELETE FROM " . $prefix . "freunde WHERE f1 = '" . $cookie_id . "' OR f2 = '" . $cookie_id . "'"; $sql12 = mysql_query($sql11); $sql11 = "DELETE FROM " . $prefix . "freunde_anfragen WHERE von = '" . $cookie_id . "' OR an = '" . $cookie_id . "'"; $sql12 = mysql_query($sql11); $howLong1 = "SELECT regdate FROM " . $prefix . "users WHERE ids = '" . $cookie_id . "'"; $howLong2 = mysql_query($howLong1); if (mysql_num_rows($howLong2) == 1) { $howLong3 = mysql_fetch_assoc($howLong2); $wielange1 = "INSERT INTO " . $prefix . "abmeldungen (zeit, username, liga, dabei, ip) VALUES (" . time() . ", '" . $cookie_username . "', '" . $cookie_liga . "', " . intval(time() - $howLong3['regdate']) . ", '" . getUserIP() . "')"; $wielange2 = mysql_query($wielange1); } header('Location: /logout.php'); exit; } $get_urlaub1 = "SELECT urlaub, email FROM " . $prefix . "users WHERE ids = '" . $cookie_id . "'"; $get_urlaub2 = mysql_query($get_urlaub1); $get_urlaub3 = mysql_fetch_assoc($get_urlaub2); $noch_urlaub = $get_urlaub3['urlaub']; $mailAdresse = $get_urlaub3['email']; $get_urlaub4 = "SELECT ende FROM " . $prefix . "urlaub WHERE user = '******'"; $get_urlaub5 = mysql_query($get_urlaub4); if (mysql_num_rows($get_urlaub5) > 0) { $get_urlaub6 = mysql_fetch_assoc($get_urlaub5); if ($get_urlaub6['ende'] > time()) {
/** * * Encodes a cookie value tying it to the user IP * @param $value */ function zp_cookieEncode($value) { if (IP_TIED_COOKIES) { return rc4(getUserIP() . HASH_SEED, $value); } else { return $value; } }
<?php @session_set_cookie_params(3600 * 24 * 14, '/', str_replace('www.', '.', CONFIG_SITE_DOMAIN), false, true); @session_start(); if (isset($_SESSION['loggedin']) and $_SESSION['loggedin'] == 1) { $loggedin = $_SESSION['loggedin']; $cookie_id = $_SESSION['userid']; $cookie_username = $_SESSION['username']; $cookie_liga = $_SESSION['liga']; $cookie_team = $_SESSION['team']; $cookie_teamname = $_SESSION['teamname']; $cookie_scout = $_SESSION['scout']; if (mt_rand(1, 3) == 2) { // nur bei jedem dritten Seitenaufruf $last_login1 = "UPDATE " . $prefix . "users SET verwarnt = 0, last_login = "******", last_ip = '" . getUserIP() . "'"; if (isset($_SERVER['HTTP_USER_AGENT'])) { $last_login1 .= ", last_uagent = '" . mysql_real_escape_string(trim(strip_tags($_SERVER['HTTP_USER_AGENT']))) . "'"; } if (isset($_COOKIE['uniqueHash'])) { $last_login1 .= ", last_uniqueHash = '" . mysql_real_escape_string(trim(strip_tags($_COOKIE['uniqueHash']))) . "'"; } $last_login1 .= " WHERE ids = '" . $cookie_id . "'"; $last_login2 = mysql_query($last_login1); } } else { $loggedin = 0; $cookie_id = ''; $cookie_username = ''; $cookie_liga = ''; $cookie_team = '';
function reportError($error = "") { global $mail; global $appname; // generating message $message = "An error happened in " . $appname . ":"; $message .= "\n\nTime..... " . date("d.m.Y-H:i", time()); $message .= "\nIP....... http://www.utrace.de/?query=" . getUserIP(); $message .= "\nHeader... " . $_SERVER['HTTP_USER_AGENT']; $message .= "\nError.... " . $error; // sending error report by mail to given mail address $sended = mail($mail, "Error Report " . $appname, $message, "From: " . $appname . " <" . $mail . ">"); // check if mail was being send if (!$sended) { return false; } return true; }
/** * Makes sure usernames are lowercase * (emails by standard can have uppercase letters) * @return parent::beforeValidate */ public function beforeValidate() { if ($this->isNewRecord) { $this->create_time = new CDbExpression('NOW()'); $this->activation_key = $this->generate_activation_key(); } $this->update_time = new CDbExpression('NOW()'); $this->login_ip = getUserIP(); if (!empty($this->username)) { $this->username = strtolower($this->username); } return parent::beforeValidate(); }
/** * Logs an attempt for a guest user to log onto the site * Returns the "success" parameter. * * @param bool $success * @param string $user * @param string $pass * @param string $athority what kind of login * @return bool */ function guestLoginLogger($success, $user, $pass, $athority) { loginLogger($success, $user, $pass, '', getUserIP(), 'frontend', $athority); return $success; }
/** * * Counts the hitcounter for the page/object * @param string $script * @param bool $valid will be false if the object is not found (e.g. there will be a 404 error); * @return string */ static function load_script($script, $valid) { if ($script && $valid) { if (getOption('hitcounter_ignoreIPList_enable')) { $ignoreIPAddressList = explode(',', str_replace(' ', '', getOption('hitcounter_ignoreIPList'))); $skip = in_array(getUserIP(), $ignoreIPAddressList); } else { $skip = false; } if (getOption('hitcounter_ignoreSearchCrawlers_enable') && !$skip && array_key_exists('HTTP_USER_AGENT', $_SERVER) && ($agent = $_SERVER['HTTP_USER_AGENT'])) { $botList = explode(',', getOption('hitcounter_searchCrawlerList')); foreach ($botList as $bot) { if (stripos($agent, trim($bot))) { $skip = true; break; } } } if (!$skip) { global $_zp_gallery_page, $_zp_current_album, $_zp_current_image, $_zp_current_article, $_zp_current_page, $_zp_current_category; if (checkAccess()) { // count only if permitted to access switch ($_zp_gallery_page) { case 'album.php': if (!$_zp_current_album->isMyItem(ALBUM_RIGHTS) && getCurrentPage() == 1) { $_zp_current_album->countHit(); } break; case 'image.php': if (!$_zp_current_album->isMyItem(ALBUM_RIGHTS)) { //update hit counter $_zp_current_image->countHit(); } break; case 'pages.php': if (class_exists('CMS') && !zp_loggedin(ZENPAGE_PAGES_RIGHTS)) { $_zp_current_page->countHit(); } break; case 'news.php': if (class_exists('CMS') && !zp_loggedin(ZENPAGE_NEWS_RIGHTS)) { if (is_NewsArticle()) { $_zp_current_article->countHit(); } else { if (is_NewsCategory()) { $_zp_current_category->countHit(); } } } break; default: if (!zp_loggedin()) { $page = stripSuffix($_zp_gallery_page); setOption('Page-Hitcounter-' . $page, getOption('Page-Hitcounter-' . $page) + 1); } break; } } } } return $script; }
<?php /* OpenLinkMap Copyright (C) 2010 Alexander Matheisen This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See http://wiki.openstreetmap.org/wiki/OpenLinkMap for details. */ require_once "functions.php"; $format = $_GET['format']; $callback = $_GET['callback']; // request location for api $position = geoip_record_by_name(getUserIP()); if ($position) { if ($format == "xml") { echo xmlPositionOutput($position); } else { if ($format == "json") { echo jsonPositionOutput($position, $callback); } else { echo textPositionOutput($position); } } } else { echo "NULL"; } // output of position in xml format, given: position in format lat,lon function xmlPositionOutput($position) { if ($position) { $output = xmlStart("geolocation");
/** * Class instantiator * * @return captcha */ function captcha() { setOptionDefault('zenphoto_captcha_length', 5); setOptionDefault('zenphoto_captcha_key', sha1($_SERVER['HTTP_HOST'] . 'a9606420399a77387af2a4b541414ee5' . getUserIP())); setOptionDefault('zenphoto_captcha_string', 'abcdefghijkmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWXYZ'); }
/** * Checks the suspension list for the ip * @return boolean */ static function suspended() { if ($block = getOption('ipBlocker_forbidden')) { $block = getSerializedArray($block); if (array_key_exists($ip = getUserIP(), $block)) { if ($block[$ip] < time() - getOption('ipBlocker_timeout') * 60) { // cooloff period passed unset($block[$ip]); if (count($block) > 0) { setOption('ipBlocker_forbidden', serialize($block)); } else { setOption('ipBlocker_forbidden', NULL); } } else { return true; } } } return false; }
function getUserIP() { if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') > 0) { $addr = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']); return trim($addr[0]); } else { return $_SERVER['HTTP_X_FORWARDED_FOR']; } } else { return $_SERVER['REMOTE_ADDR']; } } if (isset($_GET['title']) && isset($_GET['des']) && isset($_GET['auto']) && isset($_GET['date'])) { include "config2.php"; $the_ip = getUserIP(); $result = mysql_query('SELECT UID FROM classes WHERE name="' . $_GET['auto'] . '"'); if (!$result) { echo 'Could not run query: 0' . mysql_error(); exit; } else { $row = mysql_fetch_array($result); if ($row[0] == "") { echo "Invalid Class '" . $_GET['auto'] . "'."; header('Location: add_hw.php?sucsses=0'); } else { echo "SUCCESS0"; } } $result = mysql_query('INSERT INTO homeworks (Title, Description, Date, IP) VALUES ("' . $_GET['title'] . '","' . $_GET['des'] . '","' . $_GET['date'] . '","' . $the_ip . '")');
/** * returns an XSRF token * @param striong $action */ function getXSRFToken($action) { global $_zp_current_admin_obj; return sha1($action . prefix(getUserIP()) . serialize($_zp_current_admin_obj) . session_id()); }
/*message construction*/ function getUserIP() { $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; if (filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif (filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } return $ip; } $user_ip = getUserIP(); $today = date("F j, Y"); /* Your Custom Text : Variable recieved*/ $message = "\n\t\t\t\tFullname : {$name}\n\t\t\t\tCompany : {$company}\n\t\t\t\tEmail : {$email}\n\t\t\t\tTelephone : {$telephone}\n\t\t\t\tClient Ip-Address: {$user_ip}\n\t\t\t\tDate: {$today}"; $to = '*****@*****.**'; $subject = $name . ' contacted you www.regencyspices.in/'; $headers = 'From: www.regencyspices.in/' . "\r\n" . 'Bcc: shettyabhishek08@gmail.com' . "\r\n"; mail($to, $subject, $message, $headers); echo '<script language="javascript">'; echo 'alert("Thank You. We will contact you soon.")'; echo '</script>'; echo '<script language="JavaScript"> window.location.href ="catalogue.zip"</script>'; echo '<script language="JavaScript">window.location.href ="index.html"</script>'; /* }else{ echo '<script language="javascript">'; echo 'alert("Bot Alert. Incorrect captcha.")';
$__previous = $v; } } if (OFFSET_PATH) { zp_register_filter('admin_tabs', 'accessThreshold::admin_tabs'); } else { $mu = new zpMutex('aT'); $mu->lock(); $recentIP = getSerializedArray(@file_get_contents(SERVERPATH . '/' . DATA_FOLDER . '/recentIP')); if (array_key_exists('config', $recentIP)) { $__time = time(); $__config = $recentIP['config']; if (!isset($__config['accessThreshold_LocaleCount'])) { $__config['accessThreshold_LocaleCount'] = 5; } $full_ip = getUserIP(); if (strpos($full_ip, '.') === false) { //ip v6 $separator = ':'; } else { $separator = '.'; } $x = array_slice(explode($separator, $full_ip), 0, $__config['accessThreshold_SENSITIVITY']); $ip = implode($separator, $x); unset($x); if (isset($recentIP[$ip]['lastAccessed']) && $__time - $recentIP[$ip]['lastAccessed'] > $__config['accessThreshold_IP_ACCESS_WINDOW']) { $recentIP[$ip] = array('accessed' => array(), 'locales' => array(), 'blocked' => 0, 'interval' => 0); } $recentIP[$ip]['lastAccessed'] = $__time; if (@$recentIP[$ip]['blocked']) { file_put_contents(SERVERPATH . '/' . DATA_FOLDER . '/recentIP', serialize($recentIP));
function verify_accounts_per_ip() { if ($this->accounts_per_ip) { $query = $this->db->query(sprintf("SELECT COUNT(`ip`) FROM `users` WHERE `ip` = '%s'", $this->db->real_escape_string(getUserIP()))); $result = $query->fetch_row(); if ($result[0] < $this->accounts_per_ip) { return true; } else { return false; } } else { return true; } }
$mail->SMTPSecure = CONFIG_EMAIL_SECURE; $mail->Host = CONFIG_EMAIL_HOST; $mail->Port = CONFIG_EMAIL_PORT; $mail->Username = CONFIG_EMAIL_USER; $mail->Password = CONFIG_EMAIL_PASS; $mail->SetFrom(CONFIG_EMAIL_FROM, CONFIG_SITE_NAME); $mail->Subject = $betreff; $mail->Body = $nachricht; $mail->AddAddress($empfaenger); $mail->Send(); } else { $header = "From: " . CONFIG_SITE_NAME . " <" . CONFIG_SITE_EMAIL . ">\r\nContent-type: text/plain; charset=utf-8"; mail($empfaenger, $betreff, $nachricht, $header); } } $last_ip = getUserIP(); $fehler_gemacht = TRUE; if (strlen($_POST['reg_email']) > 0 && strlen($_POST['reg_benutzername']) > 0) { $email = mysql_real_escape_string(trim(strip_tags($_POST['reg_email']))); $email_valide = preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i', $email); if ($email_valide == TRUE) { $username = mysql_real_escape_string(trim(strip_tags($_POST['reg_benutzername']))); $username = str_replace('_', '', $username); $password = mt_rand(1, 9) . mt_rand(1, 9) . mt_rand(1, 9) . mt_rand(1, 9) . mt_rand(1, 9) . mt_rand(1, 9); $password_db = md5('1' . $password . '29'); $blackList1 = "SELECT COUNT(*) FROM " . $prefix . "blacklist WHERE email = '" . md5($email) . "' AND until > " . time(); $blackList2 = mysql_query($blackList1); $blackList3 = mysql_result($blackList2, 0); $schon_vorhandene_user = $blackList3; $sql1 = "SELECT COUNT(*) FROM " . $prefix . "users WHERE email = '" . $email . "' OR username = '******'"; $sql2 = mysql_query($sql1);
<?php /* get the posted variables from the comment form */ $name = $_POST['name']; $email = $_POST['email']; $comment = $_POST['comment']; $date = date("F d, Y"); $getPost = mysql_query("SELECT * FROM blogposts WHERE blogpostnumber = '" . $p . "'"); $post = mysql_fetch_assoc($getPost); $ip = getUserIP(); /* return errors */ if (!$name) { commenterror("Please enter your full name before posting your comment."); } if (!$email) { commenterror("Please enter a valid email address before posting your comment."); } if (!$comment) { commenterror("The comment field can not be left blank."); } /* comment posted successfully */ if ($name && $email && $comment) { commentsuccess("Your comment has been posted successfully and is awaiting approval."); mysql_query("INSERT INTO blogcomments (blogpostid, comment, author, email, ipAddress, dateposted) VALUES ('" . $post['blogpostid'] . "','" . $comment . "','" . $name . "','" . $email . "','" . $ip . "','" . $date . "')"); } ?> <!-- include necessary javascript files --> <script type='text/javascript' src='../js/jquery.min.js'></script> <script type='text/javascript'>$('html, body').animate({ scrollTop: $(".blog-comments").offset().top }, 'slow');</script>
function trace($message = "", $num = null, $isLog = false, $showTrace = true, $fileName = false, $isAppend = false, $context = array(), $forceShowError = false, $arrIgnore = array()) { global $debugToFile, $errorTraceFolder; static $count = null; if ($arrIgnore) { extract($arrIgnore); } if (isset($debugToFile) && $debugToFile === true) { $fileName = dirname(__FILE__) . "/trace.html"; $isAppend = true; } $developerIP = defined("DEVELOPER_IP") ? DEVELOPER_IP : ""; if (!isset($message)) { $message = ""; } $isDebugValid = false; if (file_exists(realpath(".") . "/trace.ini")) { $arrINIData = parse_ini_file(realpath(".") . "/trace.ini"); if (isset($arrINIData["trace"])) { if ($traceNum > 0) { $num = $traceNum; } } $isDebugValid = true; } else { if ($forceShowError) { $isDebugValid = true; } else { if (isset($_REQUEST["trace"])) { $traceNum = trim($_REQUEST["trace"]); if (is_numeric($traceNum) && $traceNum > 0) { $num = $traceNum; } $isDebugValid = true; } else { if (defined("PHPTRACE_DISPLAY_ERROR") && PHPTRACE_DISPLAY_ERROR !== false) { $isDebugValid = true; if (PHPTRACE_DISPLAY_ERROR !== true) { $num = PHPTRACE_DISPLAY_ERROR; } } else { if (empty($developerIP)) { $isDebugValid = true; } else { if (!empty($developerIP)) { if ($developerIP == getUserIP()) { $isDebugValid = true; } } } } } } } if (!$isDebugValid) { return; } if (is_null($num)) { $count = null; } if (is_null($count)) { if (!is_null($num)) { $count = $num; } } $width = "40%"; if ($isLog) { $width = "100%"; } if (!file_exists("tmp/phptrace")) { mkdir("tmp/phptrace", 0777, true); } $debug = '<script type="text/javascript" src="js/jquery/jquery.js"></script> <link href="js/jquery/jqueryui.css" rel="stylesheet" type="text/css"/>; <script src="js/jquery/jqueryui.js"></script><script> $(document).ready(function() { $("#accordion").accordion({ heightStyle: "content" }); }); </script>'; $debug = $debug . "<table style='width:100%;'><tr><td style='vertical-align:top;width:{$width};'>"; //$debug=$debug.'---------------------TRACE START----------------------'; $debug = $debug . '<br>'; $debug = $debug . "<b>Total Errors:" . errorCount() . "</b><br />"; $debug = $debug . "<b>" . print_r($message, true) . "</b>"; //$debug=$debug.'<br>'; $arr = debug_backtrace(); /* if($arr[0]["function"]=="trace") { array_shift($arr); } if($arr[0]["function"]=="error_handler") { array_shift($arr); } */ $debug = $debug . '<div id="accordion">'; $arrDetails = null; $modaljs = '<script>function showDialog(v) { $( "#" + v ).dialog({ width:1200, height: 600, modal: true, position: "top" }); }</script>'; $dialog = ""; $tabcount = 0; foreach ($arr as $ind => $value) { if ($errorTraceFolder) { $isContinue = true; foreach ($errorTraceFolder as $ef) { if (strpos($value['file'], $ef) !== false) { $isContinue = false; break; } } if ($isContinue) { continue; } } $tabcount = $tabcount + 1; $debug = $debug . '<h3><a href="#" style="font-size:11px;">' . $tabcount . ') <b>file:</b>' . (isset($value['file']) ? $value['file'] : null) . ' '; $debug = $debug . (isset($value['class']) ? '<b>class:</b>' . $value['class'] . ' ' : ""); $debug = $debug . (isset($value['type']) ? '<b>type:</b>' . $value['type'] . ' ' : ""); $arg = isset($value["args"]) ? $value["args"] : ""; ///To Do // $arrVar=get_defined_constants(); $details = ""; if ($context && isset($value['function']) && $value['function'] == "trace") { if (isset($_REQUEST) && !empty($_REQUEST)) { ksort($_REQUEST); } $context["_REQUEST"] = $_REQUEST; if (isset($_SESSION) && !empty($_SESSION)) { ksort($_SESSION); } krsort($context); foreach ($context as $variable => $vvalue) { $details = '<a href="#" onclick="showDialog(\'' . $variable . '\')">' . $variable . "</a>, " . $details; $dialog = $dialog . '<div id="' . $variable . '" title="Data" style="overflow:scroll;width:100%;"> <p><pre>' . print_r($vvalue, true) . '</pre></p> </div>'; } } //$details=""; /// if (isset($value['function']) && $value['function'] == "trace") { unset($arg[6]); } else { if (isset($value['function']) && $value['function'] == "error_handler") { unset($arg[4]); } } $debug = $debug . '<b>function:</b>' . (isset($value['function']) ? $value['function'] : null) . ' <b>Container Function:</b>' . (isset($arr[$ind + 1]['function']) ? $arr[$ind + 1]['function'] : null) . ' <b>line:</b>' . (isset($value['line']) ? $value['line'] : null) . '</a></h3> <div> <p> <table style="width:1500px; padding:5px;"><tr><td style="width:1000px"><pre style="font-size:11px;">' . print_r($arg, true) . '</pre></td><td style="vertical-align:top;font-size:11px;">' . $details . '</td></tr></table> </p> </div> '; $arrDetails[$ind] = $value; unset($arrDetails[$ind]["file"]); unset($arrDetails[$ind]["line"]); unset($arrDetails[$ind]["function"]); unset($arrDetails[$ind]["class"]); unset($arrDetails[$ind]["type"]); unset($arrDetails[$ind]["object"]); if (!$showTrace) { break; } } $debug = $debug . '</div>'; if (!$isLog) { $debug = $debug . $modaljs . $dialog . '</td>'; } $debug = $debug . ' <br></td></tr></table>'; if (is_null($count)) { if ($fileName !== false) { if ($isAppend) { file_put_contents($fileName, $debug, FILE_APPEND); } else { file_put_contents($fileName, $debug); } return true; } else { echo $debug; } if (!$isLog) { exit; } } else { if ($count === 1) { if ($fileName !== false) { if ($isAppend) { file_put_contents($fileName, $debug, FILE_APPEND); } else { file_put_contents($fileName, $debug); } return true; } else { echo $debug; } $count = null; if (!$isLog) { exit; } } else { $count--; } } }
/** * * returns an "ID" tag for rating records */ static function id() { if (getOption('rating_hash_ip')) { return sha1(getUserIP()); } else { return getUserIP(); } }
file_put_contents("log.txt", $log, FILE_APPEND | LOCK_EX); } function download($ip) { logdl($ip); if ($_REQUEST['filename'] == 'zipball') { $count = file_get_contents("downloads.txt"); $count++; file_put_contents("downloads.txt", $count); @header('Location: https://github.com/articlefr/MyOCR/zipball/master'); } else { if ($_REQUEST['filename'] == 'tarball') { $count = file_get_contents("downloads.txt"); $count++; file_put_contents("downloads.txt", $count); @header('Location: https://github.com/articlefr/MyOCR/tarball/master'); } else { $file_path = realpath(dirname(__FILE__) . '/downloads/' . $_REQUEST['filename']); output_file($file_path, $_REQUEST['filename'], 'application/zip'); } } } //Set the time out //set_time_limit(0); //path to the file download(getUserIP()); //Call the download function with file path,file name and file type /* //This application is developed by www.webinfopedia.com //visit www.webinfopedia.com for PHP,Mysql,html5 and Designing tutorials for FREE!!! */
private function __log($msg) { if ($this->logger == true) { $fp = fopen($this->logfile, "a"); $str = "[" . date("d/m/Y h:i:s", mktime()) . "]#" . getUserIP() . "#" . $msg; fwrite($fp, $str . PHP_EOL); fclose($fp); } }
$privatekey = "6Lf_cwQAAAAAABqzTaoIRotTig-iFvtGnC7Hd_P0"; $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); /*if (!$resp->is_valid) { //die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); echo "CAPTCHA ERROR!!!"; exit; } else { */ //echo "CAPTCHA OK!!"; $userid = $_POST['userid']; $userpw = $_POST['userpw']; $usernk = $_POST['usernk']; $email = $_POST['email']; $birthday = sprintf("%s-%s-%s", $_POST['birth_y'], $_POST['birth_m'], $_POST['birth_d']); require LIBRARY_PATH . "function.php"; $userIP = getUserIP(); //require LIBRARY_PATH."mysql_cfg.inc"; $db = Mysql::getInstance('localhost'); $sql = "INSERT INTO users (userid, pw_opid, usernk, email, birthday, IP, reg_time) "; $sql .= "VALUES ('{$userid}', '{$userpw}', '{$usernk}', '{$email}', '{$birthday}', '{$userIP}', now())"; $db->query($sql); $session_id = session_id(); $sql = "INSERT INTO init_acc (userid, sid) "; $sql .= "VALUES ('{$userid}', '{$session_id}')"; $db->query($sql); $authstr = base64_encode("{$userid}#{$session_id}"); //} $header = "From: TravelMap<*****@*****.**>\r\n"; $mail_content = ' mailto ' . $email . ' :