Having trouble with ODBC and PHp

wxdqz

New Member
Hi,

I am trying to write a login script with ODBC to contain grades, username, password, first name and last name for this login script i am doing for my old technology teacher. The user will login using his assigned username /pass, the script would read from the database to see if its the correct username and/or pass: if it is, it will send the grade, first name and last name to the next script. if not, it will supply the user with an error. Tell me whats wrong...

This is the PHP part:
the variable $line is stored in a text file under the users name to find out the row number of the user...

<?php
if( isset( $username ) )
{
$fp = fopen( $username.".txt", "r" ) or die("Couldn't open \$filename");
while ( ! feof( $fp ) )
{
$line = fgets( $fp, 2084 );
}
if( isset( $password ) )
{
$connect = odbc_pconnect( 'grades' , '', '' ) or die ('Could not open ODBC Database');
$query = "select pwd FROM people";
$result = odbc_do( $connect, $query );
while( odbc_fetch_row( $result ) )
{
$pwd= odbc_result($result,$line);
}
if( $password == $pwd )
{
print "<a href=http://www.phpbuilder.com/board/archive/index.php/\"journal.php?pwd=$pwd&username=$username&pass=true\">Continue</a>";
}
else
{
print "Incorrect Username/Pass";
}

}
else
{
break;
}
}
else
{
}
?>

The table is as follows...

index|username|fname|lname|pwd|pts|tpts
1 |webmaster02 |brad | taylor | test 5 2
2 |richards |richard | su | rsu 1000 1000
3 |admin |jose | vu | admin 5 10000000

i know this is difficult to decipher but I know its not a database problem because I called a script that uses odbc_result_all and that works..

If you could please help me I would greatly appreciate it...

Brad Taylor
Senior Webmaster
BradCom Industries LTD
<!-- w --><a class="postlink" href="http://www.simplysmarter.org">www.simplysmarter.org</a><!-- w -->
 
Back
Top