I uploaded a php file with a login section and named it index.php, said it uploaded fine through the ftp but when I go to my site I get a http error 500 error and I have done nothing wrong.
what is wrong with my syntax everything was working for this guy I was copying off of on youtube and there is html in there
My login form php:
<?php
session_start();
$_SESSION['message'] = '';
$mysqli = new mysqli('sql201.ezyro.com', 'ezyro_20786443', 'logan1027', 'accounts');
if($_SERVER['REQUEST_METHOD'] == 'POST') {
//two passwords are equal
if($_POST['PASSWORD'] == $_POST['confirmpassword']){
print_r($_FILES); die;
$username = $mysqli->real_escape_string($_POST['username']);
$email = $mysqli->real_escape_string($_POST['email']);
$password = md5($_POST['password']); //md5 hash password security
$avatar_path = $mysqli->real_escape_string('images/' .$_FILES['avatar']['name']);
//MAKE SURE FILE TYPE IS IMG
if (preg_match(!image, $_FILES['avatar']['type'])){
//copy image to images/ folder
if (copy($_FILES['avatar']['tmp_name'], $avatar_path)){
$_SESSION['username'] = $username;
$_SESSION['avatar'] = $avatar_path;
$sql = INSERT INTO users (username, email, password, avatar)
. VALUES ('$username', '$email', '$password', '$avatar_path');
//if the query is successful, redirect to welcome.php page, done
if ($mysqli->query($sql) === true) {
$_SESSION['message'] = 'Resgistration was successful we added $username to our list!';
header(location: welcome.php)
}
}
else{
$_SESSION['message'] = Sorry something went wrong we couldn't add you.;
}
else{
$_SESSION['message'] = 'Your avatar upload failed';
}
else{
$_SESSION['message'] = 'Please only upload GIF, JPG, or PNG IMAGES';
}
else{
$_SESSION['message'] = 'Your passwords did not match';
}
}
}
}
?>
``
Create an account
so install a cms instead and logan1027 is my mysql password
what am I supposed to do I honestly don’t know how you are to format the sql login:
$mysqli = new mysqli(‘sql201.ezyro.com’, ‘ezyro_20786443’, ‘logan1027’, ‘accounts’);
I moved both of the php files to the main directory as welcome.php and form.php
ok thank you for helping I will just go to wordpress then untill I learn php properly
> @Gamersinc said:
ok thank you for helping I will just go to wordpress then untill I learn php properly
You could also install it via the Script Installer in the control panel. https://profreehost.com/support/account-management/create-a-new-website-easily
got it thank you