Authentication – PHP

  php

Q(Question):

hi all ,im runing a site and i need to charge users!!

i have a form for entering data ,and all is working well!!

i got one program that calling my site and read a file that is return from a form of entering credit card details ,then the program is calling this file in my site and checking if there is problem with the card or its ok!!

what i need is the code to read the string for good and bad!

this is the starting code i found:

$myFile = "pull/INT_IN";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 4);
fclose($fh);

i want to have here the code like that:

if the string = 1111 ,the card is ok
if the string = 0000 ,the card is bad

sorry for my bad english 🙂

thanx

A(Answer):

Heya, canabatz.

Do you need to validate credit card numbers? If so, you’ll want to run them through the Luhn algorithm (http://www.google.com/search?q=php+luhn).

A(Answer):

I dont need to validate , i got program connected direct to the credit card company ,and they checking the cards!!

i just want to read a file to say if there is 1111 in it or 0000 ,thats it! 🙂

thanx

A(Answer):

Are you storing the values 1111 and 0000 in a text file? If so, read how to read a text file.

A(Answer):

i know how to read test file ,what i need is

if {taxt file string is 1111}

do something

else if {taxt file string is 0000}

do something

i dont know how to tell the code that look for 1111 or 0000

thanx

A(Answer):

I think it’s quite simple, If only I am not wrong.
After you had read the 4 digit number in to the variable $theData just check it.

if ($theData == '1111')
{
echo 'The Card is ok';
}
elseif ($theData == '0000')
{
echo 'The Card is not ok';
}

A(Answer):

i remember trying that before!!! ,and maybe there was something else wrong :)))

thanx allot man ,it’s working like it need to!!

🙂

LEAVE A COMMENT