Hello, there is a secret page that can only be accessed via the login page by entering a password there. It’s necessary that the password be taken not from the page itself, but from the database.
<?php $connection = mysql_connect("localhost", "root", ""); $db = mysql_select_db("mydb"); mysql_query("SET NAMES 'cp1251'"); if(!$connection || !$db) { exit(mysql_error()); } $result1 = mysql_query("SELECT `password` FROM `pass` WHERE `id` = '30'"); mysql_close(); $p = $result1['password']; if($_GET['key'] !=md5('$p')) { header('location:login.php'); } ?>
On the line of the $p
variable, echo
gives an error, help plz how to properly arrange.
The error itself:
Parse error: in Z: \ home \ Cascade \ www \ enter \ 30.php on line 13
Thanks in advance for your answers.
'$p'
is exactly the string $ p. In the above code, there is noecho
at all, so there can be no such error in this text. And it’s strange to take md5 from the database value, it would be more logical to keep md5 from the password in the database and not an open password - Mikeecho
construction ... So what exactly is in the 13th line? - Dmitriy Simushev