コード例 #1
0
<?php

include "../includes/layouts/header.php";
require_once "../includes/functions/functions.php";
require_once "../includes/functions/db_connection.php";
if (isset($_POST["username"])) {
    if (check_available($_POST["username"]) && validateCred($_POST["username"], $_POST["password"])) {
        //echo "Username available";
        if (createUser($_POST["username"], $_POST["password"], $_POST["name"], $_POST["phone_no"], $_POST["email_id"])) {
            redirect("index.php?signedup=1");
            //echo "Account created successfully. Go to <a href=index.php>Log in</a> page.";
        }
    } else {
        echo "<p class=\"invalid_cred\">Username not available</p>";
    }
}
?>
<html>
<body>
	<h3> Enter details for signing up:</h3>
	<form name="signup" action="signup.php" method="POST" onsubmit="return validateForm()">
		<input type="text" placeholder="new username" id="username" name="username"
		value="<?php 
echo isset($_POST['username']) ? $_POST['username'] : '';
?>
" required
       oninvalid="this.setCustomValidity('User ID is a must')" oninput="setCustomValidity('')"></input>
			 <!--<input type="button" value="Check Availability" onsubmit="signup.php"></input>-->
			 <br>
		<input type="password" placeholder="password" id="password" name="password" required
       oninvalid="this.setCustomValidity('Please provide a password')" oninput="setCustomValidity('')"></input>
コード例 #2
0
<?php

include "../includes/layouts/header.php";
require_once "../includes/functions/functions.php";
require_once "../includes/functions/db_connection.php";
if (isset($_POST["username"])) {
    if (check_free_username($_POST["username"]) && validateCred($_POST["username"], $_POST["password"])) {
        //echo "Username available";
        if (createUser($_POST["username"], $_POST["password"], $_POST["name"], $_POST["phone_no"], $_POST["email_id"])) {
            redirect("login.php?signedup=1");
            //echo "Account created successfully. Go to <a href=index.php>Log in</a> page.";
        }
    } else {
        echo "<p class=\"invalid_cred\">Username not available</p>";
    }
}
?>
<div class="main">
	<div class="content container" id="main-section">
		<br><br>
	<h3> Enter details for signing up:</h3>
	<form name="signup" action="signup.php" method="POST" onsubmit="return validateForm()">
		<input type="text" placeholder="new username" id="username" name="username"
		value="<?php 
echo isset($_POST['username']) ? $_POST['username'] : '';
?>
" required
       oninvalid="this.setCustomValidity('User ID is a must')" oninput="setCustomValidity('')"></input>
			 <span id="username_availability_status"></span>
			 <!--<input type="button" value="Check Availability" onsubmit="signup.php"></input>-->
			 <br>