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

View File

@ -7,6 +7,6 @@
function mysql_fix_string($pdo, $string)
{
if (get_magic_quotes_gpc()) $string = stripslashes($string);
return $pdo->real_escape_string($string);
return $pdo->quote($string);
}
?>

View File

@ -1,5 +1,6 @@
<form method="post" action="calc.php"><pre>
Loan Amount <input type="text" name="principal">
Monthly Repayment <input type="text" name="monthly">
Number of Years <input type="text" name="years" value="15">
Interest Rate <input type="text" name="interest" value="3">
<input type="submit">

View File

@ -20,7 +20,7 @@
{
document.getElementById("info").innerHTML = this.responseText
}
}
}
</script>
</body>
</html>

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>

View File

@ -3,11 +3,10 @@
{
echo file_get_contents('http://' . SanitizeString($_POST['url']));
}
function SanitizeString($var)
function SanitizeString($var)
{
$var = strip_tags($var);
$var = htmlentities($var);
return stripslashes($var);
}
?>
?>

View File

@ -9,10 +9,9 @@
<script>
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.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
XHR.open("GET", "http://127.0.0.1/18/urlget.php?url=news.com" + nocache, true)
XHR.send()
XHR.onreadystatechange = function()
@ -21,7 +20,7 @@
{
document.getElementById("info").innerHTML = this.responseText
}
}
}
</script>
</body>
</html>
</html>

View File

@ -1,7 +1,6 @@
<?php // xmlget.php
<?php
if (isset($_GET['url']))
{
header('Content-Type: text/xml');
echo file_get_contents("http://".sanitizeString($_GET['url']));
}
@ -11,4 +10,4 @@
$var = htmlentities($var);
return stripslashes($var);
}
?>
?>

View File

@ -1,13 +1,13 @@
<?php // urlget.php
<?php
if (isset($_GET['url']))
{
header('Content-Type: text/xml');
echo file_get_contents("http://".sanitizeString($_GET['url']));
}
function sanitizeString($var)
{
$var = strip_tags($var);
$var = htmlentities($var);
return stripslashes($var);
}
?>
?>

View File

@ -6,13 +6,13 @@
<body>
<h1>Loading XML data into a DIV</h1>
<div id='info'>This sentence will be replaced</div>
<script>
let out = ''
let out = ''
let nocache = "&nocache=" + Math.random() * 1000000
let url = "rss.news.yahoo.com/rss/topstories"
let XHR = new XMLHttpRequest()
let url = "rss.news.yahoo.com/rss/topstories"
let XHR = new XMLHttpRequest()
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.send()
@ -21,15 +21,15 @@
{
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)
{
out += titles[j].childNodes[0].nodeValue + '<br>'
}
document.getElementById('info').innerHTML = out
for (let j = 0 ; j < titles.length ; ++j)
{
out += titles[j].childNodes[0].nodeValue + '<br>'
}
document.getElementById('info').innerHTML = out
}
}
}
</script>
</body>
</html>

View File

@ -4,7 +4,7 @@
<title>RSS Feed</title>
<link>http://website.com</link>
<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>
<title>Headline</title>
<guid>http://website.com/headline</guid>

View File

@ -8,8 +8,6 @@
background:linear-gradient(top, #fb0, #f50);
background:-moz-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>
</head>
<body>