Resources

 

Page 174

 

CREATE TABLE words (

    word_num INT AUTO_INCREMENT PRIMARY KEY,

    english_word VARCHAR(50) NOT NULL,

    part_of_speech VARCHAR(20) NOT NULL,

    ikiribati_word VARCHAR(50) NOT NULL

);

Page 175

INSERT INTO words (english_word,part_of_speech,ikiribati_word) values ("hello","interj","mauri");

INSERT INTO words (english_word,part_of_speech,ikiribati_word) values ("goodbye","interj","tiabo");

INSERT INTO words (english_word,part_of_speech,ikiribati_word) values ("octopus","n","te kika");

INSERT INTO words (english_word,part_of_speech,ikiribati_word) values ("airplane","n","te wanikiaba");

INSERT INTO words (english_word,part_of_speech,ikiribati_word) values ("run","v","biri");

INSERT INTO words (english_word,part_of_speech,ikiribati_word) values ("go","v","nako");

 

Page 177

CREATE USER 'webuser'@'localhost' IDENTIFIED BY 'bookworm';

 

GRANT SELECT ON kiribati.words TO 'webuser'@'localhost';

 

Page 178

<!doctype html>

<html lang="en">

<head>

<title>I-Kiribati Dictionary</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>

<meta http-equiv="Pragma" content="no-cache"/>

<meta http-equiv="Expires" content="0"/>

<style>

</style>

<body>

<center>

<h1>I-Kiribati Dictionary</h1>

<hr>

<p>

<img src=kiribatiflag.png width=300>

<p>

<form action=translate.php method=post>

Write the English word you want translated to I-Kiribati:<p>

<input type=text size=30 name=english required>

<p>

<input type=submit>

</form>

</center>

</body>

</html>

 

Page 180

header('X-Content-Type-Options: nosniff');

header('X-Frame-Options: DENY');

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $english=trim($_POST['english']);

    //check for hackers

    if ($english === '' || strlen($english) > 50 || !preg_match('/^[A-Za-z0-9 \-_,\.]+$/u', $english)) {

        exit('Invalid entry.');

    }

    $server = "localhost";

    $dbusername = "webuser";

    $dbpassword = "bookworm";

    $database="kiribati";

    $con=mysqli_connect($server,$dbusername,$dbpassword,$database);

    $sql = "SELECT * FROM words WHERE english_word='".$english."'";

    $result=mysqli_query($con,$sql);

    if (mysqli_num_rows($result) > 0) {

       $rs = mysqli_fetch_assoc($result);

       $part_of_speech=$rs['part_of_speech'];

       $ikiribati_word=$rs['ikiribati_word'];

       ?>

       <!doctype html>

       <html lang="en">

       <head>

       <title>Translator</title>

       <meta name="viewport" content="width=device-width, initial-scale=1.0">

       </head>

       <body>

       <center>

       <?php

       echo "The I-Kiribati translation for ".$english." is <b>".$ikiribati_word."</b>.";

       echo "<p>";

       echo "Click <a href=index.html>here</a> to return.";

    }

}

?>

 

Page 184

<!doctype html>

<html lang="en">

<head>

<title>I-Kiribati Dictionary</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>

<meta http-equiv="Pragma" content="no-cache"/>

<meta http-equiv="Expires" content="0"/>

<style>

</style>

<body>

<center>

<h1>I-Kiribati Dictionary</h1>

<hr>

<p>

<img src=kiribatiflag.png width=300>

<p>

<form action=translate.php method=post>

Write the English word you want translated to I-Kiribati:<p>

<input type=text size=30 name=english required>

<p>

<input type=submit>

</form>

<script type="text/javascript"> //<![CDATA[

  var tlJsHost = ((window.location.protocol == "https:") ? "https://secure.trust-provider.com/" : "http://www.trustlogo.com/");

  document.write(unescape("%3Cscript src='" + tlJsHost + "trustlogo/javascript/trustlogo.js' type='text/javascript'%3E%3C/script%3E"));

//]]></script>

<script language="JavaScript" type="text/javascript">

  TrustLogo("https://www.positivessl.com/images/seals/positivessl_trust_seal_sm_124x32.png", "POSDV", "none");

</script>

</center>

</body>

</html>

Page 188

echo "liberty" mysqldump -u root -p kiribati > /media/john/C228-B154/kiribati_backup.sql

 

Page 190

30 2 1-31 1-12 1-7 echo "liberty" mysqldump -u root -p kiribati > /media/john/C228-B154/kiribati_backup.sql

 

30 2 1-31 1-12 1-7 echo "liberty" mysqldump -u root -p kiribati  > /media/john/C228-B154/kiribati_backup_$(date +\%F).sql

 

30 2 1-31 1-12 1-7 echo "liberty" mysqldump -u root -p kiribati  > /media/john/C228-B154/kiribati_backup_$(date +\%F).sql && cp /media/john/C228-B154/kiribati_backup_$(date +\%F).sql /home/john