Connecting Tech Pros Worldwide Help | Site Map

Authentication

Familiar Sight
 
Join Date: Oct 2008
Posts: 141
#1: Nov 12 '08
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:
Expand|Select|Wrap|Line Numbers
  1. $myFile = "pull/INT_IN";
  2. $fh = fopen($myFile, 'r');
  3. $theData = fread($fh, 4);
  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
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#2: Nov 12 '08

re: Authentication


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).
Familiar Sight
 
Join Date: Oct 2008
Posts: 141
#3: Nov 13 '08

re: Authentication


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
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#4: Nov 13 '08

re: Authentication


Are you storing the values 1111 and 0000 in a text file? If so, read how to read a text file.
Familiar Sight
 
Join Date: Oct 2008
Posts: 141
#5: Nov 13 '08

re: Authentication


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
Member
 
Join Date: Nov 2007
Posts: 61
#6: Nov 13 '08

re: Authentication


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.

Expand|Select|Wrap|Line Numbers
  1. if ($theData == '1111') 
  2. {
  3.     echo 'The Card is ok';
  4. }
  5. elseif  ($theData == '0000') 
  6. {
  7.     echo 'The Card is not ok';
  8. }
Familiar Sight
 
Join Date: Oct 2008
Posts: 141
#7: Nov 13 '08

re: Authentication


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


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

:)
Reply