Jump to content

Verifying a Number


iKettles

Recommended Posts

I'm trying to make a script where the user has to put a number in to get past that area. Like a password but it isn't user based. There would be a list of numbers and if the user puts anyone of those into the text box and pressed submit they would be taken on to the restricted page. How would I go about doing this?

Link to comment
Share on other sites

Thanks for the reply. How would I be able to get it to check what's inside the text box when someone clicks submit?

 

submit the form, abstract the data passed from the particular form field of interest and test for whether that value is in your pre-defined array. In the manual, you'll find the user notes are usually very helpful and give specific example uses of the function.

Link to comment
Share on other sites

Thanks for the reply. How would I be able to get it to check what's inside the text box when someone clicks submit?

 

submit the form, abstract the data passed from the particular form field of interest and test for whether that value is in your pre-defined array. In the manual, you'll find the user notes are usually very helpful and give specific example uses of the function.

This whole PHP thing is confusing. Can you give some examples of what functions I could use to "grab" the data from the text box once the form has been submitted?

Link to comment
Share on other sites

Sorry for the triple post! I have one more question.

I currently use a CMS system I made myself following a tutorial and I would like to make it so users could not access the pages to register/login without passing through the ID page. Also if they tried to access say register.php and they got taken to the ID page when they submitted the ID they'd get taken back to the register.php page and not the main page. How would I achieve this?

Link to comment
Share on other sites

Nailed it! Used this code:

<?php

$id = array(array('4471', '1337'));

 

if (in_array(array('4471', '1337'), $id)) {

   header( 'Location: http://www.flycay.com/caypilot/main.php' ) ;

}

?>

Try this instead. Where i put the second 4471, you can replace that number with any number you want to check... i.e. 1337

 

<?php

$id = array('4471', '1337');

 

if (in_array('4471', $id)) {

  header( 'Location: http://www.flycay.com/caypilot/main.php' ) ;

}

?>

 

 

 

Link to comment
Share on other sites

Why you'd want to have what is effectively two logins is beyond me...

 

However, you can handle it with sessions though. You can set a session on successful completion of this ID stage, and check that on the other pages. If that session isn't present, redirect to the ID page.

 

I have to say, your code to check this ID doesn't appear to make a lot of sense. As far as i can see, it doesn't take any input from the user.

 

 

Link to comment
Share on other sites

Why you'd want to have what is effectively two logins is beyond me...

 

However, you can handle it with sessions though. You can set a session on successful completion of this ID stage, and check that on the other pages. If that session isn't present, redirect to the ID page.

 

I have to say, your code to check this ID doesn't appear to make a lot of sense. As far as i can see, it doesn't take any input from the user.

 

 

I need to have two logins so people can't just randomly register, only verified people. Unless I remove the register page and add them automatically.

The code to check the ID does need input, the user has to put in a correct ID to be able to pass through.

Link to comment
Share on other sites

So have your accounts require verification by an administator after they are registered but before you can log in with them. It'd be far more user friendly.

 

The code to check the ID does need input, the user has to put in a correct ID to be able to pass through.

 

Really? I can't see any user-input data here:

 

<?php
$id = array(array('4471', '1337'));

if (in_array(array('4471', '1337'), $id)) {
   header( 'Location: http://www.flycay.com/caypilot/main.php' ) ;
}
?>

 

Link to comment
Share on other sites

So have your accounts require verification by an administator after they are registered but before you can log in with them. It'd be far more user friendly.

 

The code to check the ID does need input, the user has to put in a correct ID to be able to pass through.

 

Really? I can't see any user-input data here:

 

<?php
$id = array(array('4471', '1337'));

if (in_array(array('4471', '1337'), $id)) {
   header( 'Location: http://www.flycay.com/caypilot/main.php' ) ;
}
?>

 

That script links to a form where the user puts in the ID.

How would I go about making a verification system that is verified by an admin? I'm using the code for the CMS from here -

http://evolt.org/article/comment/17/60265/index.html

Link to comment
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.