Skip to content

Commit

Permalink
Bot uses the keywords from the user input box.
Browse files Browse the repository at this point in the history
Bot uses the keywords from the user input box above.
Ask for a random key in the input box below.
  • Loading branch information
jehovahsays committed Jun 23, 2024
1 parent 0e2a248 commit be80f7a
Show file tree
Hide file tree
Showing 60 changed files with 615 additions and 921 deletions.
209 changes: 117 additions & 92 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,95 +23,98 @@
if ($answer1 == "Human") { $totalCorrect++; }
echo "<div id='results'>$totalCorrect / 1 correct</div>";
//The halting problem
foreach($_POST as $variable => $value) {
$value = str_replace(' ', '_', $value);
// checking whether file exists or not
$file_pointer = "./en/" . $value . ".html";
if (file_exists($file_pointer))
{
echo "The file $file_pointer already exists <br>";
echo "<meta name='viewport' content='width=device-width'><a href='./en/$value.html'>$value</a>";
exit;
}
$handle = fopen("./en/" . $value . ".html", "a");
fwrite($handle,
"\n"
. "<!DOCTYPE html>"
. "<html lang=\"en\">"
. "<head>"
. "<meta "
. "name=\"viewport\""
. "content=\"width=device-width\">"
. ""
. "<title>"
. $value
. "</title>"
. ""
. "<link "
. "rel=\"stylesheet\" "
. "href=\"./css/merge.css\" />"
. "</link>"
. ""
. "</head>"
. "<body>"
. "<center>"
. "<fieldset>"
. "<legend>"
. "<a"
. "href=\"./$value.html\">"
. $value
. "</a>"
. "</legend>"
. ""
. "<form "
. "class=\"form-group\""
. "action=\"../action.php\""
. "method=\"post\">"
. ""
. "<input "
. "type=\"text\""
. "class=\"form-control\""
. "id=\"secure-form-answer-Human\""
. "type=\"text\""
. "name=\"secure-form-answer\""
. "maxlength=\"40\""
. "autocomplete=\"true\""
. "autocorrect=\"off\""
. "autocapitalize=\"off\""
. "spellcheck=\"true\""
. "placeholder=\"what word defines this word\""
. "required>"
. "<noscript>"
. "<label"
. "for=\"secure-form-answer-Human\">"
. "Human"
. "</label>"
. "</noscript>"
. "</form>"
. "<br>"
. ""
. "<a "
. "href=\"../index.html\">"
. "return to homepage"
. "</a>"
. ""
. "<br><br>"
. "<a href=\"../delete.php?action=delete&filename=./en/$value.html\">"
. "delete this page"
. "</a>"
. ""
. "<br><br>"
. ""
. "<article>"
. "$value definitions go here"
. "</article>"
. ""
. "</fieldset>"
. "</center>"
. "</body>"
. "</html>"
. "\n"
. "\r\n");
foreach($_POST as $variable => $value) {
$value = str_replace(' ', '_', $value);

// checking whether file exists or not
$file_pointer = "./en/" . $value . ".html";
if (file_exists($file_pointer))
{
echo "The file $file_pointer already exists <br>";
echo "<meta name='viewport' content='width=device-width'><a href='./en/$value.html'>$value</a>";
exit();
}

$handle = fopen("./en/" . $value . ".html", "a");
fwrite($handle,
"\n"
. "<!DOCTYPE html>"
. "<html lang=\"en\">"
. "<head>"
. "<meta "
. "name=\"viewport\""
. "content=\"width=device-width\">"
. ""
. "<title>"
. $value
. "</title>"
. ""
. "<link "
. "rel=\"stylesheet\" "
. "href=\"./css/merge.css\" />"
. "</link>"
. ""
. "</head>"
. "<body>"
. "<center>"
. "<fieldset>"
. "<legend>"
. "<a"
. "href=\"./$value.html\">"
. $value
. "</a>"
. "</legend>"
. ""
. "<form "
. "class=\"form-group\""
. "action=\"../action.php\""
. "method=\"post\">"
. ""
. "<input "
. "type=\"text\""
. "class=\"form-control\""
. "id=\"secure-form-answer-Human\""
. "type=\"text\""
. "name=\"secure-form-answer\""
. "maxlength=\"40\""
. "autocomplete=\"true\""
. "autocorrect=\"off\""
. "autocapitalize=\"off\""
. "spellcheck=\"true\""
. "placeholder=\"what word defines this word\""
. "required>"
. "<noscript>"
. "<label"
. "for=\"secure-form-answer-Human\">"
. "Human"
. "</label>"
. "</noscript>"
. "</form>"
. "<br>"
. ""
. "<a "
. "href=\"../index.html\">"
. "return to homepage"
. "</a>"
. ""
. "<br><br>"
. "<a href=\"../delete.php?action=delete&filename=./en/$value.html\">"
. "delete this page"
. "</a>"
. ""
. "<br><br>"
. ""
. "<article>"
. "$value definitions go here"
. "</article>"
. ""
. "</fieldset>"
. "</center>"
. "</body>"
. "</html>"
. "\n"
. "\r\n");

$handle = fopen("./index.html", "a");
fwrite($handle,
"<a href="
Expand All @@ -124,19 +127,23 @@
. "\""
. "edges"
. "\""
. "><button>"
. "><button class="
. "\""
. "core"
. "\""
. ">"
. $value
. "</button>"
. "</a><br>"
. "\r\n");

$handle = fopen("./js/merge.js", "a");
// load the data and delete the line from the array
$lines = file('./js/merge.js');
$last = sizeof($lines) - 1 ;
unset($lines[$last]);
// write the new data to the file
file_put_contents('./js/merge.js', $lines);
foreach($_POST as $variable => $value) {
$value = str_replace(' ', '_', $value);
fwrite($handle,
"\""
Expand All @@ -145,8 +152,26 @@
. ","
. "\n"
. "];var tc = TagCloud('.content', texts);console.log(tc);");

$handle = fopen("./js/chatbot.js", "a");
// load the data and delete the line from the array
$lines = file('./js/chatbot.js');
$last = sizeof($lines) - 1 ;
unset($lines[$last]);
// write the new data to the file
file_put_contents('./js/chatbot.js', $lines);
foreach($_POST as $variable => $value) {
$value = str_replace(' ', '_', $value);
fwrite($handle,
"\""
. $value
. "💡"
. "\""
. ","
. "\n"
. "];return responses[Math.floor(Math.random() * responses.length)];}window.onblur = function (tabs) {alert('switch tabs alert');};");
}
echo "<meta name='viewport' content='width=device-width'>successfully created <a href='./en/$value.html'>$value</a>";
}
}
fclose($handle);
?>
16 changes: 12 additions & 4 deletions css/merge.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@
font-size: 1.0em;

}

