function process($user, $msg) { $msg = unwrap($msg); // remove chr(0) and chr(255) say("< " . $msg); $parts = explode("|", $msg); // CHAT|NICK|MESSAGE $action = strtoupper($parts[0]); switch ($action) { case "HELO": welcome($user, $parts[1], $parts[2]); break; // HELO|NICK|AVATAR // HELO|NICK|AVATAR case "CHAT": chat($user, $parts[2]); break; // CHAT|NICK|MESSAGE // CHAT|NICK|MESSAGE case "PRIV": break; // TODO: private chat // TODO: private chat case "EXIT": goodbye($user); break; // EXIT|NICK // EXIT|NICK default: console($action . " not understood"); break; } }
/** * Index Page for this controller. * * Maps to the following URL * http://example.com/index.php/welcome * - or - * http://example.com/index.php/welcome/index * - or - * Since this controller is set as the default controller in * config/routes.php, it's displayed at http://example.com/ * * So any other public methods not prefixed with an underscore will * map to /index.php/welcome/<method_name> * @see https://codeigniter.com/user_guide/general/urls.html */ public function index() { $this->config->load('welcome'); $this->load->helper('welcome'); $this->load->library('welcomelib'); $this->load->model('welcome_model'); $string = $this->config->item('helo'); echo $string; $string = welcome($string); echo "->" . $string; $string = $this->welcomelib->test($string); echo "->" . $string; $string = $this->welcome_model->test($string); echo "->" . $string; $this->load->view('welcome_message'); }
* Known Issues: * * Parameters are not yet supported. To add parameters see the note * in the code */ require '../tmhOAuth.php'; require '../tmhUtilities.php'; function welcome() { echo <<<EOM tmhOAuth PHP Signature Generator. This script generates an OAuth signature from adhoc values. No requests are made to the Twitter API. EOM; } welcome(); $consumer_key = tmhUtilities::read_input(PHP_EOL . 'Consumer Key' . PHP_EOL); $consumer_secret = tmhUtilities::read_input(PHP_EOL . 'Consumer Secret' . PHP_EOL); $user_token = tmhUtilities::read_input(PHP_EOL . 'User Token' . PHP_EOL . '(this can be left blank for checking request_token calls)'); $user_secret = tmhUtilities::read_input(PHP_EOL . 'User Secret' . PHP_EOL . '(this can be left blank for checking request_token calls)'); $timestamp = tmhUtilities::read_input(PHP_EOL . 'Timestamp' . PHP_EOL . '(leave blank to have this autogenerated)' . PHP_EOL); $nonce = tmhUtilities::read_input(PHP_EOL . 'Nonce' . PHP_EOL . '(leave blank to have this autogenerated)' . PHP_EOL); $url = tmhUtilities::read_input(PHP_EOL . 'URL' . PHP_EOL . '(e.g. https://api.twitter.com/1/account/verify_credentials.json)' . PHP_EOL); $action = tmhUtilities::read_input(PHP_EOL . 'HTTP Action' . PHP_EOL . '(leave blank for GET)' . PHP_EOL); $tmhOAuth = new tmhOAuth(array('consumer_key' => $consumer_key, 'consumer_secret' => $consumer_secret, 'user_token' => $user_token, 'user_secret' => $user_secret, 'prevent_request' => true)); if (strlen($nonce) > 0) { $tmhOAuth->config['force_nonce'] = true; $tmhOAuth->config['nonce'] = $nonce; } if (strlen($timestamp) > 0) { $tmhOAuth->config['force_timestamp'] = true;
require_once __DIR__ . '/classes/connexion.php'; require_once __DIR__ . '/classes/checkAPI.php'; require_once __DIR__ . '/classes/Player.php'; require_once __DIR__ . '/classes/Settings.php'; $page_level = 0; if (isset($_GET['api']) && checkAPI($_GET['api'], $page_level)) { $welcome_interval = (new Settings())->getSettings('Audio', 'welcome'); $bdd = getBDD(); $req = $bdd->prepare('SELECT * FROM at_welcome WHERE mac = :mac'); $req->execute(array('mac' => $_GET['api'])); $data = $req->fetch(); if ($data) { $diff = strtotime(now) - strtotime($data['jour'] . " " . $data['heure']); $diff /= 3600; if ($diff > $welcome_interval) { welcome($_GET['api']); } } $req->closeCursor(); } else { echo 401; } function welcome($api) { $bdd = getBDD(); $req = $bdd->prepare('UPDATE at_welcome SET jour = now(), heure = now() WHERE mac = :mac'); $req->execute(array('mac' => $api)); $req->closeCursor(); $player = new Player(); $req = $bdd->prepare('SELECT at_music.file FROM at_music JOIN at_welcome ON at_music.id = at_welcome.music WHERE at_welcome.mac = mac'); $req->execute(array('mac' => $mac));
/** * Show the application dashboard. * * @return Response */ public function index() { return welcome(); }
chat($_GET['c']); } else { welcome('chat name too large'); } } else { welcome('letters and numbers only'); } } else { if (isset($_POST['logout']) && preg_match('/^\\w+$/', $_POST['logout'])) { $_POST['logout'] = strtolower($_POST['logout']); session_name('s' . $_POST['logout']); session_start(); $chat = file($data . $_POST['logout']); if ($_SESSION['nick'] && $_SESSION['check'] == "OK") { preg_match('/' . $_SESSION['nick'] . '\\:[^\\|]+\\|/', $chat[0], $public); $chat[0] = str_replace($public[0], '', $chat[0]); $chat[count($chat) + 1] = "< " . $_SESSION['nick'] . " has left\n"; session_unset(); session_destroy(); if (file_exists($data . $_POST['logout'])) { file_put_contents($data . $_POST['logout'], implode('', $chat), LOCK_EX); } } welcome('name your chat'); } else { welcome('name your chat'); } } ?> </body> </html>
} $person->updPersonalInfo($param); } function papers($code) { global $smarty, $db; $query = 'select code_paper from authoring where code_author = ' . $db->quote($code); $result =& $db->queryAll($query); foreach ($result as $val) { $paper = new Lesen_paper($val['code_paper']); } $smarty->assign('body', $smarty->fetch('AdmMyPapers.tpl')); } if (isset($_GET['option'])) { switch ($_GET['option']) { case 'myinfo': personalInfo(1); break; case 'mypapers': papers(1); break; case 'newpaper': addPaper(1); break; default: break; } } else { welcome('1'); } $smarty->display('page.tpl');
} //---output---// if (isset($p)) { //---sharewaves---// if (strpos($p, "share-waves.com") !== FALSE) { header("Location: https://google.com/search?q=recursion"); } elseif (strpos($p, "chrome://") !== FALSE) { header("Location: https://google.com/search?q=recursion"); } elseif ($p == "upupdowndownleftrightleftrightba") { include "secretcode.php"; $embedcode = secretcode($p); } elseif ($pagetype == "special") { //---welcome---// if ($p == "welcome") { include "welcome.php"; $embedcode = welcome($wavephoto, $myid); } elseif ($p == "about") { include "about.php"; $embedcode = about($wavephoto, $wavephoto2); } elseif ($p == "learnmore") { include "learnmore.php"; $embedcode = learnmore($wavephoto); } elseif ($p == "signup") { header("Location: signup.php"); } elseif ($p == "signin") { header("Location: signin.php"); } elseif ($p == "forgotpassword") { include "forgotpassword.php"; $embedcode = forgotpassword($wavephoto); } elseif ($p == "statistics") { include "statistics.php";
function loginProcess() { $username = $_REQUEST['username']; $password = $_REQUEST['password']; $authenticated = checkPassword($username, $password); if (!$authenticated) { session_unset(); loginFailed(_kt('Could not authenticate administrative user')); return; } $_SESSION['setup_user'] = $username; welcome(); }
exit; } if (isset($_GET["archives"])) { archive(); exit; } if (isset($_GET["delete_moderator"])) { moderators_del(); exit; } if (isset($_GET["delete_moderator2"])) { moderators_del2(); exit; } if (isset($_GET["welcome"])) { echo welcome(); exit; } if (isset($_GET["goodbye"])) { echo goodby(); exit; } if (isset($_GET["send_welcome_msg"])) { welcome_save(); exit; } if (isset($_GET["send_goodbye_msg"])) { goodbye_save(); exit; } if (isset($_GET["notifications"])) {
<?php function welcome($name, $age) { echo 'Welcome to the website ' . $name . ' you are ' . $age . ' years old!'; } function add($num1, $num2) { echo $num1 + $num2; } function sub($num1, $num2) { return $num1 - $num2; } welcome('Hans', 36); echo '<br>'; add(3, 4); echo '<br>'; echo sub(23, 4); // need echo because you want the 'return' to be on screen
<?php //Practice 2: Function Decleration function welcome($name, $age) { print 'welcome to the site' . $name . '. You are' . $age . 'years old'; } echo welcome(' Chris', '18'); print "\n"; //Practice 2: Function Decleration function add($num1, $num2) { print +$num1 + $num2; print "\n"; } echo add(2, 3); //Practice 3 function substract($num1, $num2) { $total = $num1 - $num2; return $total; } print substract(5, 3); //Practicing If Statements $name = 'Top'; if ($name == 'Chris') { echo 'Hello Chris'; } elseif ($name = 'Tom') { echo 'Welcome Tom'; } else { echo 'You are not Chris';
<?php include 'mailer.php'; welcome($_POST['email']); ini_set("allow_url_fopen", true); ini_set('display_errors', true); error_reporting(E_ALL); $theFile = fopen('storage.txt', 'w') or die('great big horror'); foreach ($_POST as $item) { fwrite($theFile, "\n{$item}") or die('great big horror, but this time i was writing'); } fclose($theFile) or die('closing'); echo 'writing all done'; // header('Location: ' . 'http://people.emich.edu/egurnee/teach/231/fa15/10oct29/form.html');