function login($email, $password) { $db = Database::getInstance(); $mysqli = $db->getConnection(); $mysqli->query("SET NAMES utf8"); $sql_query = 'SELECT * FROM user WHERE email="' . $email . '"'; $result = $mysqli->query($sql_query); $user = mysqli_fetch_assoc($result); global $password; //if password correct if (password_verify($password, $user['password'])) { session_start(); $_SESSION['auth'] = true; $_SESSION['id'] = $user['id']; $_SESSION['user'] = $user['user']; //check keep login, set coockie if ($_POST['loginkeeping'] == "on") { $key = md5(generate(7, 15)); setcookie('login', $user['user'], time() + 60 * 60 * 24 * 365); setcookie('key', $key, time() + 60 * 60 * 24 * 365); $sql_query = "UPDATE user SET cookie='" . $key . "' WHERE id='" . $user['id'] . "'"; $mysqli->query($sql_query); //if no keep login, set cookie as NULL } else { $sql_query = "UPDATE user SET cookie=NULL WHERE id='" . $user['id'] . "'"; $mysqli->query($sql_query); } header("Location: http://" . $_SERVER['SERVER_NAME']); } else { echo "Email or password is incorrect"; } }
public function __toString() { if (!isset($this->style)) { $this->style = 1; } return generate($this->style); }
function login($link, $email, $password) { $password = generate($password); $query = mysqli_query($connection, "SELECT `user_name`, `user_password` FROM `members` WHERE `user_name` = '{$username}' AND `user_password` = '{$password}'"); $count = mysqli_num_rows($query); //counting the number of returns //if the $count = 1 or more return true else return false if ($count >= 1) { return true; } else { return false; } }
/** * This file is part of the magento-sample project * * (c) Sergey Kolodyazhnyy <*****@*****.**> * */ function generate($folder) { $entries = array(); /** @var SplFileInfo[] $iterator */ $iterator = new FilesystemIterator($folder, FilesystemIterator::SKIP_DOTS); foreach ($iterator as $entry) { if (is_file($entry)) { $entries[$entry->getPathname()] = $entry->getPathname(); } else { $entries += generate($entry); } } return $entries; }
function test($freq, $prn = false) { global $fs, $filter; $data = generate($freq, 0.1, $fs); $res = filter($data, $filter); if ($prn) { for ($i = 0; $i < count($data); $i++) { echo "{$data[$i]}\t{$res[$i]}\n"; } } $aIn = amplitude($data); $aOut = amplitude($res); return $aOut / $aIn; }
function generate($srcPath, $dstPath = 'doc/', $imports = array()) { global $hide; if (!file_exists($dstPath)) { mkdir($dstPath, 0777, true); } $menu = ""; #collect imports foreach (glob($srcPath . "*.hx") as $fname) { $import = str_replace(SRC_ROOT, '', $fname); $import = str_replace(DOC_ROOT, '', $fname); $import = preg_replace('/(\\.\\/)|(\\.\\/)/', '', $import); $import = preg_replace('/\\//', '.', $import); $import = preg_replace('/^([^a-zA-Z]*)/', '', $import); $import = preg_replace('/\\.hx$/', '', $import); $imports[basename($fname, '.hx')] = $import; } #process files foreach (glob($srcPath . "*.hx") as $fname) { $import = str_replace(SRC_ROOT, '', $fname); $import = str_replace(DOC_ROOT, '', $fname); $import = preg_replace('/(\\.\\/)|(\\.\\/)/', '', $import); $import = preg_replace('/\\//', '.', $import); $import = preg_replace('/^([^a-zA-Z]*)/', '', $import); $import = preg_replace('/\\.hx$/', '', $import); $skip = false; foreach ($hide as $ignore) { if (strpos($import, $ignore) !== false) { $skip = true; break; } } if ($skip) { continue; } $menu .= "<li class=\"class\"><a href=\"" . url($import) . "\" class=\"class\">" . basename($fname, '.hx') . "</a></li>\n"; $doc = genDoc($fname, $imports); file_put_contents($dstPath . basename($fname, '.hx') . '.html', $doc); } #process dirs foreach (glob($srcPath . "*", GLOB_ONLYDIR) as $dirName) { $menu = "<li class=\"package\"><span class=\"package\">" . basename($dirName) . "</span>\n<ul>\n" . generate($dirName . '/', $dstPath . basename($dirName) . '/', $imports) . "</ul>\n</li>\n" . $menu; } return $menu; }
public function onkernelRequest(GetResponseEvent $event) { //recuperation de la route courante $route = $event->getRequest()->attributes->get('_route'); //on verifie a chaque renouvellement de route si on est pas dans les deux cas ci-dessous if ($route == 'aye_creche_livraison' || $route == 'aye_creche_validation') { //si c'est la cas on verifie qu'on a plus d'un article dans notre panier if ($this->session->has('panier')) { if (count($this->session->get('panier')) == 0) { $event->setResponse(new RedirectResponse($this->router - generate('panier'))); } } //on verifier bien que l'utilisateur est connecté sinon on redirige dans la page de login avec le message flash if (!is_object($this->securityContext->getToken()->getUser())) { $this->session->getFlashBag()->add('notification', 'Vous devez vous identifier afin de finaliser votre achat'); $event->setResponse(new RedirectResponse($this->router->generate('fos_user_security_login'))); } } }
$lyrics = array_values($lyrics); $names = scandir('names'); $names = array_diff($names, array('.', '..', '.DS_Store')); $names = array_values($names); if (isset($_POST['name']) and $_POST['lyrics']) { function generate($length = 5) { $chars = 'abdefhiknrstyz23456789'; $numChars = strlen($chars); $string = ''; for ($i = 0; $i < $length; $i++) { $string .= substr($chars, rand(1, $numChars) - 1, 1); } return $string; } $file = generate(5); $file .= '.txt'; $names[] = $file; $handle = fopen('names/' . $file, 'x'); fwrite($handle, trim($_POST['name'])); fclose($handle); $lyrics[] = $file; $handle = fopen('lyrics/' . $file, 'x'); fwrite($handle, $_POST['lyrics']); fclose($handle); array_values($names); array_values($lyrics); header('location: .'); } if (isset($_POST['rename']) and $_POST['relyrics']) { $i = $_POST['i'];
if (count($argv) == 8) { $fpopsperq = $argv[7]; } $every = 1; if (count($argv) == 9) { $every = $argv[8]; } echo "generating work for {$name} from {$start} to {$end}, count = {$count}\n"; @unlink("createWorkScript"); $f = fopen("createWorkScript", "wb"); $wus = 0; for ($i = $start, $loop = 0; $i < $end; $i += $count, $loop++) { if ($loop % $every != 0) { continue; } $wun = generate($input, $name, $i, $count, $dir); $cw = ""; $cw .= "mv {$dir}/{$wun} `bin/dir_hier_path {$wun}`\n"; $cw .= "bin/create_work "; $cw .= " --appname gnfslasieve4I1" . $ver . "e "; $cw .= " --wu_name {$wun} "; $cw .= " --wu_template templates/gnfslasieve4I1Xe_wu.xml "; $cw .= " --result_template templates/gnfslasieve4I1Xe_result.xml "; $cw .= " --rsc_fpops_est " . $fpopsperq * $count; $cw .= " --rsc_fpops_bound " . $fpopsperq * $count * 10; $cw .= " {$wun}\n"; fwrite($f, $cw); $wus++; } fwrite($f, "rm createWorkScript\n"); fclose($f);
} ?> <script>document.getElementById('info').style.display='none';</script> <div id=info width=100% align=center>Retrive upload ID</div> <?php $decode = decode($pwid[1]); $va = explode('/', $decode); if (!empty($va[2]) && !empty($va[4])) { $uid = $va[2]; $upas = $va[4]; } else { html_error('Error get User ID and/or User Password.'); } $Url = parse_url("http://uploaded.to/js/script.js"); $script = geturl($Url["host"], $Url["port"] ? $Url["port"] : 80, $Url["path"] . ($Url["query"] ? "?" . $Url["query"] : ""), $referrer, $cookie, 0, 0, $_GET["proxy"], $pauth); $editKey = generate(6); $serverUrl = cut_str($script, 'uploadServer = \'', '\'') . 'upload?admincode=' . $editKey . '&id=' . $uid . '&pw=' . $upas; $Url = parse_url("http://uploaded.to/io/upload/precheck"); $id = rand(1, 15); $fileInfo['size'] = filesize($lfile); $fileInfo['id'] = 'file' . $id; $fileInfo['name'] = $lname; $fileInfo['editKey'] = $editKey; geturl($Url["host"], $Url["port"] ? $Url["port"] : 80, $Url["path"] . ($Url["query"] ? "?" . $Url["query"] : ""), 'http://uploaded.to/upload', $cookie, $fileInfo, 0, $_GET["proxy"], $pauth); ?> <script>document.getElementById('info').style.display='none';</script> <?php $url = parse_url($serverUrl); $upagent = "Shockwave Flash"; $fpost['Filename'] = $lname; $fpost['Upload'] = 'Submit Query';
} return $rarr; } else { $carr = schoolQuery("all", $sid); $r1 = 227; $r2 = 82; $g1 = 85; $g2 = 4; $b1 = 66; $b2 = 53; $grad = 1 / sizeof($carr); $i = 0; foreach ($carr as $key => &$elem) { $elem["color"] = sprintf("%02s", dechex($r1 + $i * $grad * ($r2 - $r1))) . sprintf("%02s", dechex($g1 + $i * $grad * ($g2 - $g1))) . sprintf("%02s", dechex($b1 + $i * $grad * ($b2 - $b1))); $i++; } return array("All clubs" => $carr); } } // MAIN $master_arr = []; if (isset($_GET["int"]) && isset($_GET["sid"])) { $int = $_GET["int"]; $sid = $_GET["sid"]; $arr_clubs = populate($int, $sid, $conn); if (isset($arr_clubs) && $arr_clubs != -1) { $arr_interests = flipsort($arr_clubs, $conn); $master_arr = generate($arr_interests, $sid, $conn); } } echo json_encode($master_arr, JSON_UNESCAPED_UNICODE);
function generate($nav, $parent = 0, $level = 0) { $out = '<ul level="' . $level . '">'; foreach ($nav[$parent] as $nav_item) { $out .= '<li href="' . $nav_item->href . '">'; if (isset($nav[$nav_item->id])) { $out .= '<span class="arrow"><img src="images/arrow_r.png" alt=">" /></span>'; } $out .= '<a href="' . $nav_item->href . '" ' . (isset($nav[$nav_item->id]) ? '' : 'class="dink"') . '>' . $nav_item->name . '</a>'; if ($nav_item->add_href) { $out .= '<a href="' . $nav_item->add_href . '" class="add"> <span style="font-size:12px;color:#CEDDEC">+</span></a>'; } if (isset($nav[$nav_item->id])) { $out .= generate($nav, $nav_item->id, $level + 1); } $out .= '</li>'; } $out .= '</ul>'; return $out; }
//Hash pass $login = $_POST['usernamesignup']; //Take login $db = Database::getInstance(); $mysqli = $db->getConnection(); $mysqli->query("SET NAMES utf8"); //connect to DB $sql_query = 'SELECT * FROM user WHERE email="' . $email . '" OR user="******"'; //Chek user in DB with login and meil $result = $mysqli->query($sql_query); $row = mysqli_fetch_row($result); $name = $row[1]; $mail = $row[3]; //CHECK IF NO USERS WITH LOGIN AND PASS if (empty($name) and empty($mail)) { $verification = generate(10, 20); //Create verification code //INSERT USER IN DB $sql_query = "INSERT INTO user (user, password, email,status,verification,verification_code) VALUES ('{$login}', '{$hash}', '{$email}','1','0','{$verification}')"; $result = $mysqli->query($sql_query); login($email, $hash); //IF LOGIN OR PASS BUSY } else { echo "LOGIN or PASSWORD is busy"; } //IF NO CONFIRM } else { echo "Passwords are not equal"; } //IF EMPTY } else {
$html = str_replace("{VIEW_WINE_TYPE}", "VOIR LES VINS TYPE", $html); $html = str_replace("{Follow_Us}", "Suivez Nous", $html); $html = str_replace("{FEATURED_COLLECTIONS}", "SELECTION DE COLLECTIONS", $html); $html = str_replace("{FEATURED_WINE}", "VIN EN VEDETTE", $html); $html = str_replace("{LAST_FROM_BLOG}", "DERNIER DE BLOG", $html); $html = str_replace("{LAST_FROM_NEWS}", "DERNIER DE NOUVELLES", $html); $html = str_replace("{CUSTOMER_SERVICE}", "SERVICE À LA CLIENTÈLE", $html); $html = str_replace("{contacts_linl}", "CONTACTEZ NOUS", $html); $html = str_replace("{We_promise}", "Nous nous engageons à vous envoyer que de bonnes choses", $html); break; } } function generate() { $rand = mt_rand(00, 99999999); return $rand; } $html = str_replace("{generate}", generate(), $html); $html = str_replace("{vendors_link}", vendors_link(), $html); $html = str_replace("{types_link}", types_link(), $html); $html = str_replace("{clear_cart}", "http://" . $_SERVER['HTTP_HOST'] . "/" . $_GET['lang'] . "/?clearcart=true", $html); $html = str_replace("{host}", "http://" . $_SERVER['HTTP_HOST'], $html); $html = str_replace("{lang}", $_GET['lang'], $html); $html = str_replace("{popup_cart}", popup_cart(), $html); $html = str_replace("{full_price}", $_SESSION['fullprice'], $html); if ($_SESSION['fullprice']) { $html = str_replace("{popup_total}", "<span style='margin-left:16px;' class='pull-left'>total price</span> <element style='margin-right:16px;' class='pull-right'>" . $_SESSION['fullprice'] . " CHF</element><div class='clr'></div>", $html); } else { $html = str_replace("{popup_total}", "totlal price <span class='badge ptotal'>0</span> CHF", $html); } echo $html;
$vals = array($module_name, $module_human_name); function generate($template, $dest, $keys, $vals) { if (file_exists($dest)) { echo "{$dest} already exists. Overwrite? [Y/n] "; $fp = fopen('php://stdin', 'r'); $answer = trim(fgets($fp)); fclose($fp); if (strcasecmp($answer, 'Y') && $answer) { return false; } } $tmpl = implode('', file($template)); $tmpl = str_replace($keys, $vals, $tmpl); $fp = fopen($dest, "w") or exit(1); fputs($fp, $tmpl); fclose($fp); return true; } if (generate($genpath . '/templates/config.tpl.php', $module_dir . DS . 'config' . DS . 'config.php', $keys, $vals)) { echo "New Config: {$module_dir}" . DS . 'config' . DS . "config.php\n"; } if (generate($genpath . '/templates/urls.tpl.php', $module_dir . DS . 'config' . DS . 'urls.php', $keys, $vals)) { echo "New Config: {$module_dir}" . DS . 'config' . DS . "urls.php\n"; } if (generate($genpath . '/templates/page.tpl.php', $module_dir . DS . 'pages' . DS . 'page.php', $keys, $vals)) { echo "New Controller: {$module_dir}" . DS . 'pages' . DS . "page.php\n"; } echo "\n"; echo "To enable this module, add it to the MODULES constant in config/config.php\n\n"; exit(0);
function generate($ds, $graph, &$data) { if (!isset($ds['datasetURI']) || $ds['datasetURI'] == '') { echo "Dataset URI missing"; if (isset($ds['title']) && $ds['title'] != '') { echo " - Dataset Title: " . $ds['title']; } return; } $rdf = $graph->resource($ds['datasetURI'], array('dataid:Dataset', 'odrl:license', 'dcat:Dataset', 'void:Dataset', 'sd:Dataset', 'prov:Entity')); if (isset($ds['title']) && $ds['title'] != '') { $rdf->set('dct:title', $ds['title']); } if (isset($ds['label']) && $ds['label'] != '') { $rdf->set('rdfs:label', $ds['label']); } if (isset($ds['description']) && $ds['description'] != '') { $rdf->set('dct:description', $ds['description']); } if (isset($ds['issued']) && $ds['issued'] != '') { $rdf->set('dct:issued', new EasyRdf_Literal_Date($ds['issued'])); } if (isset($ds['rights']) && $ds['rights'] != '') { $rdf->set('dct:rights', $ds['rights']); } if (isset($ds['rootResource']) && $ds['rootResource'] != '') { $rdf->set('void:rootResource', $graph->resource($ds['rootResource'])); } if (isset($ds['exampleResource']) && $ds['exampleResource'] != '') { $rdf->set('void:exampleResource', $graph->resource($ds['exampleResource'])); } if (isset($ds['language']) && $ds['language'] != '') { $rdf->set('dct:language', $ds['language']); } if (isset($ds['ontologyLocation']) && $ds['ontologyLocation'] != '') { $rdf->set('void:vocabulary', $graph->resource($ds['ontologyLocation'])); } if (isset($ds['landingPage']) && $ds['landingPage'] != '') { $rdf->set('dcat:landingPage', $graph->resource($ds['landingPage'])); } if (isset($ds['keyword']) && $ds['keyword'] != '') { $rdf->set('dcat:keyword', $ds['keyword']); } if (isset($ds['license'])) { $rdf->set('dataid:licenseName', $ds['license']['name']); $rdf->set('dct:license', $graph->resource($ds['license']['val'])); } if (isset($ds['datasets'])) { foreach ($ds['datasets'] as $ds2) { if (isset($ds2['datasetURI']) && $ds2['datasetURI'] != '') { $r = $graph->resource($ds2['datasetURI']); $graph->add($rdf, $ds2['type'], $r); generate($ds2, $graph, $data); } else { echo 'Error: Please check datasets URI!'; return; } } } if (isset($ds["distribution"])) { foreach ($ds["distribution"] as $d) { if (isset($d['accessUrl']) && isset($d['prop'])) { $r = $graph->resource($d['accessUrl']); $graph->add($rdf, $d['prop'], $r); } } } if (isset($ds["linkset"])) { foreach ($ds["linkset"] as $l) { if (isset($l['exampleResource']) && isset($l['prop'])) { $r = $graph->resource($l['exampleResource']); } $graph->add($rdf, $l["prop"], $r); } } //contact information if (isset($ds["agent"])) { foreach ($ds["agent"] as $l) { $r; // if there is a resource if (isset($l['resource']) && $l['resource'] != '') { $r = $graph->resource($l['resource']); $graph->add($rdf, $l["prop"], $r); if (isset($l['label']) || isset($l['name']) || isset($l['mbox'])) { // $r = $graph->resource($l['resource'], array('prov:Agent', 'foaf:Agent')); $r = $graph->resource($l['resource'], array('dataid:Agent')); } } else { // $r = $graph->newBNode(array( 'prov:Agent', 'foaf:Agent')); $r = $graph->newBNode(array('dataid:Agent')); $graph->add($rdf, $l["prop"], $r); } if (isset($l['label']) && $l['label'] != '') { $r->set('rdfs:label', $l['label']); } if (isset($l['name']) && $l['name'] != '') { $r->set('foaf:name', $l['name']); } if (isset($l['mbox']) && $l['mbox'] != '') { $r->set('foaf:mbox', $l['mbox']); } } } if (isset($ds["wasDerivedFromAgent"]) || isset($ds["wasDerivedFromTitle"]) && $ds["wasDerivedFromTitle"] != '') { $r = $graph->newBNode(array('dataid:Entity')); $graph->add($rdf, "prov:wasDerivedFrom", $r); if (isset($ds["wasDerivedFromTitle"]) && $ds["wasDerivedFromTitle"] != '') { $r->set('dct:title', $ds["wasDerivedFromTitle"]); } foreach ($ds["wasDerivedFromAgent"] as $l) { $r2 = $graph->newBNode(array('dataid:Agent')); $graph->add($r, $l["prop"], $r2); if (isset($l['label'])) { $r2->set('rdfs:label', $l['label']); } if (isset($l['name'])) { $r2->set('foaf:name', $l['name']); } if (isset($l['mbox'])) { $r2->set('foaf:mbox', $l['mbox']); } } } if (isset($ds["wasGeneratedByAgent"]) || isset($ds["wasGeneratedByTitle"]) && $ds["wasGeneratedByTitle"] != '') { $r = $graph->newBNode(array('dataid:Activity')); $graph->add($rdf, "prov:wasGeneratedBy", $r); if ($ds["wasGeneratedByTitle"] != '') { $r->set('dct:title', $ds["wasGeneratedByTitle"]); } foreach ($ds["wasGeneratedByAgent"] as $l) { $r2 = $graph->newBNode(array('dataid:Agent')); $graph->add($r, $l["prop"], $r2); if (isset($l['label'])) { $r2->set('rdfs:label', $l['label']); } if (isset($l['name'])) { $r2->set('foaf:name', $l['name']); } if (isset($l['mbox'])) { $r2->set('foaf:mbox', $l['mbox']); } } } if (isset($ds["distribution"])) { foreach ($ds["distribution"] as $d) { if (isset($d['accessUrl'])) { // $rdfo = $graph->resource($d['accessUrl'], array('rdfs:subClassOf', 'dcat:distribution')); $rdfo = $graph->resource($d['accessUrl'], array('dataid:Distribution')); if (isset($d['title'])) { $rdfo->set('dct:title', $d['title']); } if (isset($d['description'])) { $rdfo->set('dct:description', $d['description']); } if (isset($d['issued'])) { $rdfo->set('dct:issued', $d['issued']); } if (isset($d['rights'])) { $rdfo->set('dct:rights', $d['rights']); } if (isset($d['accessUrl'])) { $rdfo->set('dcat:accessURL', $graph->resource($d['accessUrl'])); } if (isset($d['mediaType'])) { $rdfo->set('dcat:mediaType', $d['mediaType']); } if (isset($d['format'])) { $rdfo->set('dct:format', $d['format']); } if (isset($d['triples'])) { $rdfo->set('void:triples', $d['triples']); } } } } if (isset($ds["linkset"])) { foreach ($ds["linkset"] as $d) { $rdfo = $graph->resource($d['exampleResource'], array('dataid:Linkset')); $rdfo->set('dct:issued', $d['issued']); $rdfo->set('dct:modified', $d['modified']); $rdfo->set('void:exampleResource', $d['exampleResource']); $rdfo->set('void:linkPredicate', $d['linkPredicate']); $rdfo->set('void:triples', $d['triples']); $rdfo->set('void:target', $d['target']); } } $format = 'turtle'; $data = $graph->serialise($format); // $data = str_replace($data, $_POST['keyword'], str_replace($_POST['keyword'],',','","')); if (isset($ds['keyword'])) { $data = str_replace($ds['keyword'], str_replace(array(',', ', '), '","', $ds['keyword']), $data); } if (!is_scalar($data)) { $data = var_export($data, true); } }
$result = call_color_scheme_api($api_type, $id); if (!$result) { die("null"); } print json_encode($result); }); $app->get("/api/package/?", function () use($app) { header("Content-type: text/json"); if (!check_colors($app->request())) { die("null"); } $api_type = $app->request()->params("api_type"); $id = $app->request()->params("id"); $c = $app->request()->params("c"); $share = $app->request()->params("share"); $result_generate = generate($api_type, $id, $c); if (!$result_generate) { die("null"); } $theme_id = save_theme($api_type, $id, $c, $share); if (!$theme_id) { die("null"); } if ($share) { $result = generate_for_gallery($theme_id); if (!$result) { die("null"); } } print json_encode($result_generate); });
* @version 1.0 * @author Fuel Development Team * @license MIT License * @copyright 2010 - 2013 Fuel Development Team * @link http://fuelphp.com */ /** * One file documenation system using Markdown files, * containing FFM (Fuel Flavoured Markdown) */ // FuelPHP version of these docs define('VERSION', '2.0-dev'); // documentation page template to use define('TEMPLATE', 'assets/html/v1template.html'); // whether or not we have to generate rewrite compatible URL's define('REWRITE', isset($_GET['rewrite']) and $_GET['rewrite'] == 1); // url to the API docs for this version define('APIROOT', 'http://dev-api.fuelphp.com/classes/'); // relative path to the markdown doc files define('DOCROOT', 'docs/'); // page to load when the site root is requested define('INTROPAGE', '01-Introduction/01-Welcome.md'); // base url for this script define('BASEURL', dirname($_SERVER['PHP_SELF']) . '/'); // load our markdown-2-html library require __DIR__ . '/assets/lib/md2html.php'; // find the file to show $page = whichpage(__DIR__) or $page = DOCROOT . '../NOTFOUND.md'; // and generate the HTML echo generate($page);
<?php $con = mysql_connect("localhost", "Admin", "pkvcobas132"); if (!$con) { die("Reason : " . mysql_error()); } mysql_select_db("spas", $con); $totalSessionsStd = 0; if (isset($_POST['submit'])) { $sql2 = "SELECT * FROM studentsess"; $mydata = mysql_query($sql2, $con); $startDate = $_POST['start']; $stopDate = $_POST['stop']; while ($res2 = mysql_fetch_array($mydata)) { $totalSessionsStd = $res2['totalsess']; generate($res2['usn'], $startDate, $stopDate); } } include "prepareCSVFile.php"; /* Below Code generates random activities for a given USN, startDate and endDate */ /* *************************************************************************************************************************** */ /* *************************************************************************************************************************** */ function generate($stdUSN, $startDate, $endDate) { global $con, $totalSessionsStd; /*echo 'stdUSN : '.$stdUSN.'<br />'; echo 'startDate : '.$startDate.'<br />'; echo 'endDate : '.$endDate.'<br />'; echo 'totalSessionsStd : '.$totalSessionsStd.'<br />';*/ $totalSessionsStd++; $sql = "SELECT * FROM activity WHERE usn = '{$stdUSN}' and day >= '{$startDate}' and day <= '{$endDate}'";
echo "<script type='text/javascript'>document.getElementById('login').style.display='none';</script>\n<div id='info' width='100%' align='center'>Retrive upload ID</div>\n"; $page = geturl('uploaded.net', 80, '/', $referer, $cookie, 0, 0, $_GET['proxy'], $pauth); is_page($page); $js = geturl('uploaded.net', 80, '/js/script.js', $referer, $cookie, 0, 0, $_GET['proxy'], $pauth); is_page($js); if (!preg_match('@uploadServer = [\'|\\"](https?://([^\\|\'|\\"|\\r|\\n|\\s|\\t]+\\.)uploaded\\.net/)[\'|\\"]@i', $js, $up)) { html_error('Error: Cannot find upload server.', 0); } if (!preg_match('@id="user_id" value="(\\d+)"@i', $page, $uid)) { html_error('Error: UserID not found.'); } if (!preg_match('@id="user_pw" value="(\\w+)"@i', $page, $spass)) { html_error('Error: Password hash not found.'); } // $spass = array(1 => sha1($_REQUEST['up_pass'])); $adm_link = generate(); $post = array(); $post['Filename'] = $lname; $post['Upload'] = 'Submit Query'; $up_url = $up[1] . "upload?admincode={$adm_link}&id={$uid[1]}&pw={$spass[1]}"; // Uploading echo "<script type='text/javascript'>document.getElementById('info').style.display='none';</script>\n"; $url = parse_url($up_url); $upfiles = upfile($url['host'], 80, $url['path'] . ($url['query'] ? '?' . $url['query'] : ''), $referer, $cookie, $post, $lfile, $lname, 'Filedata', '', $_GET['proxy'], $pauth, 'Shockwave Flash'); // Upload Finished echo "<script type='text/javascript'>document.getElementById('progressblock').style.display='none';</script>\n"; is_page($upfiles); $content = substr($upfiles, strpos($upfiles, "\r\n\r\n") + 4); if (preg_match('@^(\\w+)\\,\\d@i', $content, $fid)) { $download_link = 'http://uploaded.net/file/' . $fid[1]; // $download_link = 'http://ul.to/'.$fid[1];
<?php /** * Created by PhpStorm. * User: nagyatka * Date: 2016. 08. 12. * Time: 12:43 */ $url = "/asd/{ddd:[a-z]+}/{kuka}/asd/{tojci}"; $params = ["ddd" => "dfwe", "tojci" => "sssss"]; echo generate($url, $params) . "\n"; /* // Performance test $res = []; for($i = 0; $i < 100; $i++) { $start = microtime(true); generate($url,$params); $end = microtime(true)-$start; $res[] = $end; echo $end."\n"; } echo "AVG: ".(array_sum($res)/count($res)*1000)." millisec \n"; // Result: AVG: 0.039803981781006 millisec */ function generate($url, $params) { $resultUrl = ""; $index = 0; while (($firstPos = strpos($url, "{", $index)) != false) { $lastPos = strpos($url, "}", $firstPos);
if (!$_PEFI->crdntls->can('commercials')) { redirect_to_login($_PEFI->route->page); } include_once "{$_PEFI->libPath}/pefi_fileshelper.php"; include_once "{$_PEFI->libPath}/pefi_stringhelper.php"; $todo = $_PEFI->todo; $_PEFI->view->title = 'Commercials Action Output'; if ($todo == 'clean') { $_PEFI->view->content .= clean(array_key_exists('clean_tmp', $_REQUEST) ? true : false); } elseif ($todo == 'publish') { $_PEFI->view->content .= publish(); } elseif ($todo == 'upload') { $_PEFI->view->content .= upload(); } elseif ($todo == 'generate') { $_PEFI->view->content .= generate(array_key_exists('download', $_REQUEST) ? true : false); } // actions function clean($clean_tmp = false) { $tmp = '_tmp/Pefi_COMRES/'; $res = 'Cleaning commercials<br>'; // remove commercial files $files = explode(';', tr('commercials.urls:admin')); foreach ($files as $fName) { $fName = '_pages/' . $fName; if (@unlink($fName)) { $res .= "Removed file: {$fName} <br>"; } else { $res .= "Tried to remove file: {$fName} but no success <br>"; }
function get_file($what) { validate_all_variables(); // get filename (this also validates the data) global $database; $filename = get_filename_for_export($what); generate($what, $filename); // redirect to file $location = str_replace("index.php", "", ANALYSIS_URL) . filename_to_url($filename); if (defined('LOCATION')) { $location = LOCATION . $location; } header("Content-type: text/csv"); header("Location: {$location}"); }
<?php generate('../heureka.xsl', 'heureka-out.xml'); generate('../jyxo.xsl', 'jyxo-out.xml'); generate('../zbozi.xsl', 'zbozi-out.xml'); function generate($inputTransformation, $outputFile) { $xml = new DOMDocument(); $xml->load('../universal.xml'); $xsl = new DOMDocument(); $xsl->load($inputTransformation); $proc = new XSLTProcessor(); $proc->importStylesheet($xsl); $newXml = $proc->transformToXML($xml); file_put_contents($outputFile, $newXml); }
<?php ///////////////////////////////////////////////////// //Внимание скрипт это скрипт выгрузки только для .US ///////////////////////////////////////////////////// set_time_limit(0); define("HTTP_SERVER", "http://www.setbook.us"); chdir('/var/www/2009/'); require 'includes/application_top.php'; include 'cron/include/logs.class.php'; include 'cron/include/yandex.functions.php'; $logs = new logs('cron/logs/export_yandex_xml.log'); $GLOBAL_CRON = true; $logs->write("------------- START --------------"); /* Общая выгрузка */ //из-за того что не выгружается файл по крон, прописываем жестко пути для русского сайта $HTTP_GET_VARS['file'] = "/var/www/2009/prices/yandex_xml/yandex_us.xml"; //http://www.setbook.ru/prices/yandex_xml/yandex_us.xml $logs->write("START [US, " . (isset($HTTP_GET_VARS['type']) ? $HTTP_GET_VARS['type'] : 'ALL') . "] " . $HTTP_GET_VARS['file']); $res = generate($HTTP_GET_VARS); $logs->write("STAT Categories: " . $res['Categories'] . ", Offers: " . $res['Offers'] . ", Filesize: " . Round(filesize($HTTP_GET_VARS['file']) / 1024 / 1024, 2) . "Mb"); $logs->write("END " . $HTTP_GET_VARS['file']); unset($logs);
fclose($fp); if (strcasecmp($answer, 'Y') && $answer) { return false; } } $tmpl = implode('', file($template)); $tmpl = str_replace($keys, $vals, $tmpl); $fp = fopen($dest, "w") or exit(1); fputs($fp, $tmpl); fclose($fp); return true; } // Generate model if (generate($genpath . '/templates/model.tpl.php', "{$basepath}/models/{$fnbase}.php", $keys, $vals)) { echo "New Model: {$basepath}/models/{$fnbase}.php\n"; } // Generate page controller if (generate($genpath . '/templates/page.tpl.php', "{$basepath}/pages/{$fnbase}.php", $keys, $vals)) { echo "New Page Controller: {$basepath}/pages/{$fnbase}.php\n"; } @mkdir("{$basepath}/templates/{$fnbase}"); // Generate "list" template if (generate($genpath . '/templates/t_list.tpl.php', "{$basepath}/templates/{$fnbase}/list.php", $keys, $vals)) { echo "New Template: {$basepath}/templates/{$fnbase}/list.php\n"; } // Generate the "create/edit" template if (generate($genpath . '/templates/t_create.tpl.php', "{$basepath}/templates/{$fnbase}/create.php", $keys, $vals)) { echo "New Template: {$basepath}/templates/{$fnbase}/create.php\n"; } echo "\n"; exit(0);
$laengebeschreibung = array("min" => 100, "max" => 150); //Zeichen aus denen ein Suchbegriff zusammengesetzt wird $alphasuch = "abcdefghijklmnopqrstuvwxyz" . "ABCDEFGHIJKLMNOPQRSTUVWXYZ" . "0123456789"; //Zeichen aus denen eine Beschreibung zusammengesetzt wird $alphabeschr = "abcdefghijklmnopqrstuvwxyz" . "ABCDEFGHIJKLMNOPQRSTUVWXYZ" . "0123456789" . " "; //============================ //Generiert inserts für wissen //============================ function generate() { fwrite($GLOBALS['insertFile'], "[\n"); for ($i = 1; $i <= $GLOBALS['anzahl'] - 1; ++$i) { $suchbegrifftmp = ""; $beschreibungtmp = ""; //Suchbegriff erzeugen for ($laengesuchbegrifftmp = rand($GLOBALS['laengesuchbegriff']["min"], $GLOBALS['laengesuchbegriff']["max"]); $laengesuchbegrifftmp > 0; $laengesuchbegrifftmp--) { $suchbegrifftmp = $suchbegrifftmp . substr($GLOBALS['alphasuch'], rand(0, strlen($GLOBALS['alphasuch']) - 1), 1); } //Berschreibung erzeugen for ($laengebeschreibungtmp = rand($GLOBALS['laengebeschreibung']["min"], $GLOBALS['laengebeschreibung']["max"]); $laengebeschreibungtmp > 0; $laengebeschreibungtmp--) { $beschreibungtmp = $beschreibungtmp . substr($GLOBALS['alphabeschr'], rand(0, strlen($GLOBALS['alphabeschr']) - 1), 1); } //Schreibt den Befehl in die Datei fwrite($GLOBALS['insertFile'], "{\n suchbegriff: \"{$suchbegrifftmp}\",\n beschreibung: \"{$beschreibungtmp}\"\n },\n"); } //noch einmal aber ohne beistrich _class: \"hello.Person\", fwrite($GLOBALS['insertFile'], "{\n suchbegriff: \"tests\",\n beschreibung: \"testb\"\n }]\n"); } echo "Erzeugen von " . $anzahl . " Eintraegen\n"; generate(); echo "Erledigt!";
"type": "produitCommercial", "libelle": "' . generate("string", 30, 50, $version) . '", "idProduitGenerique": "' . generate("id", "produitGenerique", "", $version) . '", "categoriesAffichage": "categorie affichage a definir", "caracteristiques": [ ' . generate("caracteristiques", 3, 10, $version) . ' ] } ', 'offreCommerciale' => ' { "type": "offreCommerciale", "libelle": "' . generate("string", 30, 50, $version) . '", "idProduitCommercial": "' . generate("id", "produitCommercial", "", $version) . '", "codeTarifaire": "GrilleTarifaireADefinir", "caracteristiques": [ ' . generate("caracteristiques", 0, 5, $version) . ' ] }']; echo $k . '_' . ($i + 1) . '_V' . $version . ' : ' . $modelesFlux[$k] . '<br/><br/>'; $cb->upsert($k . '_' . ($i + 1) . '_V' . $version, $modelesFlux[$k]); } } } function generate($type, $min, $max, $version) { global $nbDocumentsDemandes; switch ($type) { case "string": $melange = str_shuffle('abc def ghijklmn opqrstuv wxyz012 34567 89ABCDEFGHIJKLMNOPRSTUVWXYZ'); return 'V' . $version . '_' . substr($melange, 0, rand($min, $max)); case "nb":
dumpkey($key); return $key; } function str2hex($keystr) { $key = array(); foreach (str_split($keystr, 2) as $hex) { $key[] = hexdec($hex); } return $key; } function show_usage() { global $argv; echo "{$argv['0']} [-r|-f] 012345679ABCDEF\n"; } if ($argc == 3) { $key = str2hex($argv[2]); switch ($argv[1]) { case '-f': generate($key); break; case '-r': generate_rev($key); break; default: show_usage(); } } else { show_usage(); }
// << got name $name = trim(fgets(STDIN)); //create new dir $mkdir = false; // check if name is valid varname if (is_valid_varname($name)) { //build theme path $themepath = dirname(TPLDIR) . DIRECTORY_SEPARATOR . $name; //if folder does not exist, as user if they'd like to create the dir if (!is_dir($themepath)) { // >> get answer fwrite(STDOUT, "Theme directory {$themepath} does not exist; create it y/n?"); $answer = trim(fgets(STDIN)); if ($answer !== "Y" && $answer !== "y") { exit; } $mkdir = true; } $pass = true; } else { echo "Theme name must follow variable naming conventions\n"; } } while (!$pass); //load build paths $build = (require BUILDPATH . "childtheme.php"); $callback = array("_all" => function ($g, $path) use($name) { $param = array("framework" => "WXP", "framework_lc" => "wxp", "themename" => $name, "framework_theme" => "wxp-startertheme", "themename_lc" => strtolower($name), "frameworkfn" => "WP Express"); return parse_template_vars($path, $param); }); generate($themepath, $mkdir, $build, $callback);