i am trying to display a .php file on my browser but it doesnt work
i think the problem must be on the hard disk or something
i ve used Xampp 2 years ago, did a project i had and it run smoothly
3 months ago i "updated" my pc and added a new hard disk, so now my xampp folder is in the "secondary" - old disk
so i try to rerun my old project, plus my new, and they both stuck in the .php displayment
also i m not sure if xampp updates need to be done, i still run 1.7.7
my localhost page runs good, also the "php test scripts" in the left side
here' s the code i want to display
<?php
$connect = mysql_connect("localhost","root",""); if (!$connect) { die("MySQL could not connect!"); }
$DB = mysql_select_db('test');
if(!$DB) { die("MySQL could not select Database!"); }
$Name = $_POST['username']; $Pass = $_POST['password']; $Query = mysql_query("SELECT * FROM users WHERE username='$Name' AND password='$Pass'"); $NumRows = mysql_num_rows($Query); $_SESSION['username'] = $Name; $_SESSION['password'] = $Pass;
if(empty($_SESSION['username']) || empty($_SESSION['password'])) { die("Go back and login before you visit this page!"); }
if($Name && $Pass == "") { die("Please enter your Username and Password!"); }
if($Name == "") { die("Please enter your Username!" . "</br>"); }
if($Pass == "") { die("Please enter your Password!" . "</br>"); }
if($NumRows != 0) { while($Row = mysql_fetch_assoc($Query)) { $Database_Name = $Row['username']; $Database_Pass = $Row['password']; } } else { die("Incorrect Username or Password!"); }
if($Name == $Database_Name && $Pass == $Database_Pass) { header("Location: redirectRegister.html"); }
?>
also the the code of my html file which refers to my .php file
<form action="users.php" method="POST" />
Username: <input type="text" name="username" /></br>
Password: <input type="password" name="password" /></br></br>
<input type="submit" value="OK" />
</form>
and here's what i get from all 3 browsers :
"); } if($Pass == "") { die("Please enter your Password!" . " "); } if($NumRows != 0) { while($Row = mysql_fetch_assoc($Query)) { $Database_Name = $Row['username']; $Database_Pass = $Row['password']; } } else { die("Incorrect Username or Password!"); } if($Name == $Database_Name && $Pass == $Database_Pass) { header("Location: redirectRegister.html"); } ?>
something wrong with the installation i suppose, do i need to reinstall the whole xampp program in my new disk?
will i need to recreate all my databases again?
thank you <3
-edit-
still cant fix it
i reinstalled xampp in my main disk and also reinstalled php according to a guide
it said i should copy/paste a php-recommend.ini file to the windows folder and rename it to php.ini
i didnt have any such file, i got 2 files with the names php-production and php-development, which were the same
dunno what else to do really
-edit2-
i managed to run it at last here's the problem :
*when i run it through the folder, my .php cant be read (file:///C:/xampp/htdocs/main.html)
*when i run it through localhost path, my .php runs (http://localhost/main.html)
any idea why is this happening?