/** * send_password * * takes a user's email address and sends them their password * for password reminder service * * @param string $email * @return string $message - error/success message */ function forgotten_password($email) { // set new values for password and last_sess database fields $now = (int) time(); $key = (int) rand(1000, 9999); $sess = $now * $key; $auth = randomstring(); // update database with key/sess $conn = author_connect(); $update = "UPDATE " . WW_USER_TBL . " \n\t\t\t\t\tSET \n\t\t\t\t\t" . WW_LAST_SESS . " = " . $sess . ",\n\t\t\t\t\t" . WW_PASS . " = '" . $conn->real_escape_string($auth) . "'\n\t\t\t\t\tWHERE " . WW_EMAIL . " = '" . $conn->real_escape_string($email) . "'"; $update_result = $conn->query($update); if (!$update_result) { return $conn->error; } // compile email message $subject = WW_SITE_NAME . " password reset"; $url = WW_WEB_ROOT . '/ww_edit/index.php?changepass'; $message = "Your password for the " . WW_SITE_NAME . " website has been reset. To change your password please do the following:<br/><br/>"; $message .= "1 - Go to " . $url . "<br/><br/>"; $message .= "2 - Enter this auth code:<br/>" . $auth . "<br/><br/>"; $message .= "3 - Enter this key:<br/>" . $key . "<br/><br/>"; $message .= "4 - Enter your new password<br/><br/>"; $message .= "NOTE: this must be completed with ONE HOUR otherwise you will need to reset your password again."; $headers = "From: " . WW_ADMIN_EMAIL . "\n" . "X-Mailer: PHP/" . phpversion() . "\n" . "Content-Type: text/html; charset=utf-8\n" . "Content-Transfer-Encoding: 8bit\n\n"; if (mail($email, $subject, $message, $headers, "-f" . WW_ADMIN_EMAIL . "")) { $message = "Instructions for resetting your password have been sent to: " . $email . "."; } else { $message = "There was a problem sending the email."; } return $message; }
function randomvalue() { // $randomvalue = ''; static $numberofarrays = 0; //var_dump($numberofarrays); $typeDeterminatior = rand(1, 3); switch ($typeDeterminatior) { case '1': return randomstring(15); break; case '2': return rand(1, 1000); break; case '3': ++$numberofarrays; //if the allowed number of arrays is too large, a fatal error will occur due to too much nesting. if ($numberofarrays < 20) { return randomarr(rand(3, 6)); } else { return randomvalue(); } //return 'this should be an array'; break; default: break; } }
function post(&$vars) { extract($vars); $nickname = ''; $letters = str_split(strtolower($request->params['blog']['title'])); foreach ($letters as $letter) { if (ereg("([a-z])", $letter)) { $nickname .= $letter; } } $prefix = substr($nickname, 0, 2); for ($i = 0; $i < 10; $i++) { $b = $Blog->find_by('prefix', $prefix); if (!$b && !in_array($prefix . "_db_sessions", $db->tables) && strlen($prefix) > 1) { continue; } else { $prefix = randomstring(2); } } $request->set_param(array('blog', 'prefix'), $prefix); $request->set_param(array('blog', 'nickname'), $nickname); $resource->insert_from_post($request); header_status('201 Created'); redirect_to($request->url_for('admin') . '#ui-tabs-11'); }
function randomarr($arrlength, $wordlengthmin = 10, $wordlengthmax = 20) { $arr; for ($key = 0; $key < $arrlength; $key++) { $arr[$key] = randomstring(rand($wordlengthmin, $wordlengthmax)); } return $arr; }
<html> <head> <script type="text/javascript" src="http://localhost/take/jquery/jquery.tools.min.js"> </script> <?php require_once("/var/www/take/files/functions/randomstring.php"); ?> <script type="text/javascript" > $(document).ready(function(){$('#butt').click(function(){location.reload()});}); </script> </head> <body> <div> <?php var_dump(randomstring());?> </div> <button id="butt">click</button> </body> </html>
function build_where_string() { global $db, $app_list_strings, $beanList, $beanFiles, $current_user; /* * Block to build the Where Clause */ // see if we need to ovveride /* if(is_array($this->whereOverrideArray)) { foreach($this->whereOverrideArray as $overrideKey => $overrideData) { reset($this->whereArray); foreach($this->whereArray as $originalKey => $originalData) { if($originalData['fieldid'] == $overrideData['fieldid']) { $this->whereArray[$originalKey] = $overrideData; // need to exit the while loop } } } } */ // initialize $arrayWhereGroupsIndexed = array(); // $arrayWhereGroupsIndexed['root'] = array(); // build the where String for each Group foreach ($this->whereGroupsArray as $whereGroupIndex => $thisWhereGroup) { $thisWhereString = ''; // reset the Where fields and loop over all fields to see if any is in our group reset($this->whereArray); foreach ($this->whereArray as $thisWhere) { //2012-11-24 cater for a potential empty where string $tempWhereString = ''; // check if this is for the current group // 2011--01-24 add ignore filter if ($thisWhere['groupid'] == $thisWhereGroup['id'] && $thisWhere['operator'] != 'ignore') { // process the Field and link with the joinalias $fieldName = substr($thisWhere['path'], strrpos($thisWhere['path'], "::") + 2, strlen($thisWhere['path'])); $pathName = substr($thisWhere['path'], 0, strrpos($thisWhere['path'], "::")); $fieldArray = explode(':', $fieldName); if ($thisWhere['jointype'] != 'notexisting') { //getWhereOperatorClause($operator, $fieldname, $alias, $value, $valuekey, $valueto) //$thisWhereString .= $this->getWhereOperatorClause($thisWhere['operator'], $fieldArray[1], $this->joinSegments[$pathName]['alias'], $thisWhere['value'], $thisWhere['valuekey'], $thisWhere['valueto']); //2012-11-24 ... changed to fill into temnpWherestring //2013-08-07 .. process fixed value if (!empty($thisWhere['fixedvalue'])) { $tempWhereString = $this->getWhereOperatorClause($thisWhere['operator'], $fieldArray[1], '\'' . $thisWhere['fixedvalue'] . '\'', $pathName, $thisWhere['value'], $thisWhere['valuekey'], $thisWhere['valueto'], $thisWhere['valuetokey'], $thisWhere['jointype']); } elseif (!empty($pathName)) { $tempWhereString = $this->getWhereOperatorClause($thisWhere['operator'], $fieldArray[1], $thisWhere['fieldid'], $pathName, $thisWhere['value'], $thisWhere['valuekey'], $thisWhere['valueto'], $thisWhere['valuetokey'], $thisWhere['jointype']); } } else { // we have a not esists clause $tempWhereString .= 'not exists('; // get the last enrty and the one before and the relevant arrays $rightPath = substr($pathName, strrpos($pathName, "::") + 2, strlen($pathName)); $leftPath = substr($pathName, 0, strrpos($pathName, "::")); // explode into the relevant arrays $rightArray = explode(':', $rightPath); $leftArray = explode(':', $leftPath); // set aliases for left and right .. will be processed properly anyway in the build of the link // ... funny enough so $join_params = array('right_join_table_alias' => $this->joinSegments[$leftPath]['alias'], 'left_join_table_alias' => $this->joinSegments[$leftPath]['alias'], 'join_table_link_alias' => randomstring(), 'join_table_alias' => $this->joinSegments[$pathName]['alias']); $tempWhereString .= $this->joinSegments[$leftPath]['object']->{$rightArray}[2]->getWhereExistsStatement($join_params); // add the standard Where Clause // $thisWhereString .= $this->getWhereOperatorClause($thisWhere['operator'], $fieldArray[1], $this->joinSegments[$pathName]['alias'], $thisWhere['value'], $thisWhere['valuekey'], $thisWhere['valueto']); $tempWhereString .= 'AND ' . $this->getWhereOperatorClause($thisWhere['operator'], $fieldArray[1], $thisWhere['fieldid'], $pathName, $thisWhere['value'], $thisWhere['valuekey'], $thisWhere['valueto'], $thisWhere['valuetokey']); // close the select clause $tempWhereString .= ')'; } //2012-11-24 moved to cehck if the where string returned something at all if ($tempWhereString != '') { // if we have an where string already concetanate with the type for the group AND or OR if ($thisWhereString != '') { $thisWhereString .= ' ' . $thisWhereGroup['type'] . ' ('; } else { $thisWhereString .= '('; } $thisWhereString .= $tempWhereString; // close this condition $thisWhereString .= ')'; } } } $thisWhereGroup['whereClause'] = $thisWhereString; // write into an array with the id as index in the array (will need that tobuild the hierarchy $arrayWhereGroupsIndexed[$thisWhereGroup['id']] = $thisWhereGroup; } // 2013-01-16 check if we have a where string already from the auth check // 2013-02-22 moved into the adding of the where clause ... //if ($this->whereString != '') // $this->whereString .= ' AND '; // process now topDown if (isset($arrayWhereGroupsIndexed['root'])) { $levelWhere = $this->buildWhereClauseForLevel($arrayWhereGroupsIndexed['root'], $arrayWhereGroupsIndexed); if ($levelWhere != '') { if ($this->whereString != '') { $this->whereString .= ' AND '; } $this->whereString .= $levelWhere; } } // 2010-07-18 additonal Filter mainly for the treeview if (is_array($this->whereAddtionalFilter)) { foreach ($this->whereAddtionalFilter as $filterFieldId => $filterFieldValue) { //special treatment for fied values where we do not have a path if ($this->get_fieldname_by_fieldid($filterFieldId) == '') { $this->havingString == '' ? $this->havingString = 'HAVING ' : ($this->havingString .= ' AND '); $this->havingString .= $filterFieldId . " = '" . $filterFieldValue . "'"; } else { $whereOperatorWhere = $this->getWhereOperatorClause('equals', $this->get_fieldname_by_fieldid($filterFieldId), $filterFieldId, $this->get_fieldpath_by_fieldid($filterFieldId), $filterFieldValue, '', '', ''); if ($whereOperatorWhere != '') { if ($this->whereString != '') { $this->whereString .= ' AND '; } $this->whereString .= $whereOperatorWhere; } } // $this->whereString .= ' ' . $this->fieldNameMap[$filterFieldId]['tablealias'] . '.' . $this->fieldNameMap[$filterFieldId]['fieldname'] . ' = \'' . $filterFieldValue . '\''; } } // bugfix 2010-06-14 exclude deleted items // add feature fcheck if we shod show deleted records if (!$this->showDeleted) { if ($this->whereString != '') { $this->whereString = 'WHERE ' . $this->rootGuid . '.deleted = \'0\' AND ' . $this->whereString; } else { $this->whereString = 'WHERE ' . $this->rootGuid . '.deleted = \'0\''; } } else { if ($this->whereString != '') { $this->whereString = 'WHERE ' . $this->whereString; } else { $this->whereString = ''; } } // bugfix 2010-08-19, respect ACL access for owner required // check for Role based access on root module // 2013-02-22 ... added anyway for each segment ... no need to add here again ... /* if (!$current_user->is_admin && $this->joinSegments['root:' . $this->root_module]['object']->bean_implements('ACL') && ACLController::requireOwner($this->joinSegments['root:' . $this->root_module]['object']->module_dir, 'list')) { $this->whereString .= ' AND ' . $this->rootGuid . '.assigned_user_id=\'' . $current_user->id . '\''; } */ }
$header = unpack('vtype/vchannels/Vsamplerate/Vbytespersec/valignment/vbits', $rawheader); $sec = ceil($size_in_bytes / $header['bytespersec']); return $sec; } if (isset($name) && $_SESSION['userclass'] == 'admin') { if (isset($_POST['usernames'])) { $newspeakers = []; foreach (explode("\n", $_POST['usernames']) as $newuser) { $school = $_SESSION['user']['school']; $newname = strtolower($school) . "_" . randomstring(4); $sqlcommand = "SELECT count(*) FROM speakers WHERE username='******'"; while ($db->querySingle($sqlcommand) > 0) { $newname = strtolower($_SESSION['user']['school']) . "_" . randomstring(4); $sqlcommand = "SELECT count(*) FROM speakers WHERE username='******'"; } $newpassword = randomstring(5); $langchoice = $_POST['langchoice']; $yearinschool = $_POST['yearinschool']; $teacher = $_SESSION['user']['username']; $timestamp = date('Y-m-d h:i:s', time()); $newspeaker = array('username' => $newname, 'yearinschool' => $yearinschool, 'langchoice' => $langchoice, 'password' => $newpassword, 'realname' => $newuser, 'timestamp' => $timestamp, 'teacher' => $teacher); $sqlcommand = "INSERT INTO speakers (username, password, school, teacher, langchoice, yearinschool, timestamp) "; $sqlcommand .= "values ('{$newname}','{$newpassword}','{$school}','{$teacher}','{$langchoice}','{$yearinschool}','{$timestamp}');"; $trying = $db->exec($sqlcommand); if (!$trying) { print "<pre> Problem with SQL:" . PHP_EOL; print "{$sqlcommand}" . PHP_EOL; print "</pre>" . PHP_EOL; } array_push($newspeakers, $newspeaker); }
//CLIENT } elseif ($reset_m_type = 3) { $failure_query = "UPDATE client SET log='{$new_log}' WHERE mid='{$mid}' AND cid='{$cid}' LIMIT 1"; } //UPDATE LOG COLUMN. INCREASE LOGIN ATTEMPTS //echo $failure_query; mysql_query($failure_query) or die(mysql_error()); $_SESSION['failure'] = '<div class="error"><span class="errormsg">Incorrect Security Question or Answer.<br>Please try again.</span></div>'; $failure = $_SESSION['failure']; session_write_close(); header("Location: https://www.benfund.com/reset_password/challenge.php"); } //HAS EXCEEDED LOGIN ATTEMPTS } else { //SEND WARNING EMAIL $randomstring = randomstring(22); if (isset($cid)) { $reset_query = "UPDATE client SET log='4^{$REMOTE_ADDR}^{$randomstring}' WHERE mid='{$mid}' AND cid='{$cid}' LIMIT 1"; $reset_url = 'https://www.benfund.com/reset_login.php?mid=' . $mid . '&cid=' . $cid . '&astrum=' . $randomstring; $acct_num = $mid . ' - ' . $cid; } else { $reset_query = "UPDATE merchant SET log='4^{$REMOTE_ADDR}^{$randomstring}' WHERE id='{$mid}' LIMIT 1"; $reset_url = 'https://www.benfund.com/reset_login.php?mid=' . $mid . '&astrum=' . $randomstring; $acct_num = $mid; } //SET RESET STRING IN ACCOUNT LOG COLUMN benfund_connect(); mysql_query($reset_query) or die(mysql_error()); $from = '*****@*****.**'; $from_name = 'BenFund Customer Service'; $recipient = $email;
} return $result; } function uppercaseandlength($str) { $arr_result["length"] = strlen($str); $arr_result["uppercase"] = strtoupper($str); return $arr_result; } function randomstring($length = 10) { $randomString = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length); return $randomString; } ///////////// Overige code ////////////////////// $startstring = randomstring(rand(10, 400)); $resultArr = uppercaseandlength($startstring); $outputstr = "De string " . $startstring . " heeft een lengte van: " . $resultArr["length"] . " en ziet er in hoofdletters zo uit: " . $resultArr["uppercase"]; ?> <!DOCTYPE html> <html> <head> <title> Functions Deel 1</title> </head> <body> <h1> Functions Deel 1</h1> <h2> Vermenigvuldig </h2> <p> U kocht <?php echo $aantalStuks; ?>
<?php session_start(); $connection_common_rdm=mysqli_connect($_SERVER['HTTP_HOST'],$sqlusername,$sqlpassword,$common_database); //common connection $authkey_timestamp=time(); $authkey_session_id=session_id(); $salt1=randomstring(); $salt2=randomstring(); $total_authkey=$salt1.$authkey_session_id.$salt2.$authkey_timestamp; $standardauthkey=md5($total_authkey); //just confirming that any other value of huh does not get through //and that the session variables does not get set for any other huh value;;; if(!(($_POST['huh']=='users')||($_POST['huh']=='register'))) { header("Location:$FILE/error_message.php?down=25"); $close_connection=mysqli_close($connection_common_dm); exit(); //whisks to error message.php where error is shown that something went wrong ;;as the huh variable was set to neither users nor guests nor register }
<?php include_once("/var/www/take/files/functions/randomstring.php"); ?> <html> <head> <script type="text/javascript" src="http://localhost/take/jquery/jquery.tools.min.js"> </script> </head> <body> <?php $random=randomstring(); ?> <div id='<?=$random?>' style="width:300px;height:300px;margin:top;background-color:red;"> "<?=var_dump($random); ?>" </div> <?php ?> <script type="text/javascript" > $(document).ready(function(){var one=$("div").attr('id');$('div#'+one).mouseover(function(){$(this).css("background-color","yellow");});}); </script>. </body> </html>
/** * [generate survey tokens and auth token for invitation auto-login] * @param [type] $user [description] * @param [type] $evaluation_id [description] * @return [type] [description] */ function generateTokens($user, $evaluation_id) { error_log('got this far 1'); // is relationship 180 or 360 ? $evaluation_pod = pods('evaluation', $evaluation_id); $relation_pod = pods('relation', $evaluation_pod->field('relation')['ID']); $relation_type = $evaluation_pod->field('180_360'); $relation_steps = EvaluationModel::getSteps($relation_type); error_log('got this far 2 ' . json_encode($relation_steps)); // survey meta info $survey_args = ['user' => $user->ID, 'evaluation' => $evaluation_id, 'user_type' => get_field('company_or_agency', 'user_' . $user->ID), 'token_180' => false, 'token_360' => false, 'survey_id_180' => false, 'survey_id_360' => false, 'auth_token' => randomstring(16)]; // get survey metadata pod $survey = SurveyModel::getByUserAndRelation($user->ID, $evaluation_id); error_log('got this far 3 ' . json_encode($survey)); // for each relation step foreach ($relation_steps as $key => $relation_step) { error_log('got this far 4'); $limesurvey_id = EvaluationModel::surveyID($evaluation_id, $relation_step); error_log('got this far 4a ' . $limesurvey_id); if (empty($limesurvey_id) || !$limesurvey_id) { error_log('Error: generateTokens ' . $limesurvey_id . '-' . $evaluation_id . '-' . $relation_step); return; } $ls_token = LimesurveyModel::getTokenByRelation($limesurvey_id, $user->user_email, $evaluation_id, false); error_log('got this far 4b'); // create a new limesuvey survey token if one doesn't exist if ($ls_token) { error_log('A token already exists ' . LS_USER . ' - ' . LS_PASSWORD); continue; } error_log('got this far 4z '); //limesurvey token $limesurvey_token = [(object) ['email' => $user->user_email, 'firstname' => $user->first_name, 'lastname' => $user->last_name, 'attribute_1' => $user->roles[0], 'attribute_2' => $evaluation_id]]; error_log('got this far 4b2 ' . json_encode($limesurvey_token)); // instantiate a new client $myJSONRPCClient = new jsonRPCClient(LS_BASEURL); error_log('got this far 4b3 ' . json_encode($myJSONRPCClient)); error_log('Le base url ' . LS_BASEURL); // receive session key $sessionKey = $myJSONRPCClient->get_session_key(LS_USER, LS_PASSWORD); error_log('got this far 4b4 ' . json_encode($sessionKey)); // create limesurvey token $success_status = $myJSONRPCClient->add_participants($sessionKey, $limesurvey_id, $limesurvey_token); error_log('got this far 4b5 ' . json_encode($success_status)); // release session key $myJSONRPCClient->release_session_key($sessionKey); error_log('got this far 4c '); // check status if (isset($success_status['error'])) { error_log('Error: ' . $success_status['error']); } $token_str = isset($success_status[0]['token']) ? $success_status[0]['token'] : ""; if (empty($token_str)) { error_log('generateTokens() - Token str is empty'); continue; } // update survey meta $survey_args['user'] = $user->ID; $survey_args['token_' . $relation_step] = $token_str; $survey_args['survey_id_' . $relation_step] = $limesurvey_id; // this will add/update the survey meta pod using pods save SurveyModel::save($user->ID, $evaluation_id, $survey_args); error_log('got this far 4'); } error_log('got this far 5'); }
function randomstring($length) { /*$c = "abcdefghijklmnopqrstuvwxyz"; $rand = ''; srand((double)microtime()*1000000); for ($i=0; $i<$length; $i++) { $rand .= $c[rand()%strlen($c)]; } return $rand;*/ $random = GeneratePassword(false, $length, "/^[a-z]{1}[a-z0-9]*\$/"); $return = implode('', $random); return $return; } for ($i = 0; $i < 1500; $i++) { $domains[] = randomstring(20) . '.nl'; } echo "Checking " . count($domains) . " domain names\n"; try { $conn = new Metaregistrar\EPP\metaregEppConnection(); $conn->setConnectionDetails(''); // Connect to the EPP server $mtime = microtime(); $mtime = explode(" ", $mtime); $starttime = $mtime[1] + $mtime[0]; if ($conn->login()) { $counter = 0; while ($counter < count($domains)) { $list[] = $domains[$counter]; $counter++; if ($counter % 10 == 0) {
} //write the download path song m3u path etc and the netered detailsin the general databse -allsongs table $connection_upload_handler=mysqli_connect($_SERVER['HTTP_HOST'],$sqlusername,$sqlpassword,$databasename); $query_extract_user_details_uploadhandler="select registration_timestamp ,username,profile_string from users_basic where email_id='$the_email_id_in_session'"; //echo "<br>";var_dump($query_extract_user_details_uploadhandler);echo "<br>"; $result_extract_user_details_uploadhandler=mysqli_query($connection_upload_handler,$query_extract_user_details_uploadhandler)or die(mysqli_error($connection_upload_handler));/*echo "shhs";*/ $answer_extract_user_details_uploadhandler=mysqli_fetch_array($result_extract_user_details_uploadhandler); //var_dump($answer_extract_user_details_uploadhandler);//echo "<br>"; $username_extract_user_details_uploadhandler=$answer_extract_user_details_uploadhandler['username']; $registration_timestamp_uploadhandler=$answer_extract_user_details_uploadhandler['registration_timestamp']; $profile_string_uploadhandler=$answer_extract_user_details_uploadhandler['profile_string']; $the_session_user_db_uploadhandler="$username_extract_user_details_uploadhandler-$the_email_id_in_session--$registration_timestamp_uploadhandler"; $another_randomstring=randomstring(); $another_randomstring_complete=md5($another_randomstring.$the_current_time_uploadehandler.$another_randomstring); $theanchor_to_the_song_in_the_allsongs_chart=$another_randomstring_complete; //$username_extract_user_details_uploadhandler-$the_email_id_in_session--$registration_timestamp_uploadhandler"; $complete_name_for_m3u='http://localhost/'.$the_total_filename; $query_insert_details_general_allsongs="insert into allsongs (song_title,album,artist,genre,language,play_path,the_anchor,download_path,added_by,added_by_profile_string) values('$title_uploadhandler','$album_uploadhandler','$artist_uploadhandler','$genre_uploadhandler','$language_uploadhandler','$m3u_path_on_the_directory','$theanchor_to_the_song_in_the_allsongs_chart','$destination','$username_extract_user_details_uploadhandler','$profile_string_uploadhandler')";//echo "^&*^&*^*^&*^*^okay"; //var_dump($query_insert_details_general_allsongs);/*echo "```````````````````````````````````shhs";*/ $result_insert_details_general_allsongs=mysqli_query($connection_upload_handler,$query_insert_details_general_allsongs)or die(mysqli_error($connection_upload_handler)); $answer_insert_details_general_allsongs=mysqli_affected_rows($connection_upload_handler); if(!$answer_insert_details_general_allsongs) { /*setcookie('authkey','',time()-60*60);//returns bool setcookie('clue','',time()-60*60);//returns bool session_destroy(); $_SESSION=array();
case "logout": session_destroy(); header("Location: index.php"); exit; break; case "addpicture": //add the pics $bckgrclr = flashclean($_POST, "bckgrclr"); $visible = flashclean($_POST, "visible"); $finishdir = "/absolute/path/to/dries/img/"; $uploaddir = "/absolute/path/to/dries/src/"; $filename = trim($_FILES['upfile']['name']); $filename = ereg_replace(" ", "", $filename); $namecut = substr("{$filename}", 0, -4); if (ereg(".jpg", $filename) || ereg(".JPG", $filename)) { $rstring = randomstring(20); $fotoname = $rstring . "_" . $namecut . ".jpg"; $uploadfile = $uploaddir . $fotoname; if (move_uploaded_file($_FILES['upfile']['tmp_name'], $uploadfile)) { resize($finishdir, $uploaddir, $fotoname, $fotoname); $_SESSION['message'] = "The file {$filename} is succesfully uploaded.<br />"; $sql = "INSERT INTO pictures (bckgrclr, imgpath, visible, seq_id)VALUES('{$bckgrclr}','{$fotoname}','{$visible}','0')"; if (!mysql_query($sql)) { $_SESSION['message'] = "Query error ONE<br />"; } else { $seq_id = mysql_insert_id(); $sql = "UPDATE pictures SET seq_id='{$seq_id}' WHERE pict_id='{$seq_id}'"; if (!mysql_query($sql)) { $_SESSION['message'] = "Query error TWO<br />"; } }
<html> <?php require_once("/var/www/take/files/functions/randomstring.php"); ?> <head><TITLE></TITLE> <script src="http://localhost/take/jquery/jquery.tools.min.js"> $(document).ready(function(){$("div#two").mouseover(function(){$("div#two").css("background-color","olive");});$("#one").click(function(){$("#one").html("this");}))}; </script> </head> <body> <div> <div id="one" style="width:100px;height:200px;margin:auto;background-color:yellow;"> <?php $one=randomstring(); echo $one; ?> </div> <div id="two" style="width:100px;height:200px;margin:auto;background-color:silver;"> <?php $two=randomstring(); echo $two; ?> </div> </body> </html>
$string_string = md5($string_agent); // Hash and concatenate md5/crypted random string and password hash posts. $string_response = md5($string_string . $_POST['pass_hash2']); // Concatenate agent and language. $agent_lang = getenv('HTTP_USER_AGENT') . getenv('HTTP_ACCEPT_LANGUAGE'); // Hash crypted agent/language concatenate with random string seed for check against post. $agent_response = md5(crypt(md5($agent_lang), $string_agent)); // Check crypted pass against stored pass. Check random string and pass hashed concatenate against post. Check hashed and crypted agent/language concatenate against post. } if ($_SESSION['pass_hash_upload'] != $upload_password || $_POST['pass_string_hash'] != $string_response || $_POST['agenthash'] != $agent_response) { // Otherwise, give login. if ($head == "on") { include "header.php"; } // Set random string session. $_SESSION['random'] = randomstring(40); // Crypt random string with random string seed. $rand_string = crypt($_SESSION['random'], $_SESSION['random']); // Concatenate agent and language. $agent_lang = getenv('HTTP_USER_AGENT') . getenv('HTTP_ACCEPT_LANGUAGE'); // Crypt agent and language with random string seed for form submission. $agent = crypt(md5($agent_lang), $rand_string); // Form md5 and encrypt javascript. echo "{$p}\n\t\t<b>{$l_global13}</b>\n\t\t{$p2}\n\t\t<script type=\"text/javascript\" src=\"{$datadir}/crypt/sha256.js\"></script>\n\t\t<script type=\"text/javascript\" src=\"{$datadir}/crypt/md5.js\"></script>\n\t\t<script type=\"text/javascript\">\n\t\tfunction obfuscate() {\n\t\t\tdocument.form1.pass_hash_upload.value = hex_sha256(document.form1.pass_upload.value);\n\t\t\tdocument.form1.pass_hash2.value = hex_md5(document.form1.pass_upload.value);\n\t\t\tdocument.form1.string_hash.value = hex_md5(document.form1.string.value);\n\t\t\tdocument.form1.pass_string_hash.value = hex_md5(document.form1.string_hash.value + document.form1.pass_hash2.value);\n\t\t\tdocument.form1.agenthash.value = hex_md5(document.form1.agent.value);\n\t\t\tdocument.form1.pass_upload.value = \"\";\n\t\t\tdocument.form1.string.value = \"\";\n\t\t\tdocument.form1.agent.value = \"\";\n\t\t\tdocument.form1.jscript.value = \"on\";\n\t\t\treturn true;\n\t\t}\n\t\t</script>\n\t\t<form action=\"DoorHangers.php\" method=\"post\" name=\"form1\" onsubmit=\"return obfuscate()\">\n\t\t{$p}\n\t\t<input name=\"jscript\" type=\"hidden\" value=\"off\" />\n\t\t<input name=\"pass_hash_upload\" type=\"hidden\" value=\"\" />\n\t\t<input name=\"pass_hash2\" type=\"hidden\" value=\"\" />\n\t\t<input name=\"string_hash\" type=\"hidden\" value=\"\" />\n\t\t<input name=\"pass_string_hash\" type=\"hidden\" value=\"\" />\n\t\t<input name=\"agenthash\" type=\"hidden\" value=\"\" />\n\t\t<input name=\"string\" type=\"hidden\" value=\"{$rand_string}\" />\n\t\t<input name=\"agent\" type=\"hidden\" value=\"{$agent}\" />\n\t\t<input type=\"password\" name=\"pass_upload\" />\n\t\t<input type=\"submit\" value=\"{$l_global14}\" />\n\t\t{$p2}\n\t\t</form>"; if ($head == "on") { include "footer.php"; } exit; } } else { }
#!/usr/bin/php <?php /** * EGroupware - RPM post install: automatic install or update EGroupware * * @link http://www.egroupware.org * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @author RalfBecker@outdoor-training.de * @version $Id$ */ if (isset($_SERVER['HTTP_HOST'])) { die('<h1>rpm_post_install.php must NOT be called as web-page --> exiting !!!</h1>'); } $verbose = false; $config = array('php' => '/usr/bin/php', 'pear' => '/usr/bin/pear', 'source_dir' => '/usr/share/egroupware', 'data_dir' => '/var/lib/egroupware', 'header' => '$data_dir/header.inc.php', 'setup-cli' => '$source_dir/setup/setup-cli.php', 'domain' => 'default', 'config_user' => 'admin', 'config_passwd' => randomstring(), 'db_type' => 'mysqli', 'db_host' => 'localhost', 'db_port' => 3306, 'db_name' => 'egroupware', 'db_user' => 'egroupware', 'db_pass' => randomstring(), 'db_grant_host' => 'localhost', 'db_root' => 'root', 'db_root_pw' => '', 'backup' => '', 'admin_user' => 'sysop', 'admin_passwd' => randomstring(), 'lang' => 'en', 'charset' => 'utf-8', 'start_db' => '/sbin/service mysqld', 'autostart_db' => '/sbin/chkconfig --level 345 mysqld on', 'start_webserver' => '/sbin/service httpd', 'autostart_webserver' => '/sbin/chkconfig --level 345 httpd on', 'distro' => 'rh', 'account-auth' => 'sql', 'account_min_id' => '', 'ldap_suffix' => 'dc=local', 'ldap_host' => 'localhost', 'ldap_admin' => 'cn=admin,$suffix', 'ldap_admin_pw' => '', 'ldap_base' => 'o=$domain,$suffix', 'ldap_root_dn' => 'cn=admin,$base', 'ldap_root_pw' => randomstring(), 'ldap_context' => 'ou=accounts,$base', 'ldap_search_filter' => '(uid=%user)', 'ldap_group_context' => 'ou=groups,$base', 'mailserver' => '', 'smtp' => '', 'imap' => '', 'smtpserver' => 'localhost,25', 'postfix' => '', 'cyrus' => '', 'sieve' => '', 'install-update-app' => '', 'webserver_user' => 'apache'); // read language from LANG enviroment variable if ($lang = isset($_ENV['LANG']) ? $_ENV['LANG'] : $_SERVER['LANG']) { @(list($lang, $nat) = preg_split('/[_.]/', $lang)); if (in_array($lang . '-' . strtolower($nat), array('es-es', 'pt-br', 'zh-tw'))) { $lang .= '-' . strtolower($nat); } $config['lang'] = $lang; } $config['source_dir'] = dirname(dirname(dirname(__FILE__))); /** * Set distribution spezific defaults * * @param string $distro=null default autodetect */ function set_distro_defaults($distro = null) {
<?php // load composer autoloader require 'vendor/autoload.php'; // disable Dompdf autoloader define('DOMPDF_ENABLE_AUTOLOAD', false); // require dompdf config file require_once "vendor/dompdf/dompdf/dompdf_config.inc.php"; // $pathToPdfs = array(); for ($i = 0; $i < 10; $i++) { // create the barcode $code = randomstring(); $pathToBarcode = generate_barcode($code); // create html for dompdf $barcode_html = "\n\t\t <img src='" . $pathToBarcode . "' \n\t\t \t\t\tstyle='position: absolute; \n\t\t \t\t\ttop: -40px; \n\t\t \t\t\tleft: -40px; \n\t\t \t\t\twidth:280px; \n\t\t \t\t\theight: 70px;' >\n\t\t <div style='position: absolute; top: 11px; left: 30px; width: 80px; height: 20px; text-align: center; background-color:white; text-transform: uppercase;'>\n\t\t \t\t" . $code . "\n\t\t </div>"; // init dompdf and set paper size $dompdf = new DOMPDF(); $customPaper = array(0, 0, 175, 60); $dompdf->set_paper($customPaper); // load html to dompdf $dompdf->load_html($barcode_html); // render the pdf $dompdf->render(); // cleanup barcode png if (file_exists($pathToBarcode)) { unlink($pathToBarcode); } // save pdf to temp dir $output = $dompdf->output(); $pdfName = $code . '.pdf';