Results 1 to 6 of 6

Thread: Php big project

  1. #1

    Thread Starter
    Addicted Member Tommy101's Avatar
    Join Date
    Jun 2004
    Location
    Switzerland
    Posts
    144

    Php big project

    I have been programing a chat application in vb and want to go a step further than please insert the ip. I want to have the program login on a page and then the program would show a list of who is online or not. I would also like to have the php script get the ip. Then when i click a name the program would receive that ip and then the user would be able to chat. Being a programmer i have no real knowledge of php!
    Is this possible? I hope when you read this it is not to confusing !

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    I'm presuming you know how to set PHP up and have it running on your PC so you can test it. This code will display your IP and nothing else:
    PHP Code:
    <? echo $_SERVER['REMOTE_ADDR']; ?>
    To get other's IPs you'd need something like this. When I run the program, it get's my IP and sends it (encrypted hopefully) to a server database. It then reads all the entries in that database checking for IPs with names that correspond to ones I have in my contacts list.
    It then returns the names and IPs so I can start a conversation.

    All this database stuff can be done in PHP very easily. You can google for mySQL with PHP and get some good tutorials on how to get it done.

    I think the hardest thing would be getting your VB application to read the PHP. This project can be done in PHP and in VB, but using both might get tricky. I'm sure that VB has some way of sending data to online DBs. I think using that would be easier than PHP.

    Wait for a response from an expert though.
    Have I helped you? Please Rate my posts.

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: Php big project

    Originally posted by Tommy101
    Being a programmer i have no real knowledge of php!
    I'm a programmer, and I have vast knowledge of PHP.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090

    Re: Re: Php big project

    Originally posted by The Hobo
    I'm a programmer, and I have vast knowledge of PHP.
    You could be a bit more constructive Hobo. Still a very valid point.
    Have I helped you? Please Rate my posts.

  5. #5

    Thread Starter
    Addicted Member Tommy101's Avatar
    Join Date
    Jun 2004
    Location
    Switzerland
    Posts
    144
    I meant that i have not studied php before and you probaly program in C++ right?

    Anyway can someone tell me how to create a simple logon page?

  6. #6
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Well. how simple do you want it?
    I'm not going to make the page which submits data to this code, but I'll presume that the username field is called un and the password field is called pw.

    PHP Code:
    //untested
    $un $_POST['un'];
    $pw $_POST['pw'];
    //Here you'll want validation to make sure they didn't inject anything.
    $query "SELECT * FROM `users` WHERE `username`='$un'";
    /*That will get the get the row from the database, from the table called users, where the heading username mathes the username that was inputted*/
    $result mysql_query($query);
    if (
    $pw == @mysql_result($query,0,'password')
        {
        
    //Person logged in correctly. Start some sessions etc.
        
    }
    else
        {
        echo 
    "username/password invalid";
        } 
    To find out about sessions just do a search, both on google and in this PHP section.

    BTW, lots of people (and I meant lots) will know several branches of languages. For example, VB, C++, PHP, COBOL, PYTHON, PERL etc. It's not that rare, to be an expert in all is, but several people at least know enough for their needs in plenty of languages. Just because you've learned C++, that doesn't mean that you can't also learn VB.
    Last edited by Acidic; Sep 30th, 2004 at 07:56 AM.
    Have I helped you? Please Rate my posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width