Authentication

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • canabatz
    New Member
    • Oct 2008
    • 155

    Authentication

    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:
    Code:
    $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
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    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).

    Comment

    • canabatz
      New Member
      • Oct 2008
      • 155

      #3
      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

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

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

        Comment

        • canabatz
          New Member
          • Oct 2008
          • 155

          #5
          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

          Comment

          • samatair
            New Member
            • Nov 2007
            • 61

            #6
            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.

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

            Comment

            • canabatz
              New Member
              • Oct 2008
              • 155

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


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

              :)

              Comment

              Working...