<?php $body_id = "wotd"; include_once "../lib/php/config.php"; include_once HEADER; #include_once("../lib/php/search_engines.php"); $cfg = new ItalyDAO(); ?> <div id="text"> <form id="wotdForm" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <p>Enter your email to receive the <strong>Word of the Day</strong></p> <label><input class="text" type="text" id="email" name="email" /></label> <label><input class="submit" type="submit" name="submit" value="Submit" /></label> </form> <div id="response"> <?php if (isset($_POST['email'])) { $cfg->checkEmail($_POST['email']); } ?> </div> <div id="random"> <?php echo $cfg->getRandomWord(); ?>
<?php $body_id = "links"; include_once "../lib/php/config.php"; include_once HEADER; #include_once("../lib/php/search_engines.php"); $links = new ItalyDAO(); ?> <div id="text"> <?php $arr = array("Museums and Galleries", "International News", "Hotels and Hostels", "Miscellaneous"); //map each array element to the link type in the table; for ($i = 0; $i < count($arr); $i++) { echo "<h4>" . $arr[$i] . "</h4>\n"; foreach ($links->getLinks($i) as $link) { echo $link; } } ?> </div> <?php include_once FOOTER;
<?php $body_id = "verbs"; include_once "../lib/php/config.php"; //include_once("../lib/php/verbs.php"); include_once HEADER; #include_once("../lib/php/search_engines.php"); $cfg = new ItalyDAO($_REQUEST); $regular = ""; $irregular = ""; $reflexive = ""; $simple = ""; $compound = ""; if (isset($_POST['name'])) { $regular = $_POST['regular']; $irregular = $_POST['irregular']; $reflexive = $_POST['reflexive']; $simple = $_POST['simple']; $compound = $_POST['compound']; $cfg->conjugateVerb(); } ?> <div id="text"> <h3>I Verbi</h3> <form id="verbTypesForm" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <p> <strong>Select a verb:</strong>
$phrase_replace = str_replace(" ", "%' AND {$language} LIKE '%", addslashes($phrase)); $sql = sprintf("SELECT italian, pronunciation, grammar, translation FROM words WHERE {$language} LIKE '%%%s%%' ORDER BY italian, grammar", $phrase_replace); $sql2 = sprintf("SELECT COUNT(*) FROM words WHERE {$language} LIKE '%%%s%%' ORDER BY italian, grammar", $phrase_replace); } elseif ($match == "exact") { $sql = sprintf("SELECT italian, pronunciation, grammar, translation FROM words WHERE {$language} = '%s' ORDER BY italian, grammar", addslashes($phrase)); $sql2 = sprintf("SELECT COUNT(*) FROM words WHERE {$language} = '%s' ORDER BY italian, grammar", addslashes($phrase)); } //if there is nothing returned then let the user know and the script will end; $result2 = mysql_query($sql2) or die("The server cannot be reached at this time."); $display2 = mysql_fetch_row($result2) or die("The server cannot be reached at this time."); if ($display2[0] == 0) { echo "<p>There are no records found for <strong style=\"color: #000;\">" . $phrase . "</strong></p>"; #strip slashes since they were added to query the db; #add the missing word into a db table and then send me an email if there are more than 'x' new searched phrases; $arr = array("phrase" => $phrase, "language" => $language, "ip" => $_SERVER['REMOTE_ADDR']); $cfg = new ItalyDAO($arr); $cfg->addWordSearch(); if ($cfg->getCount("word_search") > 9) { $result = mysql_query("SELECT * FROM word_search"); $all_words = array(); while ($display = mysql_fetch_assoc($result)) { $all_words[] = "\nword: " . $display['word'] . "\nlanguage: " . $display['language'] . "\nip: " . $display['ip'] . "\ntimestamp: " . $display['timestamp']; } $cfg->sendEmail((object) array("message" => "Here are the latest searched words:\n\n" . join("\n", $all_words), "subject" => "italy.benjamintoll.com searched words list", "mail_to" => "*****@*****.**", "mail_from" => "*****@*****.**")); } } else { //there are records found so print the results; //$result = mysql_query($sql) or die("The server cannot be reached at this time."); $result = mysql_query($sql); //this function counts the results in the array and displays the result //on the page along with the word searched for;
<?php function __autoload($class) { require_once "/home/benjamin/public_html/italy/lib/php/classes/{$class}.php"; } session_start(); # check for an active session if (!$_SESSION['username']) { header("Location: http://www.benjamintoll.com/admin/"); } if ($_POST['italian']) { if ($_POST['italian'] != '' && $_POST['translation'] != '') { $cfg = new ItalyDAO($_POST); $cfg->addWord(); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Italian</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="../admin.css" /> <script type="text/javascript"> window.onload = function() { document.wordForm.italian.focus(); var inputs = document.getElementsByTagName("input"); for (var i = 0; i < inputs.length; i++) { if (inputs[i].type == "submit") inputs[i].onfocus = function () { if (this.blur) this.blur(); }; if (inputs[i].type == "reset") {
<?php $body_id = "dictionary"; include_once "/home/benjamin/public_html/italy/lib/php/config.php"; include_once HEADER; #include_once("lib/php/search_engines.php"); $dict = new ItalyDAO(); ?> <div id="text"> <form id="dictionaryForm" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <p>There are <b><?php echo htmlentities($dict->getCount("words")); ?> </b> words and expressions in the database.</p> <h4>Enter a word to get its translation:</h4> <label><input type="text" name="phrase" id="phrase" class="text" /></label> <label><input type="radio" name="match" value="like" checked="checked" /> Must Contain Entire Phrase, In Exact Order</label> <label><input type="radio" name="match" value="each_word" /> Must Contain Each Word In Phrase, In Any Order</label> <label><input type="radio" name="match" value="exact" /> Exact Match - Entire Phrase</label> <hr /> <h4>The above text is in:</h4> <label><input type="radio" name="language" value="italian" checked="checked" /> Italian</label> <label><input type="radio" name="language" value="english" /> English</label> <p><label><input class="submit" type="submit" value="Search" /></label> <label><input class="submit" type="reset" id="reset" name="reset" value="Clear" /></label></p> <div id="displayWords"> <?php
<?php function __autoload($class) { require_once "/home/benjamin/public_html/italy/lib/php/classes/{$class}.php"; } $cfg = new ItalyDAO(); switch ($_GET['function']) { case "check_email": $cfg->checkEmail($_GET['email']); break; case "conjugate_verb": $cfg->conjugateVerb($_GET['verb'], $_GET['tense']); break; case "random_word": $cfg->getRandomWord(); break; }