Code: Select all
<html>
<head>
<title>Price List Editing</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>Please enter password to unlock:</p>
<form name="password" method="post" action="price_editor.php">
<input type="text" name="password">
<input name="submit" type="button" value="Submit">
</form>
<p> </p>
</body>
</html>Code: Select all
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$password = $_POST['password'];
if ($password == "easy")
{
$filename = "mt102.txt";
$file = fopen($filename, "a+");
fseek($filename, 0);
$filesize = filesize($filename);
$text = fread($file, $filesize);
$fclose = ($file);
$count = 0;
$tracker = 0;
$arr = array();
$arrcounter = 0;
while ($count + 1 != $filesize)
{
$temp = substr($text, $count, $count + 1);
if $temp = "|" then
{
$arr[$arrcounter] = substr($text, $tracker, $count + 1);
$tracker = $count;
$arrcounter = $arrcounter + 1;
}
}
echo("Price for item 1 (current price is $arr[1])
<br>Price for item 2 (current price is $arr[2])
<br>Price for item 3 (current price is $arr[3])
<br>Price for item 4 (current price is $arr[4])
");
echo("testing");
}
else
{ echo("You are not authorized to view this page") ; }
?>
</body>
</html>