Ok. I am new to PHP and MySQL, and I am having problems. I have a website, edlineplus.x10host.com. What I am trying to do is given an IP address, username, and password...check if the IP is in the database 'auto_login' - if so, edit the associated username and password and, if not, add a new row with the IP and its data. Everything works fine when I access the site from my computer, but when I try to access the site from another computer...it takes a long time to load and even gives me the error: "Fatal error: Maximum execution time of 30 seconds exceeded in line [alternates between lines 4 and 7 in the code below]". I don't understand why this is. For reference, I am using x10hosting.com to host the website and they have a policy "Remote access is not allowed on free hosting account" (what I have). However, wouldn't the 'remote access' in question only apply if I was doing something from a remote server...what I am doing is having the data a user enter on my website sent to a php file that processes it. Also, would the 'remote access' issue prevent me from even connecting to the database from a different computer? There is no connecting to the database itself though. Any help with how to fix would be great....I googled so much for how to solve and I don't know what to do.
$results = mysqli_fetch_assoc(mysqli_query($connection, "SELECT `Identification Number`, `IP Address`, `Username`, `Password` FROM `subscribed_users` ORDER BY `Identification Number`"));
$ip_address_found = false;
while ($results) {
$temp_identification_number = $results['Identification Number'];
$temp_ip_address = $results['IP Address'];
$temp_username = $results['Username'];
$temp_password = $results['Password'];
if ($ip_address == $temp_ip_address) {
$ip_address_found = true;
$protected_username = mysqli_real_escape_string($username);
$protected_password = mysqli_real_escape_string($password);
mysqli_query($connection, "UPDATE `subscribed_users` SET `Username` = '$protected_username', `Password` = '$protected_password' WHERE `subscribed_users`.`Identification Number` = $temp_identification_number;");
break;
}
}
if (!$ip_address_found) {
$protected_username = mysqli_real_escape_string($username);
$protected_password = mysqli_real_escape_string($password);
mysqli_query($connection, "INSERT INTO `subscribed_users` (`Identification Number`, `IP Address`, `Username`, `Password`) VALUES (NULL, '$ip_address', '$protected_username', '$protected_password');");
}
mysqli_close($connection);