.core {
position: fixed;
padding: 0;
margin: 0;
top: 285px;
left: 165px;
font-size: 1.0em;

}
.fieldset {
position: fixed;
margin: 80px;
Expand All @@ -20,7 +28,7 @@
right: 0;
width: 50%;
}
.nodes {
.input-field {
position: fixed;
padding: 0;
margin: 0;
Expand All @@ -31,8 +39,8 @@
.edges {
position: fixed;
padding: 0;
margin: 0;
top: 60px;
margin: 30;
top: 50px;
left: 130px;
font-size: 1.0em;
animation: fadeIn 0.5s ease-in-out;
Expand Down
114 changes: 114 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@

.chatbot-container {
width: 80%;
margin: 0 auto;
background-color: white;
}

#chatbot {
background-color: white;
}

#header {
background-color: white;
color: #ffffff;
padding: 20px;
font-size: 1em;
font-weight: bold;
}

message-container {
background: gray;
width: 100%;
height: 20px;
display: flex;
align-items: center;
}



#conversation {
height: 30px;
overflow-y: auto;
padding: 50px;
display: flex;
flex-direction: column;
}

@keyframes message-fade-in {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* edges */
.nodes {
display: flex;
align-items: flex-start;
position: relative;
font-size: 15px;
line-height: 20px;

word-wrap: break-word;
white-space: pre-wrap;
max-width: 100%;
padding: 15px;
}

.user-message {
justify-content: flex-end;
}


.edges {
font-size: 1.1em;
top: 15px;
}

#input-form {


border: 1px solid black;
margin: 0px;
padding: 0px;
position: fixed;
top: 150px;
left: 75px;

width: 55%;

}

#nodes {
flex: 1;
height: 60px;
border: 1px solid #7f9bbe;
border-radius: 4px;
padding: 0 10px;
font-size: 14px;
transition: border-color 0.3s;
background: white;
color: #000000;
border: none;
}

p[sentTime]:hover::after {
content: attr(sentTime);
position: absolute;
top: -3px;
font-size: 14px;
color: gray;
}

.chatbot p[sentTime]:hover::after {

left: 15px;
}

.user-message p[sentTime]:hover::after {
right: 15px;
}
3 changes: 3 additions & 0 deletions en/Pi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

<!DOCTYPE html><html lang="en"><head><meta name="viewport"content="width=device-width"><title>Pi</title><link rel="stylesheet" href="./css/merge.css" /></link></head><body><center><fieldset><legend><ahref="./Pi.html">Pi</a></legend><form class="form-group"action="../action.php"method="post"><input type="text"class="form-control"id="secure-form-answer-Human"type="text"name="secure-form-answer"maxlength="40"autocomplete="true"autocorrect="off"autocapitalize="off"spellcheck="true"placeholder="what word defines this word"required><noscript><labelfor="secure-form-answer-Human">Human</label></noscript></form><br><a href="../index.html">return to homepage</a><br><br><a href="../delete.php?action=delete&filename=./en/Pi.html">delete this page</a><br><br><article>Pi definitions go here</article></fieldset></center></body></html>

Loading

0 comments on commit be80f7a

Please sign in to comment.