Jump to content

Recommended Posts

I am trying to have a sign up code on my website, this will allow the user to sign up, only permitted users will have the code.

 

Well I have been racking my brain on how to do this.

 

I want to set the password through the php script, this is what I have so far:

 

	  else{
      $code = "testcode";
      if ($_POST['code'] != $code {$form->setError($field, "* Invaild Code"); }

  }

 

but it does not work, what am I doing wrong? User still can sign up.

Link to comment
https://forums.phpfreaks.com/topic/85311-one-password-no-mysql/
Share on other sites

alright I have changed up the code a bit, just variables really.

 

but now I get the error * Code not entered

 

here is the whole code checking:

      $field = "code";  //Use field name for code
      if(!$code || strlen($subcode = trim($code )) == 0){
      $form->setError($field, "* Code not entered");
      }
      else{
       $ncode = "testcode";
       if ($code != $ncode) {
      $form->setError($field, "* Invaild Code"); 
      }

Link to comment
https://forums.phpfreaks.com/topic/85311-one-password-no-mysql/#findComment-435304
Share on other sites

So is this part of the code:

      $field = "code";  //Use field name for code
      if(!$code || strlen($subcode = trim($code )) == 0){
      $form->setError($field, "* Code not entered");
      }
      else{
       $ncode = "testcode";
       if ($code != $ncode) {
      $form->setError($field, "* Invaild Code"); 
      }

in a function? If so, can you post the entire function?

Link to comment
https://forums.phpfreaks.com/topic/85311-one-password-no-mysql/#findComment-436098
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.