Please Explain code- registration page php

I just found this code in a video about making a social network and i’m new to php. So can someone pls explain what this code is doing? Also, can someone suggest some good free php resources on the net?

Code:(index.php)

 <?php include ("./inc/header.inc.php");?>
<?php include("./inc/connect.inc.php");?>
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$con = mysqli_connect("localhost", "root", "password", "database_social");
date_default_timezone_set('UTC');
$reg = @$_POST['reg'];

$fn = @$_POST['first_name'];
$ln = @$_POST['last_name'];
$un = @$_POST['username'];
$em = @$_POST['email'];
$em2 = @$_POST['email2'];
$pswd = @$_POST['password'];
$pswd2 = @$_POST['password2'];
$d = date("Y-m-d"); // Year - Month - Day

if (isset($reg)) {

    if ($em==$em2) {

        $u_check = mysqli_query($con,"SELECT username FROM users WHERE username='$un'");

        $check = mysqli_num_rows($u_check);

        $e_check = mysqli_query($con,"SELECT email FROM users WHERE email='$em'");

        $email_check = mysqli_num_rows($e_check);

        if ($check == 0) {
          if ($email_check == 0) {

            if ($fn && $ln && $un && $em && $em2 && $pswd && $pswd2) {

                if ($pswd==$pswd2) {

                    if (strlen($un)>25||strlen($fn)>25||strlen($ln)>25) {
                        echo "The maximum limit for username/first name/last name is 25 characters!";
                    }
                    else
                    {

                        if (strlen($pswd)>30||strlen($pswd)<5) {
                            echo "Your password must be between 5 and 30 characters long!";
                        }
                        else
                        {

                            $pswd = md5($pswd);
                            $pswd2 = md5($pswd2);
                            $query = mysqli_query($con,"INSERT INTO 'database_social'. 'users' (id, username, first_name, last_name, email, password, sign_up_date, activated) VALUES ('','$un','$fn','$ln','$em','$pswd','$d','0',)");
                            die("Login to your account to get started ...");
                            echo "inserted!";
                        }
                    }
                }
                else {
                    echo "Your passwords don't match!";
                }
            }
            else
            {
                echo "Please fill in all of the fields";
            }
        }
        else
        {
           echo "Sorry, but it looks like someone has already used that email!";
       }
   }
   else
   {
    echo "Username already taken ...";
}
}
else {
    echo "Your E-mails don't match!";
}
}
?>
<div style="width: 800px; margin: 0px auto 0px auto;">
    <table id="SignUpTable">
        <tr>
            <td width="40%" valign="top">
                <h2>Enter The World Today!</h2>
                <form action="#" method="POST">
                    <input class="fname" type="text"  name="first_name" size="25" placeholder="First Name"><br/> <br/>
                    <input class="lname" type="text" name="last_name" size="25" placeholder="Last Name"><br/><br/>
                    <input class="uname" type="text" name="username" size="25" placeholder="Username"><br/><br/>
                    <input class="email" type="text" name="email" size="25" placeholder="Email"><br/><br/>
                    <input class="email2" type="text" name="email2" size="25" placeholder="Re-enter Email"><br/><br/>
                    <input class="password" type="password" name="password" size="25" placeholder="Password"><br/><br/>
                    <input class="password2" type="password" name="password2" size="25" placeholder="Re-enter Password"><br/><br/>
                    <input class="buttonSignUp" type="submit" name="reg" value="Enter The World!">
                </form>
            </td>
        </tr>
    </table>

    <?php include ("./inc/footer.inc.php");?>

Thanks!


Download please.explain.code.registration.page.php.zip
Direct Link


Download


Download please.explain.code.registration.page.php.zip
Mediafire


Download


Download please.explain.code.registration.page.php.zip
Firedrive


Download


Download please.explain.code.registration.page.php.zip
Crocko


Download


Download please.explain.code.registration.page.php.zip
Queenshare


Download

Both comments and pings are currently closed.

Comments are closed.