Multiple websites problem

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Multiple websites problem

Postby idksalem » 21. August 2023 22:37

So i had my 1 domain before with a site up at a subdomain in vhost i had \public at the end so it would work. i recentyl bought a second domain and set it up when i changed the vhost how ever the site would show a 404 (like it did without \public) even though \public is still there if i switch it back to my 1st domain it works. any thought why?
idksalem
 
Posts: 1
Joined: 21. August 2023 22:34
XAMPP version: 3.3.0
Operating System: windows 10

Re: Multiple websites problem

Postby Nobbie » 22. August 2023 08:52

Error 404 means, that the file or folder mentioned by the URL cannot be found or not read.

Thats all we can say without any more information. You probably misconfigured Apache (i.e. your VirtualHost).
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04

Re: Multiple websites problem

Postby nyabutijj » 25. August 2023 01:54

When am submitting a sign up a from which have created, it brings error message "Forbidden: You don't have permission to access this resource.
Apache/2.4.56 (Win64) OpenSSL/1.1.1t PHP/8.2.4 Server at localhost Port 443"
On the browser it shows "https://localhost/doctorpatientsystem/includes/..../signup.php?error=emptyinputy" please assist me
nyabutijj
 
Posts: 2
Joined: 25. August 2023 01:43
XAMPP version: 8.2.4
Operating System: windows 11

Re: Multiple websites problem

Postby Nobbie » 25. August 2023 11:32

Where is the folder "doctorpatientsystem" located on your PC?
What did you enter into the browser?
How did you install that system?
Did you install a valid certificate for "localhost"?
What do you mean by "sign up"? What did you create?
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04

Re: Multiple websites problem

Postby nyabutijj » 25. August 2023 19:54

Where is the folder "doctorpatientsystem" located on your PC? is located in C:\xampp\htdocs\doctorpatientsystem
What did you enter into the browser? i created a login form, want capture the user's information. I will show you after the questions bellow.
How did you install that system? i installed xampp in my windows 11 OS and the icon is green. When i started installing xampp it gave me the warning to deactivate UAC with msconfig and i did it. But is my first time to link my php project with mysql database.
<?php
include_once 'header.php';




?>
<section class="signup-form">


<style type="text/css">
#text{

height: 25px;
border-radius: 5px;
padding: 4px;
border: solid thin #aaa;
width: 100%;
}

#button{

padding: 10px;
width: 100px;
color: white;
background-color: Lightblue;
border: none;
}

#box{

background-color: grey;
margin: auto;
width: 300px;
padding: 20px;
}


</style>

<div id="box">

<form action="includes/signup.inc.php" method="post">
<div style="font-size: 20px;margin: 10px;color: white"><h2>signup</h2></div>

<input id="text" type="text" name="first_name" placeholder="First name..."><br><br>
<input id="text" type="text" name="sir_name" placeholder="Sir name..."><br><br>
<input id="text" type="text" name="email" placeholder="Email.... "><br><br>
<input id="text" type="text" name="Uid" placeholder="Username..."><br><br>
<input id="text" type="password" name="pwd"placeholder="password..."><br><br>
<input id="text" type="password" name="pwdrepeat"placeholder="Repeat password..."><br><br>
Gender:
<input type="radio" name="gender"value="female">Female
<input type="radio" name="gender"value="male">Male<br><br>
Birthday:
<input type="date" name="bday"><br><br>
Age:
<input id="text" type="number" name="num"placeholder="Enter your age..."><br><br>
Mobile Number:
<input id="text" type="text" name="mobileno"placeholder="Enter phone number..."><br><br>
National id:
<input id="text" type="text" name="idnumber"placeholder="Enter you National id..."><br><br>
<button type="submit" name="submit">Sign Up</button><br><br>
</form>
</div>

</section>

<?php
include_once 'footer.php';

?>

<?php
include_once 'header.php';





?>
<section class="Login-form">


<style type="text/css">
#text{

height: 25px;
border-radius: 5px;
padding: 4px;
border: solid thin #aaa;
width: 100%;
}

#button{

padding: 10px;
width: 100px;
color: white;
background-color: Lightblue;
border: none;
}

#box{

background-color: grey;
margin: auto;
width: 300px;
padding: 20px;
}


</style>

<div id="box">

<form action="includes/login.inc.php" method="post">
<div style="font-size: 20px;margin: 10px;color: white"> Login </div>
<input id="text" type="text" name="name" placeholder="Username/Email..."><br><br>
<input id="text" type="password" name="pwd"placeholder="password..."><br><br>
<input id="button" type="submit" value="Log In"><br><br>


