Errata amendments

This commit is contained in:
RobinNixon
2021-11-16 12:23:58 +00:00
parent eeb4267820
commit fc6b9f4df3
11 changed files with 27 additions and 59 deletions
+1 -1
View File
@@ -7,6 +7,6 @@
function mysql_fix_string($pdo, $string) function mysql_fix_string($pdo, $string)
{ {
if (get_magic_quotes_gpc()) $string = stripslashes($string); if (get_magic_quotes_gpc()) $string = stripslashes($string);
return $pdo->real_escape_string($string); return $pdo->quote($string);
} }
?> ?>
+1
View File
@@ -1,5 +1,6 @@
<form method="post" action="calc.php"><pre> <form method="post" action="calc.php"><pre>
Loan Amount <input type="text" name="principal"> Loan Amount <input type="text" name="principal">
Monthly Repayment <input type="text" name="monthly">
Number of Years <input type="text" name="years" value="15"> Number of Years <input type="text" name="years" value="15">
Interest Rate <input type="text" name="interest" value="3"> Interest Rate <input type="text" name="interest" value="3">
<input type="submit"> <input type="submit">
+1 -1
View File
@@ -20,7 +20,7 @@
{ {
document.getElementById("info").innerHTML = this.responseText document.getElementById("info").innerHTML = this.responseText
} }
} }
</script> </script>
</body> </body>
</html> </html>
-28
View File
@@ -1,28 +0,0 @@
<script>
function asyncRequest()
{
try // Non IE Browser?
{ // Yes
var request = new XMLHttpRequest()
}
catch(e1)
{
try // IE 6+?
{ // Yes
request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch(e2)
{
try // IE 5?
{ // Yes
request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch(e3) // There is no asynchronous support
{
request = false
}
}
}
return request
}
</script>
+2 -3
View File
@@ -3,11 +3,10 @@
{ {
echo file_get_contents('http://' . SanitizeString($_POST['url'])); echo file_get_contents('http://' . SanitizeString($_POST['url']));
} }
function SanitizeString($var)
function SanitizeString($var)
{ {
$var = strip_tags($var); $var = strip_tags($var);
$var = htmlentities($var); $var = htmlentities($var);
return stripslashes($var); return stripslashes($var);
} }
?> ?>
+4 -5
View File
@@ -9,10 +9,9 @@
<script> <script>
let nocache = "&nocache=" + Math.random() * 1000000 let nocache = "&nocache=" + Math.random() * 1000000
let XHR = new XMLHttpRequest() let XHR = new XMLHttpRequest()
XHR.open("POST", "http://127.0.0.1/18/urlget.php?url=news.com" + nocache, true) XHR.open("GET", "http://127.0.0.1/18/urlget.php?url=news.com" + nocache, true)
XHR.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
XHR.send() XHR.send()
XHR.onreadystatechange = function() XHR.onreadystatechange = function()
@@ -21,7 +20,7 @@
{ {
document.getElementById("info").innerHTML = this.responseText document.getElementById("info").innerHTML = this.responseText
} }
} }
</script> </script>
</body> </body>
</html> </html>
+2 -3
View File
@@ -1,7 +1,6 @@
<?php // xmlget.php <?php
if (isset($_GET['url'])) if (isset($_GET['url']))
{ {
header('Content-Type: text/xml');
echo file_get_contents("http://".sanitizeString($_GET['url'])); echo file_get_contents("http://".sanitizeString($_GET['url']));
} }
@@ -11,4 +10,4 @@
$var = htmlentities($var); $var = htmlentities($var);
return stripslashes($var); return stripslashes($var);
} }
?> ?>
+3 -3
View File
@@ -1,13 +1,13 @@
<?php // urlget.php <?php
if (isset($_GET['url'])) if (isset($_GET['url']))
{ {
header('Content-Type: text/xml');
echo file_get_contents("http://".sanitizeString($_GET['url'])); echo file_get_contents("http://".sanitizeString($_GET['url']));
} }
function sanitizeString($var) function sanitizeString($var)
{ {
$var = strip_tags($var); $var = strip_tags($var);
$var = htmlentities($var); $var = htmlentities($var);
return stripslashes($var); return stripslashes($var);
} }
?> ?>
+12 -12
View File
@@ -6,13 +6,13 @@
<body> <body>
<h1>Loading XML data into a DIV</h1> <h1>Loading XML data into a DIV</h1>
<div id='info'>This sentence will be replaced</div> <div id='info'>This sentence will be replaced</div>
<script> <script>
let out = '' let out = ''
let nocache = "&nocache=" + Math.random() * 1000000 let nocache = "&nocache=" + Math.random() * 1000000
let url = "rss.news.yahoo.com/rss/topstories" let url = "rss.news.yahoo.com/rss/topstories"
let XHR = new XMLHttpRequest() let XHR = new XMLHttpRequest()
XHR.open("POST", "http://127.0.0.1/18/xmlget.php?url=" + url + nocache, true) XHR.open("POST", "http://127.0.0.1/18/xmlget.php?url=" + url + nocache, true)
XHR.setRequestHeader("Content-type", "application/x-www-form-urlencoded") XHR.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
XHR.send() XHR.send()
@@ -21,15 +21,15 @@
{ {
if (this.readyState == 4 && this.status == 200) if (this.readyState == 4 && this.status == 200)
{ {
let titles = this.responseXML.getElementsByTagName('title') let titles = this.responseXML.getElementsByTagName('title')
for (let j = 0 ; j < titles.length ; ++j) for (let j = 0 ; j < titles.length ; ++j)
{ {
out += titles[j].childNodes[0].nodeValue + '<br>' out += titles[j].childNodes[0].nodeValue + '<br>'
} }
document.getElementById('info').innerHTML = out document.getElementById('info').innerHTML = out
} }
} }
</script> </script>
</body> </body>
</html> </html>
+1 -1
View File
@@ -4,7 +4,7 @@
<title>RSS Feed</title> <title>RSS Feed</title>
<link>http://website.com</link> <link>http://website.com</link>
<description>website.com's RSS Feed</description> <description>website.com's RSS Feed</description>
<pubDate>Mon, 11 May 2020 00:00:00 GMT</pubDate> <pubDate>Mon, 10 May 2027 00:00:00 GMT</pubDate>
<item> <item>
<title>Headline</title> <title>Headline</title>
<guid>http://website.com/headline</guid> <guid>http://website.com/headline</guid>
-2
View File
@@ -8,8 +8,6 @@
background:linear-gradient(top, #fb0, #f50); background:linear-gradient(top, #fb0, #f50);
background:-moz-linear-gradient(top, #fb0, #f50); background:-moz-linear-gradient(top, #fb0, #f50);
background:-webkit-linear-gradient(top, #fb0, #f50); background:-webkit-linear-gradient(top, #fb0, #f50);
background:-o-linear-gradient(top, #fb0, #f50);
background:-ms-linear-gradient(top, #fb0, #f50); }
</style> </style>
</head> </head>
<body> <body>