Http error 500

edited March 17 in Support Forums

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.

Comments

  • edited March 18

    @Gamingvt03
    PFH/forum email not verified

    http://gamers-inc.ezyro.com/index.php
    HTTP ERROR 500
    500 Internal Server Error

    Error in you script php syntax
    https://www.w3schools.com/php/php_syntax.asp

  • 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

  • edited March 18

    @Gamingvt03
    PFH/forum email not verified

    "PHP" syntax error returns 500

    You made a mistake during copy! Different host! (/public_html, /htdocs)

    I can not tell you unless I see the source of your index.php file.

        <?php include ('inc/array.php'); ?>
        <!DOCTYPE HTML>
        <html>
        <head>
        <?php include('inc/badhead.php'); ?>
        </head>
        <body>
          <div id="main">
            <div id="header">
              <div id="logo">
                <div id="logo_text">
                  <!-- class="logo_colour", allows you to change the colour of the text -->
                  <h1><a href="index.html">Bad<span class="logo_colour">Tech</span></a></h1>
                  <h2>No US Phishing Permit</h2>
            </div>
               </div>
              </div>
        <div id="brake">&nbsp;</div>
              <div id="menubar">
            <?php include('inc/menubar.php'); ?>
              </div>
        <div id="brake">&nbsp;</div>
             <div id="content">
              <?php include $pages[$pageID]['page']; ?>
             </div>
        <div id="brake">&nbsp;</div>
           <div id="footer">
              <?php include('inc/badfooter.php'); ?>
            </div>
          </div>
        </body>
        </html>
    

    https://cedartree.gq/

  • edited March 18

    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'; } } } } ?>

    <link href="//db.onlinewebfonts.com/c/a4e256ed67403c6ad5d43937ed48a77b?family=Core+Sans+N+W01+35+Light" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" href="form.css" type="text/css">
    <div class="body-content">
      <div class="module">
        <h1>Create an account</h1>
        <form class="form" action="form.php" method="post" enctype="multipart/form-data" autocomplete="off">
          <div class="alert alert-error"><?= $_SESSION['message'] ?></div>
          <input type="text" placeholder="User Name" name="username" required />
          <input type="email" placeholder="Email" name="email" required />
          <input type="password" placeholder="Password" name="password" autocomplete="new-password" required />
          <input type="password" placeholder="Confirm Password" name="confirmpassword" autocomplete="new-password" required />
          <div class="avatar"><label>Select your avatar: </label><input type="file" name="avatar" accept="image/*" required /></div>
          <input type="submit" value="Register" name="register" class="btn btn-block btn-primary" />
        </form>
      </div>
    </div>
  • edited March 18

    Make a copy of that file and delete it off the server. That is so far off! What are you logging on to? what is logan1027? Surly not a pass word!! Way to much time debugging that!

    All your script is running before the form is ever presented. There is not a file
    http://gamers-inc.ezyro.com/form.php on the server.

    <form class="form" action="form.php" method="post" enctype=

    Suggest installing a CMS and see how it works on this server.

    https://cedartree.gq/ezy/

  • so install a cms instead and logan1027 is my mysql password

  • edited March 18

    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

  • @Gamersinc

    First thing is go back and edit your post removing sql username and password. Then change your sql password. There is some who visit the forum and will know how to use your database. And you just gave them access.

    If you are wanting to create a website from scratch (CMS) that uses database for hashing site users registration, log on, and profile, look for a basic beginner tutorial. But it is a long learn. Best to use a small CMS with user registration built in. Then try to theme or style (html/css). Not just jump in to database config files. I myself have not got that far. I have to use open source script for a user registration based site content. Wordpress is the most common. But there are others. So it depends what you need is for users on your site. Look at software install in control panel and try to find one that will suit your needs. It may be a while before your site goes live.

  • edited March 18

    ok thank you for helping I will just go to wordpress then untill I learn php properly

  • edited March 19

    @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

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!