how do i authenticate a website member using  vb2005?

leeCh
leeCh used Ask the Experts™
on
i would like to make it so that a user can login to my application using his username and password from my sites phpbb forum.

i know i cant connect directly to the database from the program and that i will need something to  communicate to the database  on the server its self.

how would i go about  creating the authentication process in a php file or something else?

basically i would like it to be something like this.

1) username and password is passed to a page
2) pages queries database
3) page returns "is member" and member type

how would i do this in either something like a post method?


im writing this application in VB 2005. any help would be very appriciated
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2006

Commented:

Author

Commented:
im completely new to authentication, and  aspx for that matter. is there any way to use the URL to post instead of the aspx form? maybe there is a commented  version of shit so i can get a better understanding of what im doing  why im doing it where and how...ect...i dont mean to be a pain  but  i dont  program with  websites much and the little bit i do is usually  web scraping. everything that micro$oft explains how to do is always way over my head as they  dont explain it they just  give code snippets that dont make sense.

is this as simple as it gets? i mean not to sound dense or anything  but  what i want to do seems alot simpler in my head
Top Expert 2006

Commented:
Yes. both the links explains with description and comment in the code. This is the simplest version. These links are mainly for beginners like you.
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Author

Commented:
ok so i have spent  over 24 hours straight looking over this  stuff trying to get it to work...i have gotten no where...for one every time i try  uploading it to my  site its just text when i  go to the url...also these  reference stuff that ,according to a few sites i looked at, is out dated. where would these go in the file structure of the  website? why is it showing up as text and not a form. is there not a way to  use the URL to  query they database? im completely lost lol

Author

Commented:
im looking for something like this

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_22669318.html?sfQueryTermInfo=1+author+php+script

basically i would like  a php file, lets say auth.php, so that when i send the link to the site it returns values from the phpbb database

http://mysite.com/auth.php?id=Username&pw=Password

i would like this to return if user is  registered, user id number, user rank

Valid=yes
ID=43256
Rank=member


now the post i linked is alot more simple than those other 2 sites and  seems more on track , the problem is what would i need to  do to make it secure, where would i put it, how would i implement the  return values and how would i  get it to work  my posting with a url?
Most Valuable Expert 2012
Top Expert 2014
Commented:

Author

Commented:
ok im having an issue with this. the info has been removed for security obviously  but other than that this is  exactly how im trying to use it


im trying to  use it like "mysite.com/auth.php?user=testuser" however my issue is i keep getting

"Parse error: syntax error, unexpected $end in /home/glfdesigns/glfdesigns.com/auth.php on line 18"

i have checked  brackets like some sites said...dont see anything   outta order the best i can tell..any suggestions as to  why this isnt working and  how would i go about fixing it?


<?php $rptID = $_Get['user'];
$toDate = $_POST['todate'];//Connect to the database
$db = mysql_connect("localhost","name","pw");
mysql_select_db("db");//Query the Database
$res = mysql_query("SELECT SELECT user_id, user_rank, user_password, user_form_salt FROM `phpbb_users` WHERE username = $rptID );// Start the XML Document



If($rs = mysql_fetch_row($res)) {
do {
echo $rs[0];
echo $rs[1];
echo $rs[2];
echo $rs[3];
} while($rs = mysql_fetch_row($res));
mysql_close();
}
?>

Open in new window

Most Valuable Expert 2012
Top Expert 2014

Commented:
I do not know PHP so would not be able to help with it.

Author

Commented:
ok i figured out that problem. i was missing  a "

new issue is when i run it  with the correct info i get

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/mysite.com/auth.php on line 3

Warning: mysql_select_db() [function.mysql-select-db]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/mysite.com/auth.php on line 4

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/mysite.com/auth.php on line 4

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/mysite.com/auth.php on line 5

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/mysite.com/auth.php on line 5

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/mysite.com/auth.php on line 10


so i know its trying to connect, i just dont know whats going on


this is  the  code im using at the moment. its not finished  but  at the moment it should work for a test before i work on  setting it up for my needs
<?php $rptID = $_GET['reportid'];
$toDate = $_POST['todate'];//Connect to the database
$db = mysql_connect("localhost","name","pw");
mysql_select_db("db");//Query the Database
$res = mysql_query("SELECT user_id, user_rank, user_password, user_form_salt FROM `phpbb_users` WHERE username = $rptID");// Start the XML Document
echo '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>';
echo '<Report>';

//If information exists, write it out as XML
If($rs = mysql_fetch_row($res)) {
do {
echo '<Detail>';
echo '<id>'.$rs[0].'</Code>';
echo '<LastName>'.$rs[1].'</LastName>';
echo '<FirstName>'.$rs[2].'</FirstName>';
echo '<Whatever>'.$rs[3].'</Whatever>';
echo '</Detail>';
} while($rs = mysql_fetch_row($res));
mysql_close();
}
echo '</Report>';
?>

Open in new window

Most Valuable Expert 2012
Top Expert 2014

Commented:
Again its an issue with the connection from PHP to MySQL. Are you using the correct connection information?

Author

Commented:
yes the info is correct...

is there a better spot for this  question?...it seems im only getting vb coders attention


Most Valuable Expert 2012
Top Expert 2014

Commented:
You are getting vbcoders because you chose VB.NET as the primary zone for the question and VB2005 is used in the title as well.

Author

Commented:
ah...well originally the issue included vb.net but later i realized that the  post is the easy part...

anyways  i got connected to the database but now i get

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/mysite.com/auth.php on line 10


line 10 is this
If($rs = mysql_fetch_row($res)) {

Open in new window

Author

Commented:
ok it works....the points are yours

Author

Commented:
after a few hours of research  of individual aspects this works well
Most Valuable Expert 2012
Top Expert 2014

Commented:
Glad your problem is solved :-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial