Repository navigation
Expand file tree
/
Copy pathindex.php
More file actions
72 lines (52 loc) · 2 KB
/
Copy pathindex.php
File metadata and controls
72 lines (52 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
session_start();
$mysql_connect = mysqli_connect("localhost", "id16543739_cdbat", "Cypress@12345", "id16543739_cypress");
// check if database connected properly
if(!$mysql_connect){
die(mysqli_connect_error());
}
// else{
// print("connected");
// }
?>
<!DOCTYPE html>
<html lang="en">
<?php
include 'header.php';
?>
<head>
<meta charset="UTF-8">
<title>CPS406 Cypress</title>
<link rel="stylesheet" href="stylesheets/index.css"/>
</head>
<body class="text-center">
<main id="front_page">
<div id="page-wrap">
<img src="/images/city-of-toronto-logo.jpg" class="img-fluid" alt="City of Toronto Logo"/>
</div>
<div>
<form id="language_form" name="language_form" method='POST' action="https://cypress-cdbat.000webhostapp.com/index.php">
<input type='text' value='' id='language' name='language' style='display:none'>
<button type='submit' id='set_language' name='set_language' class='btn btn-lg btn-primary mx-5' onclick="setLanguage('English')">English</button>
<button type='submit' id='set_language' name='set_language' class='btn btn-lg btn-primary mx-5' onclick="setLanguage('French')">Français</button>
</form>
</div>
</main>
</body>
<script src="scripts/index.js"></script>
<?php
if (isset($_POST['set_language'])) {
unset($_POST['set_language']);
$_SESSION['language_setting'] = $_POST['language'];
$changed = checkLanguageAlert("Changed language to: ", "Changement de langue en: ");
$message = $changed . $_SESSION['language_setting'];
echo "<script type='text/javascript'>alert('$message');</script>";
echo "<script type='text/javascript'>window.location.replace(\"https://cypress-cdbat.000webhostapp.com/index.php\");;</script>";
}
?>
<script>
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
</script>
</html>