Skip to content

Instantly share code, notes, and snippets.

@Sadicko
Created September 29, 2019 07:47
Show Gist options
  • Save Sadicko/ad479590bcb5b83193eb844ad959aaa4 to your computer and use it in GitHub Desktop.
Save Sadicko/ad479590bcb5b83193eb844ad959aaa4 to your computer and use it in GitHub Desktop.
validating user signup
<?php
//including the header
include 'header.php'
?>
<?php
//checking if all fields in the signup are empty
$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if (strpos($url, 'error=empty') !== false) {
echo "Fill out all fields";
}
//checking if the username already exist
if (strpos($url, 'error=username') !== false) {
echo "User already";
}
//session to check if your are logged in
if (isset($_SESSION['id'])){
echo $_SESSION['id'];
} else {
echo "you are not logged in";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment