Jump to content

xinteractx

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Posts posted by xinteractx

  1. try something like this...

     

     

    <?php

     

    //test number

    $cc_num = "123312312";

     

    $number = "$cc_num";

    $last_four = substr($number, -4);

    $first_one = substr($number, 1);

    if($first_one=3){$cc_type = "American Express";}

    elseif($first_one==4){$cc_type = "Visa";}

    elseif($first_one==5){$cc_type = "MasterCard";}

    elseif($first_one==6){$cc_type = "Discover";}

    else {$cc_type = "Unknown";}

     

    //bla data

    $authxyz = "234";

    $amount = "123.44";

     

    Print "

    <center>

    <table width='800' height='50' cellspacing='0' cellpadding='0' border='1' bordercolor='black'>

    <tr valign='top'>

    <td width='200' height='10' align='left' valign='top'>

    <font face='Tahoma' size='2'>CARD TYPE</font>

    </td>

    <td width='200' height='10' align='left' valign='top'>

    <font face='Tahoma' size='2'>LAST 4</font>

    </td>

    <td width='200' height='10' align='left' valign='top'>

    <font face='Tahoma' size='2'>AUTH CODE</font>

    </td>

    <td width='200' height='10' align='left' valign='top'>

    <font face='Tahoma' size='2'>AMOUNT</font>

    </td>

    </tr>

    <tr valign='top'>

    <td width='200' height='40' align='left' valign='top'>

    <font face='Tahoma' size='2'>$cc_type</font>

    </td>

    <td width='200' height='40' align='left' valign='top'>

    <font face='Tahoma' size='2'>$last_four</font>

    </td>

    <td width='200' height='40' align='left' valign='top'>

    <font face='Tahoma' size='2'>$authxyz</font>

    </td>

    <td width='200' height='40' align='left' valign='top'>

    <font face='Tahoma' size='2'>$amount</font>

    </td>

    </tr>

    </table>

    </center>

     

    ";

     

    ?>

  2. here a old script i wrote about year ago.

     

    <script language="JavaScript">

    function SESSION_TIMEOUT()

    {

    var t=setTimeout("KICK()",32400000);

    }

     

    function KICK()

    {

    window.location = "index.php";

    }

     

    </script>

     

     

     

    32400000 is milliseconds i think..

     

     

    i also used my own custom session control and a time stamp the sessions inside my database. if they where not stamped within the time period the session would be removed from the db and then they javascript would fire locally to make sure they know they been kicked.

     

    I stamped the session each time they browsed to another page and used this script of more of a inactivity kick script to kick the users off if they left there pc running all day and forgot about it and went home.

  3. Object oriented coding is is different form of thinking.

     

    think of it like linking many functions together and each function can do its own thing but knows what all they other functions do..

     

    now multiply this by 100 and you now have object oriented programming.. you can duplicate your entire project and override one function etc. 

     

    instead of calling the same function, you can duplicate it and call it as its own object with its own properties etc.

     

  4. Hello All

     

    I am new to the forum, i just joined.. looking forward to a good place to meet other pro php developers.

     

    My OO knowldge is very limited, I been doing mostly php procedural coding.  I am starting my next project here at work and I trying to do this one with a CLASS Objects to see how it all works out.

     

     

    I am getting some errors, and Its prob because I dont know OO and PHP.

     

    I read a bunch of documents on it, however there are still little questions I cant seem to find exact answers for.

     

    Below is the code I wrote so far to connect to the database.

     

    <?php

    //The DB_OBJECT simple creates the connection to the database

    //this object must be called first.

     

    class DB_OBJECT {

    // pirvate user object data

    var $db_username;        // username for the db

    var $db_password;        // password for the db

    var $db_server_name;      // the db server_name

    var $db_db_name;          // the db database name

     

    var $db_returned_status;  //true if connection successfull, if false returns error.

    var $db_primary_object;  // used to store database connection object

     

        function connect($db_username,$db_password,$db_server_name,$db_db_name)

        {

     

            if (!this->$db_primary_object)

            {

            //create connection object.

            this->$db_primary_object = mysql_connect($db_server_name,$username,$password);

     

                                    if (!this->$db_primary_object)

                                    {

                                    this->$db_returned_status==mysql_error();

                                    }

                                    else

                                    {

                                    this->$db_returned_status=true;

                                    mysql_select_db($db_db_name,$db_primary_object);

                                    }

            }

     

        return $this->$db_returned_status;

        }

     

    }

     

    ?>

     

     

    But I keep getting a error, and I think it has something to do with the this->$db_primary_object part of the code.

     

    maybe some hidden rules with php and OO i am not getting ?

     

    Parse error: parse error, unexpected T_OBJECT_OPERATOR in \htdocs\sales\include\db.php on line 21

     

     

    here is the basic code i am using to test the object.

     

    <?php

    include ($_SERVER['DOCUMENT_ROOT'].'/sales/include/db.php');  // DB Connection object

     

    // connect to database using custom db object

    $database_obj=new DB_OBJECT("username","password","localhost","call_center");

     

    ?>

×
×
  • 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.