1

I'm following this tutorial to build the user registration system (https://www.positronx.io/build-php-mysql-login-and-user-authentication-system)

I have successfully posted the user registration info to the SQL database but I'm stuck in the user verification part.

I tried to click the link in the verification email but turns out it returned an error err_connection_refused. I am wondering if I need to change the localhost in the href to my domain name?

Also, I'm not sure what is php-user-authentication, I couldn't find that folder in my WordPress cpanel.

Thank you guys for your help and I hope it's not a silly question.

if($sqlQuery) {
 $msg = 'Click on the activation link to verify your email. <br><br>
  <a href="http://localhost:8888/php-user-authentication/user_verificaiton.php?token='.$token.'"> Click here to verify email</a>';
}
Suresh Mangs
  • 705
  • 8
  • 19
GT Tutor
  • 29
  • 3
  • Having had a quick look through the link you post, it's not so much a tutorial as a cut and paste exercise and as you've found out doesn't explain anything. The use of `localhost:8888` as the url looks odd. Try removing the `:8888` part. – Nigel Ren Dec 06 '20 at 16:41

2 Answers2

1

Mail veryfication is really easy

I would recommend you to use site name instead of port. Like : http://localhost/domain/php-user-authentication/user_verificaiton.php?token=$token

Above url will simply lead you to your localhost site, exact on that site. then simple:

<?php
    $token = $_GET['token'];
    //now you can verify this token from db
?>

user_verification.php is the file where you get $token available

SK Shewa
  • 106
  • 1
  • 9
  • Hi Thank you for your reply. I have tired this method but still remain the same connection refused error. May I know the meaning of localhost and is it possible for me to delete it from the URL? Thanks! – GT Tutor Dec 06 '20 at 17:08
  • localhost is local server environment that need to run PHP you can not remove it from URL. Can you give the detail error – SK Shewa Dec 06 '20 at 17:17
0

Just changing the following line

 $link = "http://localhost:8888/php-user-authentication/user_verificaiton.php?token=" . $token;

to

 $link = "./php-user-authentication/user_verificaiton.php?token=" . $token;
Ken Lee
  • 6,985
  • 3
  • 10
  • 29