</form>

</div>

</section>
<?php
include_once 'footer.php';


?>

signup.inc.php

<?php


if (isset($_POST["submit"])){

$firstname = $_POST["first_name"];
$sirname = $_POST["sir_name"];
$email = $_POST["email"];
$username = $_POST["Uid"];
$pwd = $_POST["pwd"];
$pwdrepeat = $_POST["pwdrepeat"];
$gender = $_POST["gender"];
$date = $_POST["bday"];
$age = $_POST["num"];
$mobileno = $_POST["mobileno"];
$idnumber = $_POST["idnumber"];

require_once 'dbh.inc.php';
require_once 'functions.inc.php';

if (emptyInputSignup($firstname,$sirnam,$email,$username,$pwd,$pwdrepeat,$gender,$date,$age,$mobileno,$idnumber) !==false){
header("location:..../signup.php?error=emptyinputy");
exit();
}
if (invalideUid($username) !==false){
header("location:..../signup.php?error=invalideUid");
exit();
}
if (invalideEmail($email) !==false){
header("location:..../signup.php?error=invalideEmail");
exit();
}
if (pwMatch($pwd,$pwdrepeat) !==false){
header("location:..../signup.php?error=passworddontmatch");
exit();
}

if (uidExists($conn,$username,$email) !==false){
header("location:..../signup.php?error=usernametaken");
exit();
}

createuser($conn,$firstname,$sirname,$email,$username,$pwd,$gender,$date,$age,$mobileno,$idnumber);




}


else{
header("location:..../signup.php");
}

?>

login.inc.php

<?php
include_once 'header.php';


?>
<section class="login-form">
<h2>Login</h2>

<form action="login.inc.php" method="post">
</form>
</section>
<?php
include_once 'footer.php';

?>

functions.inc.php

<?php


function emptyInputsignup($firstname,$sirnam,$email,$username,$pwd,$pwdrepeat,$gender,$date,$age,$mobileno,$idnumber) {
$results;
if (empty($firstname) || empty($sirnam) || empty($email) || empty($username) || empty($pwd) || empty($pwdrepeat) || empty($gender) || empty($date) || empty($age) || empty($mobileno) || empty($idnumber)){
$result = true;

}
else{
$result = false;
}

return $result;
}

function invalideUid($username){
$results;
if (! preg_match("/^[a-zA-Z0-9]*$/", $username)){
$result = true;

}
else{
$result = false;
}

return $result;
}

function invalideEmail($email){
$results;
if (!filter_var($email, FILTER_VALDATE_EMAIL)){
$result = true;

}
else{
$result = false;
}

return $result;
}

function pwMatch($pwd,$pwdrepeat){
$results;
if ($pwd !== $pwdrepeat){
$result = true;

}
else{
$result = false;
}

return $result;
}



function uidExists($conn,$username,$email){
$sql = "SELECT * FROM register WHERE Uid = ? OR email_address = ?;";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
header("location: ../signup.php?error=stmtfailed");
exit();
}

mysqli_stmt_blind_param($stmt, "ss", $username,$email);
mysqli_stmt_execute($stmt);

$resultData = mysqli_stmt_get_result($stmt);

if ($row= mysqli_fetch_assoc($resultData)) {
return $row;
}
else{
$result = false;
return $result;
}
mysqli_stmt_close($stmt);

}

function createUser($conn,$firstname,$sirname,$email,$username,$pwd,$gender,$date,$age,$mobileno,$idnumber){
$sql = "INSERT INTO register(first_name,sir_name,email_address,Uid,password,gender,birthday,age,phone_number,national_id) VALUES (?,?,?,?,?,?,?,?,?,?);";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
header("location: ../signup.php?error=stmtfailed");
exit();
}

$hashedpwd = password_hash($pwd, PASSWORD_DEFAULT);


mysqli_stmt_blind_param($stmt, "ssssssssss", $firstname,$sirname,$email,$username,$hashedpwd,$gender,$date,$age,$mobileno,$idnumber);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
header("location: ../signup.php?error=none");
exit();
}

?>



dbh.inc.php

<?php

$serverName = "localhost";
$dBUsername = "root";
$dBPassword = "";
$dBName = "doctorpatientsystem";



$conn = mysqli_connect($serverName,$dBUsername,$dBPassword,$dBName);

if (!$conn){
die("connection failed: " .mysqli_connect_error());
}
nyabutijj
 
Posts: 2
Joined: 25. August 2023 01:43
XAMPP version: 8.2.4
Operating System: windows 11


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 163 guests