if ($totalRows_forgot == 0) { header(sprintf("Location: %s", $base_url . "index.php?section=login&action=forgot&msg=1")); } if ($_POST['userQuestionAnswer'] == $row_forgot['userQuestionAnswer']) { //if answer is correct /* echo $username."<br>"; echo $query_forgot."<br>"; echo $row_forgot['user_name']."<br>"; echo $totalRows_forgot."<br>"; $em = $row->username;// email is stored to a variable // Send the email with key */ $key = random_generator(10, 1); $password = md5($key); $hash = $hasher->HashPassword($password); if (NHC) { // Place NHC SQL calls below } else { mysql_select_db($database, $brewing); $updateSQL = sprintf("UPDATE {$users_db_table} SET password='******' WHERE id='%s'", $hash, $row_forgot['id']); $Result = mysql_query($updateSQL, $brewing) or die(mysql_error()); } $updateGoTo = $base_url . "index.php?section=login&go=" . $key . "&msg=2"; header(sprintf("Location: %s", $updateGoTo)); } else { header(sprintf("Location: %s", $base_url . "index.php?section=login&action=forgot&go=verify&msg=4&username=" . $username)); } /*
function multiple_files($field_name, $path_folder, $path_db, $relation, $rel_id, $ip) { $j = 0; $y = 0; while (list($key, $value) = each($_FILES[$field_name][name])) { unset($flaz['9']); unset($flaz['2']); unset($flaz['3']); $file_size[$j] = $_FILES[$field_name][size][$key]; if ($file_size[$j] == '') { // this will check if any blank field is entered $flaz[9] = 'red'; } else { $filename[$j] = $value; // filename stores the value $exp = explode(".", $filename[$j]); $ext[$j] = $exp[count($exp) - 1]; $num_arr = count($exp); $z = 0; $filename[$j] = ''; while ($z < $num_arr - 1) { $filename[$j] .= $exp[$z]; $z++; } if ($file_size[$j] == '0') { $flaz[4] = 'red'; } else { $file_size[$j] = round($file_size[$j] / 1024); } } if (!empty($flaz)) { } else { // Add _ inplace of non supported chars in file name, you can remove this line $filename[$j] = preg_replace('/[^a-zA-Z0-9-_.]/', '', $filename[$j]); if ($filename[$j] == '') { $filename[$j] = 'image' . rand(1, 999999); } $filename[$j] .= "-" . date("F_j_Y-g_i_s_a"); $filename[$j] .= '.' . $ext[$j]; $path = $path_folder . $filename[$j]; $path_db_n = $path_db . $filename[$j]; $uniq = random_generator(32); $sql1 = "INSERT into files(uniq_id, relation, rel_id, file_name, location, file_size, ext, ip, time) values('{$uniq}', '{$relation}', '{$rel_id}', '{$filename[$j]}', '{$path_db_n}', '{$file_size[$j]}', '{$ext[$j]}', '{$ip}', NOW())"; if (mysql_query($sql1)) { copy($_FILES[$field_name][tmp_name][$key], $path); // upload the file to the server chmod("{$path}", 0777); // set permission to the file. $uniq_id[$y] = $uniq; $y++; } else { die(mysql_error()); } } $j++; } return $uniq_id; }
public function refazerAction() { $busca = $this->_request->getParam('id'); $confirma = $this->_request->getParam('confirma'); if (isset($confirma)) { $this->view->visualiza = 0; /// function to generate random number /////////////// function random_generator($digits) { srand((double) microtime() * 10000000); //Array of alphabets $input = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"); $random_generator = ""; // Initialize the string to store random numbers for ($i = 1; $i < $digits + 1; $i++) { // Loop the number of times of required digits if (rand(1, 2) == 1) { // to decide the digit should be numeric or alphabet // Add one random alphabet $rand_index = array_rand($input); $random_generator .= $input[$rand_index]; // One char is added } else { // Add one numeric digit between 1 and 10 $random_generator .= rand(1, 10); // one number is added } // end of if else } // end of for loop return $random_generator; } // end of function $pedidoModel = new Application_Model_Pedido(); $old_pedido = $pedidoModel->fetchAll($pedidoModel->select()->where('id_pedido = ?', $busca)); $key = random_generator(10); $key = md5($key); $date = date_create(); $date0 = date_format($date, 'c'); $novo_pedido = array(); $novo_pedido['cliente'] = $old_pedido[0]['cliente']; $novo_pedido['valor'] = $old_pedido[0]['valor']; $novo_pedido['secure'] = $key; $novo_pedido['data'] = $date0; $id = $pedidoModel->insert($novo_pedido); $pedido_id = $pedidoModel->fetchAll($pedidoModel->select()->where('secure = ?', $key)); $nova_id = $pedido_id[0]['id_pedido']; $prodpedModel = new Application_Model_ProdutoPedido(); $produtos = $prodpedModel->fetchAll($prodpedModel->select()->from($prodpedModel->info(Zend_Db_Table_Abstract::NAME))->columns(array('id_produto', 'id_adicionais'))->where('id_pedido = ?', $busca)); $prodz = array(); $maismais = 0; foreach ($produtos as $produto) { $prodz[$maismais]['id_pedido'] = $nova_id; $prodz[$maismais]['id_produto'] = $produto['id_produto']; $prodz[$maismais]['id_adicionais'] = $produto['id_adicionais']; $id = $prodpedModel->insert($prodz[$maismais]); $maismais++; } $this->view->aviso = 'Pedido enviado com sucesso!'; } else { $this->view->visualiza = 1; $busca = $this->_request->getParam('id'); $prodpedModel = new Application_Model_ProdutoPedido(); $dados = $prodpedModel->fetchAll($prodpedModel->select()->where('id_pedido = ?', $busca)); $this->view->pedido = $dados; } }
?> .</div> </div> <?php } if ($section == "check") { ?> <div id="content"> <div id="content-inner"> <div id="header"> <div id="header-inner"><h1>Entries By Drop-Off Location</h1></div> </div><!-- end header --> <!-- BEGIN content --> <?php do { $random = random_generator(5, 2); $entries_by_dropoff_loc = entries_by_dropoff_loc($row_dropoff['id']); $location_count = location_count($row_dropoff['id']); if ($location_count > 0) { ?> <h3>Location: <?php echo $row_dropoff['dropLocationName']; ?> </h3> <p><?php echo $row_dropoff['dropLocation']; ?> </p> <p>Total Entries at this Location: <?php echo $location_count; ?>
<label for="<?php echo $info2[0] . $info2[1]; ?> " class="col-lg-2 col-md-3 col-sm-4 col-xs-12 control-label">Brewer</label> <div class="col-lg-3 col-md-6 col-sm-8 col-xs-12"> <p class="form-control-static"><?php echo $info2[0] . " " . $info2[1]; ?> </p> </div> </div><!-- ./Form Group --> <?php } while ($row_sbd = mysql_fetch_assoc($sbd)); if ($totalRows_sbd < $row_sbi['sbi_places']) { for ($i = 1; $i <= $row_sbi['sbi_places'] - $totalRows_sbd; $i++) { $random = random_generator(6, 2); ?> <input type="hidden" name="id[]" value="<?php echo $random; ?> " /> <input type="hidden" name="entry_exists<?php echo $random; ?> " value="N" /> <input type="hidden" name="sid<?php echo $random; ?> " value="<?php echo $id; ?>
foreach ($query_string as $k => $v) { $q_string .= "&{$k}={$v}"; } $id = mysql_real_escape_string($_GET['id']); $relation = mysql_real_escape_string($_GET['relation']); if ($_POST['submitbut'] == 'Save') { $dvar['name'] = $_POST['name']; if ($_GET['do'] == 'edit') { $dvar['name'] = $_POST['name']; $sql_s = "select * from {$tabl} where id='" . $id . "'"; $exec_s = mysql_query($sql_s); $fetch_s = mysql_fetch_assoc($exec_s); $sql = "UPDATE {$tabl} SET " . update_query($dvar, $add_dvar, $remove_dvar, $change_dvar) . " where id='" . $id . "'"; $fg = 'ed'; } else { $uniq = random_generator(10); $add_dvar = array('status' => '1', 'time' => time()); list($insert_q[0], $insert_q[1]) = insert_query($dvar, $add_dvar, $remove_dvar, $change_dvar); $sql = "INSERT into {$tabl}(sort, {$insert_q['0']}) SELECT max(sort)+1, {$insert_q['1']} from {$tabl}"; $fg = 'ad'; } if (mysql_query($sql)) { $flag[$fg] = $item; } else { $flag['q'] = 'r'; } } if ($_GET['do'] == 'edit') { $sql = "SELECT * from {$tabl} where id='" . $id . "'"; $exec = mysql_query($sql) or die(mysql_error()); $fetch = mysql_fetch_assoc($exec);
// $savefile = SAVE_DIR . '/' . $_FILES['file']['name']; $pos = strrpos($filename, '.'); $ext = strtolower(substr($filename, $pos, strlen($filename))); switch ($ext) { case '.gif': case '.png': case '.jpg': case '.jpeg': break; default: die("-ERR: File Format!"); } $pos = strrpos($filename, '.'); $ext = substr($filename, $pos, strlen($filename)); //$random_name = random_generator() . $ext; $random_name = md5($_SERVER['REMOTE_ADDR']) . '_' . random_generator() . $ext; $savefile = SAVE_DIR . '/' . $random_name; move_uploaded_file($tempfile, $savefile); $imgsize = getimagesize($savefile); $filesize = filesize($savefile); if (!$imgsize) { $filesize = 0; $random_name = '-ERR'; unlink($savefile); } $rdata = sprintf("{ fileUrl: '%s/%s', filePath: '%s/%s', origName: '%s', fileName: '%s', fileSize: '%d' }", SAVE_URL, $random_name, SAVE_DIR, $random_name, $filename, $random_name, $filesize); echo $rdata; function random_generator($min = 8, $max = 32, $special = NULL, $chararray = NULL) { // --------------------------------------------------------------------------- //
$result = mysql_query($sql, $brewing); //echo "<p>".$sql."</p>"; $output .= "<li><strong>Themes</strong> data installed successfully.</li>"; // ------------------- // Users Table // ------------------- $sql = "\n\t\tCREATE TABLE IF NOT EXISTS `{$users_db_table}` (\n\t\t\t`id` int(8) NOT NULL AUTO_INCREMENT,\n\t\t\t`user_name` varchar(255) DEFAULT NULL,\n\t\t\t`password` varchar(250) DEFAULT NULL,\n\t\t\t`userLevel` char(1) DEFAULT NULL,\n\t\t\t`userQuestion` varchar(255) DEFAULT NULL,\n\t\t\t`userQuestionAnswer` varchar(255) DEFAULT NULL,\n\t\t\t`userCreated` timestamp NULL DEFAULT NULL COMMENT 'Timestamp of when the user was created.',\n\t\t\tPRIMARY KEY (`id`)\n\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;\n\t\t"; mysql_select_db($database, $brewing); mysql_real_escape_string($sql); $result = mysql_query($sql, $brewing); //echo "<p>".$sql."</p>"; if (HOSTED) { $gh_user_name = "*****@*****.**"; $gh_password = "******"; $random1 = random_generator(7, 2); $random2 = random_generator(7, 2); require CLASSES . 'phpass/PasswordHash.php'; $hasher = new PasswordHash(8, false); $hash = $hasher->HashPassword($gh_password); // For hosted accounts on brewcompetition.com and brewcomp.com $sql = sprintf("INSERT INTO `%s` (`id`, `uid`, `brewerFirstName`, `brewerLastName`, `brewerAddress`, `brewerCity`, `brewerState`, `brewerZip`, `brewerCountry`, `brewerPhone1`, `brewerPhone2`, `brewerClubs`, `brewerEmail`, `brewerNickname`, `brewerSteward`, `brewerJudge`, `brewerJudgeID`, `brewerJudgeMead`, `brewerJudgeRank`, `brewerJudgeLikes`, `brewerJudgeDislikes`, `brewerJudgeLocation`, `brewerStewardLocation`, `brewerJudgeAssignedLocation`, `brewerStewardAssignedLocation`, `brewerAssignment`, `brewerAssignmentStaff`, `brewerDiscount`, `brewerJudgeBOS`, `brewerAHA`) VALUES\n\t\t\t(NULL, 1, 'Geoff', 'Humphrey', '1234 Main Street', 'Anytown', 'CO', '80126', 'United States', '303-555-5555', '303-555-5555', NULL, '%s', NULL, 'N', 'N', 'A0000', NULL, 'Certified', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0);", $brewer_db_table, $gh_user_name); mysql_select_db($database, $brewing); mysql_real_escape_string($sql); $result = mysql_query($sql, $brewing); // For hosted accounts on brewcompetition.com or brewcomp.com $sql = sprintf("INSERT INTO `%s` (`id`, `user_name`, `password`, `userLevel`, `userQuestion`, `userQuestionAnswer`,`userCreated`) VALUES (NULL, '%s', '%s', '0', '%s', '%s', NOW());", $gh_user_name, $users_db_table, $hash, $random1, $random2); mysql_select_db($database, $brewing); mysql_real_escape_string($sql); $result = mysql_query($sql, $brewing); } $output .= "<li><strong>Users</strong> table installed successfully.</li>";
public function esqueciAction() { require_once APPLICATION_PATH . '/forms/Esqueci.php'; $this->view->form = new Application_Form_Esqueci(); if ($this->_request->isPost()) { $this->view->form->setDefaults($this->_request->getPost()); $data = $this->view->form->getValues(); $usuarioModel = new Application_Model_Usuario(); if ($this->view->form->isValid($data)) { $resetModel = new Application_Model_Reset(); $row = $resetModel->fetchRow($resetModel->select()->where('usuario = ?', $data['usuario'])); if ($row != null) { $this->view->aviso = 'Voce ja pediu um codigo para esse usuario'; } else { /// function to generate random number /////////////// function random_generator($digits) { srand((double) microtime() * 10000000); //Array of alphabets $input = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"); $random_generator = ""; // Initialize the string to store random numbers for ($i = 1; $i < $digits + 1; $i++) { // Loop the number of times of required digits if (rand(1, 2) == 1) { // to decide the digit should be numeric or alphabet // Add one random alphabet $rand_index = array_rand($input); $random_generator .= $input[$rand_index]; // One char is added } else { // Add one numeric digit between 1 and 10 $random_generator .= rand(1, 10); // one number is added } // end of if else } // end of for loop return $random_generator; } // end of function $key = random_generator(10); $key = md5($key); $data['key'] = $key; $resetModel = new Application_Model_Reset(); $id = $resetModel->insert($data); Zend_Loader::loadClass('Zend_Auth'); $authClass = Zend_Auth::getInstance(); $auth = $authClass->getStorage()->read(); $user = $data['usuario']; $contatoModel = new Application_Model_Contato(); $row = $contatoModel->fetchRow($contatoModel->select()->where('usuario = ?', $user)); $mail = $row['email']; //envia e-mail $data = 'Seu código para redefinição de senha é: ' . $key . '<br/>Seu usuário é: ' . $user; // Using the ini_set() ini_set("SMTP", "localhost"); ini_set("sendmail_from", "*****@*****.**"); ini_set("smtp_port", "587"); $mail = new Zend_Mail('UTF-8', 'ISO-8859-8'); $mail->setBodyHtml($data)->setFrom('*****@*****.**', 'Online Thru')->addTo($mail, 'Contato')->setSubject('Redefinição de senha - Online Thru')->send(); $this->view->aviso = 'O código para redefinição de senha foi enviado para o e-mail ' . $mail; } } } }
echo "Entries: " . get_table_info(1, "count_total", $row_tables['id'], $dbTable, "default") . "<br>Flights: " . $flights; ?> </p> <?php } ?> <p style="padding-top: 15px">** Please Note:</p> <ul> <li>If there are no entries showing below, flights at this table have not been assigned to rounds.</li> <li>If entries are missing, all entries have not been assigned to a flight or round.</li> </ul> </div> </div> <?php for ($i = 1; $i < $flights + 1; $i++) { $random = random_generator(5, 1); ?> <h3><?php echo "Table " . $row_tables['tableNumber'] . ", Flight " . $i; ?> </h3> <script type="text/javascript" language="javascript"> $(document).ready(function() { $('#sortable<?php echo $random; ?> ').dataTable( { "bPaginate" : false, "sDom": 'rt', "bStateSave" : false, "bLengthChange" : false,
<input type="hidden" name="brewerStewardLocation[]" value="<?php echo "Y-" . $row_stewarding['id']; ?> "> <?php } while ($row_stewarding = mysql_fetch_assoc($stewarding)); ?> <?php } // end if ($totalRows_judging > 1) } if ($section != "admin") { ?> <input type="hidden" name="userQuestion" value="What is your favorite all-time beer to drink?"> <input type="hidden" name="userQuestionAnswer" value="<?php echo random_generator(7, 2); ?> "> <?php } ?> <input type="hidden" name="userLevel" value="2" /> <input type="hidden" name="relocate" value="<?php echo relocate($_SERVER['HTTP_REFERER'], "default", $msg, $id); ?> "> <input type="hidden" name="IP" value="<?php echo $_SERVER['REMOTE_ADDR']; ?> " /> <?php
function style_choose($section, $go, $action, $filter, $view, $script_name, $method) { require CONFIG . 'config.php'; mysql_select_db($database, $brewing); if ($_SESSION['prefsStyleSet'] == "BJCP2008") { $end = 28; } if ($_SESSION['prefsStyleSet'] == "BJCP2015") { $end = 34; } if ($method == "thickbox") { $suffix = ''; $class = 'class="menuItem" id="modal_window_link"'; } if ($method == "none") { $suffix = ''; $class = 'class="menuItem"'; } $random = random_generator(7, 2); $style_choose = '<div class="menuBar"><a class="menuButton" href="#" onclick="#" onmouseover="buttonMouseover(event, \'menu_categories' . $random . '\');">Select Below...</a></div>'; $style_choose .= '<div id="menu_categories' . $random . '" class="menu" onmouseover="menuMouseover(event)">'; for ($i = 1; $i < 29; $i++) { if ($i <= 9) { $num = "0" . $i; } else { $num = $i; } $query_entry_count = sprintf("SELECT COUNT(*) as 'count' FROM %s WHERE brewCategory='%s'", $prefix . "brewing", $i); $result = mysql_query($query_entry_count, $brewing) or die(mysql_error()); $row = mysql_fetch_array($result); //if ($num == $filter) $selected = ' "selected"'; else $selected = ''; if ($row['count'] > 0) { $style_choose .= '<a ' . $class . ' style="font-size: 0.9em; padding: 1px;" href="' . $script_name . '?section=' . $section . '&go=' . $go . '&action=' . $action . '&filter=' . $num . $suffix . '&view=' . $view . '" title="Print ' . style_convert($i, "1") . '">' . $num . ' ' . style_convert($i, "1") . ' (' . $row['count'] . ' entries)</a>'; } } $query_styles = sprintf("SELECT brewStyle,brewStyleGroup FROM %s WHERE brewStyleGroup > %s", $prefix . "styles", $end); $styles = mysql_query($query_styles, $brewing) or die(mysql_error()); $row_styles = mysql_fetch_assoc($styles); $totalRows_styles = mysql_num_rows($styles); do { $query_entry_count = sprintf("SELECT COUNT(*) as 'count' FROM %s WHERE brewCategorySort='%s'", $prefix . "brewing", $row_styles['brewStyleGroup']); $result = mysql_query($query_entry_count, $brewing) or die(mysql_error()); $row = mysql_fetch_array($result); //if ($row_styles['brewStyleGroup'] == $filter) $selected = ' "selected"'; else $selected = ''; if ($row['count'] > 0) { $style_choose .= '<a ' . $class . ' style="font-size: 0.9em; padding: 1px;" href="' . $script_name . '?section=' . $section . '&go=' . $go . '&action=' . $action . '&filter=' . $row_styles['brewStyleGroup'] . $suffix . '" title="Print ' . $row_styles['brewStyle'] . '">' . $row_styles['brewStyleGroup'] . ' ' . $row_styles['brewStyle'] . ' (' . $row['count'] . ' entries)</a>'; } } while ($row_styles = mysql_fetch_assoc($styles)); $style_choose .= '</div>'; return $style_choose; }
// Add one random alphabet $rand_index = array_rand($input); $random_generator .= $input[$rand_index]; // One char is added } else { // Add one numeric digit between 1 and 10 $random_generator .= rand(1, 10); // one number is added } // end of if else } // end of for loop return $random_generator; } // end of function $key = random_generator(10); $key = md5($key); $tm = time(); //echo "insert into plus_key(userid, pkey,time,status) values('$row->userid','$key','$tm','pending'"; $sql = $dbo->prepare("insert into plus_key(userid, pkey,time,status) values('{$row->userid}','{$key}','{$tm}','pending')"); $sql->execute(); //print_r($sql->errorInfo()); $headers4 = "*****@*****.**"; ///// Change this address within quotes to your address /// $headers .= "Reply-to: {$headers4}\n"; $headers .= "From: {$headers4}\n"; $headers .= "Errors-to: {$headers4}\n"; //$headers = "Content-Type: text/html; charset=iso-8859-1\n".$headers;// for html mail un-comment this line $site_url = $site_url . "activepassword.php?ak={$key}&userid={$row->userid}"; //echo $site_url; if (mail("{$em}", "Your Request for login details", "This is in response to your request for login detailst at site_name \n \nLogin ID: {$row->userid} \n To reset your password, please visit this link( or copy and paste this link in your browser window )\n\n\r\n\n\n\r\n{$site_url}\r\n\n\n\r\n<a href='{$site_url}'>{$site_url}</a>\r\n\r\n \n\n Thank You \n \n siteadmin", "{$headers}")) {
function assign_to_table($tid, $bid, $filter, $total_flights, $round, $location, $table_styles, $queued) { // Function almalgamates the above functions to output the correct form elements // $bid = id of row in the brewer's table // $tid = id of row in the judging_tables table // $filter = judges or stewards from encoded URL // $flight = flight number (query above) // $round = the round number from the for loop // $location = id of table's location from the judging_locations table // Define variables $unassign = unassign($bid, $location, $round, $tid); $unavailable = unavailable($bid, $location, $round, $tid); $random = random_generator(8, 2); $r = ""; if (entry_conflict($bid, $table_styles)) { $disabled = 'disabled'; } else { $disabled = ''; } if ($filter == "stewards") { $role = 'S'; } else { $role = 'J'; } // Build the form elements $r .= '<input type="hidden" name="random[]" value="' . $random . '" />'; $r .= '<input type="hidden" name="bid' . $random . '" value="' . $bid . '" />'; $r .= '<input type="hidden" name="assignRound' . $random . '" value="' . $round . '" />'; $r .= '<input type="hidden" name="assignment' . $random . '" value="' . $role . '" />'; $r .= '<input type="hidden" name="assignLocation' . $random . '" value="' . $location . '" />'; //if ($disabled == "disabled") $r .= '<div class="disabled">Disabled - Participant has an Entry in this Round</div>'; if ($queued == "Y") { if (already_assigned($bid, $tid, "1", $round)) { $selected = 'checked'; $default = ''; } else { $selected = ''; $default = 'checked'; } //if ($selected == 'checked') echo '<div class="purple judge-alert">Assigned to this Table</div>'; } if ($unassign > 0) { // Check to see if the participant is already assigned to this round. // If so (function returns a value greater than 0), display the following: $r .= '<input type="checkbox" name="unassign' . $random . '" value="' . $unassign . '"/>'; $r .= '<span class="data">Unassign and...</span><br>'; } else { $r .= '<input type="hidden" name="unassign' . $random . '" value="' . $unassign . '"/>'; } if ($queued == "Y") { // For queued judging only //if (already_assigned($bid,$tid,"1",$round)) { $selected = 'checked'; $default = ''; } else { $selected = ''; $default = 'checked'; } $r .= 'Assign to This Round and Table?<br>'; $r .= '<input type="radio" name="assignRound' . $random . '" value="' . $round . '" ' . $selected . ' ' . $disabled . ' /><span class="data">Yes</span><br><input type="radio" name="assignRound' . $random . '" value="0" ' . $default . ' /><span class="data">No</span>'; } else { $r .= '<input type="hidden" name="assignTable' . $random . '" value="' . $tid . '" />'; } if ($queued == "N") { // Non-queued judging // Build the flights DropDown $r .= '<select name="assignFlight' . $random . '" ' . $disabled . '>'; $r .= '<option value="0" />Do Not Assign</option>'; for ($f = 1; $f < $total_flights + 1; $f++) { if (flight_round($tid, $f, $round)) { if (already_assigned($bid, $tid, $f, $round)) { $output = 'Assigned'; $selected = 'selected'; $style = ' style="color: #990000;"'; } else { $output = 'Assign'; $selected = ''; $style = ''; } $r .= '<option value="' . $f . '" ' . $selected . $style . ' />' . $output . ' to Flight ' . $f . '</option>'; } } // end for loop $r .= '</select>'; } return $r; }
$table_body1 .= "</td>"; $table_body1 .= "<td>"; $table_body1 .= $style . ": " . $row_scores['brewStyle']; $table_body1 .= "</td>"; $table_body1 .= "<td class=\"hidden-xs hidden-sm hidden-md\">"; $table_body1 .= $row_scores['brewerClubs']; $table_body1 .= "</td>"; if ($filter == "scores") { $table_body1 .= "<td class=\"hidden-xs hidden-sm hidden-md\">"; $table_body1 .= $row_scores['scoreEntry']; $table_body1 .= "</td>"; } $table_body1 .= "</tr>"; } while ($row_scores = mysql_fetch_assoc($scores)); $random1 = ""; $random1 .= random_generator(12, 1); // -------------------------------------------------------------- // Display // -------------------------------------------------------------- ?> <script type="text/javascript" language="javascript"> $(document).ready(function() { $('#sortable<?php echo $random1; ?> ').dataTable( { "bPaginate" : false, "sDom": 'rt', "bStateSave" : false, "bLengthChange" : false, "aaSorting": [[0,'asc']],
$random_generator .=rand(1,10); // one number is added } // end of if else } // end of for loop return $random_generator; } // end of function $gen = random_generator(10); echo("generating ". $counter . " codes .. <br>"); while ( $counter > 0 ) { //$result = mysql_query("INSERT INTO `code`.`album` (`downloadCode`, `downloadsRemaining`) VALUES ('" . random_generator(10) . "', '$numDownloads')") $result = mysql_query("INSERT INTO ".$db_name.".`album` (`downloadCode`, `downloadsRemaining`) VALUES ('" . random_generator(10) . "', '$numDownloads')") or die(mysql_error()); $counter = $counter - 1; } //end function 'generate echo ("all set!"); ?>
public function finalizarAction() { Zend_Loader::loadClass('Zend_Auth'); $authClass = Zend_Auth::getInstance(); if ($authClass->hasIdentity()) { $auth = $authClass->getStorage()->read(); $idx = $auth['usuario_id']; $usuarioModel = new Application_Model_Usuario(); $dados = 0; $dadosUsuario = $usuarioModel->fetchAll($usuarioModel->select()->from($usuarioModel->info(Zend_Db_Table_Abstract::NAME))->columns(array('usuario'))->where('idusuario = ?', $idx)); $dados = $dadosUsuario[0]['usuario']; $contatoModel = new Application_Model_Contato(); $dadosContato = $contatoModel->fetchAll($contatoModel->select()->from($contatoModel->info(Zend_Db_Table_Abstract::NAME))->columns(array('completo'))->where('usuario = ?', $dados)); $this->view->dadosContato = $dadosContato; } $categoriaModel = new Application_Model_Categoria(); $nome_categorias = $categoriaModel->fetchAll($categoriaModel->select()->from($categoriaModel->info(Zend_Db_Table_Abstract::NAME))->columns(array('nome_categoria'))); $this->view->categorias = $nome_categorias; $confirmar = $this->_request->getParam('confirmar'); if (isset($confirmar)) { if ($confirmar == 1) { $sessao = new Zend_Session_Namespace('SESSAO_CARRINHO'); Zend_Loader::loadClass('Zend_Auth'); $authClass = Zend_Auth::getInstance(); if ($authClass->hasIdentity()) { $auth = $authClass->getStorage()->read(); $id = $auth['usuario_id']; } /// function to generate random number /////////////// function random_generator($digits) { srand((double) microtime() * 10000000); //Array of alphabets $input = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"); $random_generator = ""; // Initialize the string to store random numbers for ($i = 1; $i < $digits + 1; $i++) { // Loop the number of times of required digits if (rand(1, 2) == 1) { // to decide the digit should be numeric or alphabet // Add one random alphabet $rand_index = array_rand($input); $random_generator .= $input[$rand_index]; // One char is added } else { // Add one numeric digit between 1 and 10 $random_generator .= rand(1, 10); // one number is added } // end of if else } // end of for loop return $random_generator; } // end of function $key = random_generator(10); $key = md5($key); $date = date_create(); $pedido = array(); $pedido['cliente'] = $auth['usuario_id']; $pedido['data'] = date_format($date, 'c'); $pedido['secure'] = $key; $pedido['valor'] = str_replace(array(',', '.'), '', $sessao->total); $pedidoModel = new Application_Model_Pedido(); $id = $pedidoModel->insert($pedido); $pedido_id = $pedidoModel->fetchAll($pedidoModel->select()->where('secure = ?', $key)); $pedido_xid = $pedido_id[0]['id_pedido']; $prodpedModel = new Application_Model_ProdutoPedido(); $addModel = new Application_Model_Adicionais(); if (isset($sessao->produtos)) { foreach ($sessao->produtos as $posicao => $id) { $chave = random_generator(10); $chave = md5($chave); $prod = array(); $prod['id_pedido'] = $pedido_xid; $prod['id_produto'] = $id; $prod['id_adicionais'] = $chave; $id = $prodpedModel->insert($prod); if (isset($sessao->quantidades[$posicao])) { foreach ($sessao->quantidades[$posicao] as $ingred => $quanti) { $adi = array(); $adi['id_adicionais'] = $chave; $adi['id_adicional'] = $ingred; $adi['quantidade'] = $quanti; $id = $addModel->insert($adi); } } } } $sessao->produtos = null; $sessao->quantidades = null; $sessao->total = null; $sessao->ingred = null; $email = $dadosContato[0]['email']; $data = '<html><body><table> <tr><td>Online Thru informa: Pedido recebido, valor R$ ' . number_format($pedido['valor'] / 100, 2, ',', '.') . '</td></tr> </table></body></html>'; // Using the ini_set() ini_set("SMTP", "localhost"); ini_set("sendmail_from", "*****@*****.**"); ini_set("smtp_port", "587"); $mail = new Zend_Mail('UTF-8', 'ISO-8859-8'); $mail->setBodyHtml($data)->setFrom('*****@*****.**', 'Online Thru')->addTo($email, 'Online Thru')->setSubject('Online Thru - Pedido')->send(); $this->view->aviso = "Pedido enviado com sucesso!"; } } else { $sessao = new Zend_Session_Namespace('SESSAO_CARRINHO'); $this->view->produtos = $sessao->produtos; if (!isset($sessao->ingred)) { $sessao->ingred = array(); } if ($this->_request->isPost()) { $sessao->ingred = $this->_request->getPost(); foreach ($sessao->ingred as $key => $value) { $mystring = $key; $findme = 'q'; $pos = strpos($mystring, $findme); if ($pos === false) { $mystring = $key; $find = '-'; $posi = strpos($mystring, $find); $chave = substr($key, 0, $posi); $ingr = substr($key, $posi + 1, strlen($key)); $sessao->ingredientes[$chave][$ingr] = $value; } else { $key = str_replace('q-', '', $key); $mystring = $key; $find = '-'; $posi = strpos($mystring, $find); $chave = substr($key, 0, $posi); $ingr = substr($key, $posi + 1, strlen($key)); $sessao->quantidades[$chave][$ingr] = $value; } $idp = $sessao->produtos[$chave]['id_produto']; $ingredModel = new Application_Model_Relacionamentos(); $nome_ingred = $ingredModel->fetchAll($ingredModel->select()->from($ingredModel->info(Zend_Db_Table_Abstract::NAME))->columns(array('qtd_padrao'))->where('id_produto = ?', $idp)->where('id_ingrediente = ?', $ingr)); if (isset($nome_ingred[0]['qtd_padrao'])) { $padrao[$idp][$ingr] = $nome_ingred[0]['qtd_padrao']; } } } if (isset($sessao->produtos) && sizeof($sessao->produtos) > 0) { if (isset($padrao)) { $this->view->padrao = $padrao; } if (isset($sessao->quantidades)) { $this->view->quantidades = $sessao->quantidades; } if (isset($sessao->ingredientes)) { $this->view->ingredientes = $sessao->ingredientes; } if (isset($sessao->ingred)) { $this->view->data = $sessao->ingred; } } } }
} $table_body1 .= $row_scores['brewerClubs']; $table_body1 .= "</td>"; if ($filter == "scores") { if ($action == "print") { $table_body1 .= "<td class='data' style='bdr1B'>"; } else { $table_body1 .= "<td class='data'>"; } $table_body1 .= $row_scores['scoreEntry']; $table_body1 .= "</td>"; } $table_body1 .= "</tr>"; } while ($row_scores = mysql_fetch_assoc($scores)); $random1 = ""; $random1 .= random_generator(7, 2); // -------------------------------------------------------------- // Display // -------------------------------------------------------------- echo $header1_1; ?> <script type="text/javascript" language="javascript"> $(document).ready(function() { $('#sortable<?php echo $random1; ?> ').dataTable( { "bPaginate" : false, "sDom": 'rt', "bStateSave" : false, "bLengthChange" : false,
// 환경에 맞게 수정 또는 참고하여 사용해 주십시오. // // --------------------------------------------------------------------------- require_once "config.php"; //---------------------------------------------------------------------------- // // $tempfile = $_FILES['file']['tmp_name']; $filename = $_FILES['file']['name']; // demo.html 파일에서 설정한 SESSID 값입니다. // $sessid = $_POST['sessid']; // 저장 파일 이름 // $savefile = SAVE_DIR . '/' . $_FILES['file']['name']; $pos = strrpos($filename, '.'); $ext = substr($filename, $pos, strlen($filename)); $random_name = random_generator() . $ext; $savefile = SAVE_DIR . '/' . $random_name; move_uploaded_file($tempfile, $savefile); $imgsize = getimagesize($savefile); $filesize = filesize($savefile); if (!$imgsize) { $filesize = 0; $random_name = '-ERR'; unlink($savefile); } $rdata = sprintf("{ fileUrl: '%s/%s', filePath: '%s/%s', origName: '%s', fileName: '%s', fileSize: '%d' }", SAVE_URL, $random_name, SAVE_DIR, $random_name, $filename, $random_name, $filesize); echo $rdata; function random_generator($min = 8, $max = 32, $special = NULL, $chararray = NULL) { // --------------------------------------------------------------------------- //