Tell me, there is such a condition
if (isset($_GET['id'])) { $id = $_GET['id']; } else { exit("1 !"); } if (!preg_match("|^[\d]+$|", $id)) { exit("<p>bad URL</p>"); }
It works with the url of the profile? Id = 1, but does not work with the url of the id1 type, although there is a census in .htaccess, tell me what needs to be corrected so that the expression becomes correct for such an url of the id1 type.
Full script
<?php session_start(); include("bd.php"); if (isset($_GET['id'])) { $id = $_GET['id']; } else { exit("1 !"); } if (!preg_match("|^[\d]+$|", $id)) { exit("<p>bad url</p>"); } if (!empty($_SESSION['email']) and !empty($_SESSION['password'])) { $email = $_SESSION['email']; $password = $_SESSION['password']; $result2 = mysql_query("SELECT id FROM users WHERE email='$email' AND password='$password'", $db); $myrow2 = mysql_fetch_array($result2); if (empty($myrow2['id'])) { exit("bad id!"); } } else { exit("3!"); } $result = mysql_query("SELECT * FROM users WHERE id='$id'", $db); $myrow = mysql_fetch_array($result); if (empty($myrow['email'])) { exit("5"); } ?>