Click to See Complete Forum and Search --> : Php big project
Tommy101
Sep 29th, 2004, 10:29 AM
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 :)!:) :)
Acidic
Sep 29th, 2004, 10:37 AM
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:
<? 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.
The Hobo
Sep 29th, 2004, 11:47 AM
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.
Acidic
Sep 29th, 2004, 11:51 AM
Originally posted by The Hobo
I'm a programmer, and I have vast knowledge of PHP.
You could be a bit more constructive Hobo. :rolleyes: Still a very valid point. :afrog:
Tommy101
Sep 30th, 2004, 05:51 AM
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?
Acidic
Sep 30th, 2004, 07:53 AM
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.
//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.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.