php - Showing different HTML content depending on URL -


a visitor comes page throught custom url, e.g:

http://domain.com/dmtydmrz%40dispostable.org

the part after domain name represents users email address. somehow need extract part , check if email address exists in database.

if exists,the user presented web form submit data on index.php site, if not, notified not eligible view form, on index.php site.

i asking guidelines on how approach problem, since i'm fresh in php , url's added email parameter 404. somehow need redirect index.php or what? i'm totally lost. appreciated.

so first, not recommend pass email way through url. if decided want pass email through url, it's better use query string, example:

http://www.foo.com/index.php?email=useremailhere

the query string whole part after '?': email=useremailhere

in order retrieve poriton of url, in php code is:

index.php:

<?php $email = $_get['email']; echo "users email = ".$email."<br>"; ?> 

to check information have in database, recommend using mysql (pdo). there many tutorials online. mysql (pdo) is combination of php sql allows users lot of actions in database, including (but not limited to):

  • creating tables
  • retrieving data tables
  • inserting data inside tables
  • deleting tables

with actions retrieving data tables, able check if have email registered in database, command like:

$sql = "select * table email = user_email"; $stmt = $conn->prepare($sql); $stmt->parambind(':user_email',$email); $stmt->execute(); 

and you'd able see if email exists mysql code similar to:

if ($stmt->rowcount()>=1) {   //... } 

right recommend you:

  1. get query string part working
  2. research on how use mysql (pdo)

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -