syntax error, unexpected 'else' (T_ELSE) in line 3

I need help with this please, my attempt was to make a security code for submit button but i got an error.
[php]<?
if($_POST[‘Submit’]){
$open = fopen(“updates.txt”,“w+”);
$text = $_POST[‘update’];
if ($_POST[“Security”] == “BBC123”) {
fwrite($open, $text);
fclose($open);
echo “File updated.
”;
echo “File:
”;
$file = file(“updates.txt”);
foreach($file as $text) {
echo $text."
";
} else {
echo “Ops sumsing wen rong, you aint my boss”;
}
}
echo “

<a href=”./md5-updates.php">click here to view the live updated webpage

";
echo “

<a href=”./modify.php">click here to reload modify.php

";
}else{
$file = file(“updates.txt”);
echo"<form action="".$PHP_SELF."" method=“post”>";
echo"<input type=“text” name=“Security”>"; "; echo ""; echo ""; foreach($file as $text) { echo $text; } echo ""; echo "\n "; } ?>[/php] Thanks in advance

Indent your code and you should find the issue.

Cant do right now as im using mobile.

;D got it working now lock pls

Why in the world are you echoing html? PHP_SELF is vulnerable to SQL Injection. Depending on the name of a button to be submitted will completely fail in certain circumstances. You need to use
if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’)

I see you have md5 in a filename. Hopefully you are not using md5. It was cracked like 20 years ago.

Sponsor our Newsletter | Privacy Policy | Terms of Service