
malachi
Novice
Dec 12, 2012, 3:10 AM
Views: 1916
|
transfer site from linux to windows, DBI problem?
|
|
|
Hello, We have a old website that was running on linux/apache server. The server brokedown and I need to transfer the site to diffrent server. I am not familiar with cgi scripts and I have a problem. Diffrent server is apache 2.2.11 with php 5.2.9 on windows 2003 SBS. I have installed ActivePerl 5.14.2 with DBI, DBD-ODBC packages. I rewrite some lines in script so it would work on Windows. Everything seems to work ok but when the script verify login data it gives login error. He is my script: #!C:\perl\bin\perl.exe -w print "Content-type: text/html\n\n"; use DBI; my $server = "my_serwer"; my $login = "mylogin"; my $haslo = "mypassword"; my $Error = 0;my $ErrorDBI = ""; #eval { DBI->trace(4) }; #if ($@) # {# $ErrorDBI = $@;# $Error = 6;# }use CGI; $cgi = new CGI; $user_name = $cgi->param("user_name"); $password = $cgi->param("password"); use CGI::Carp qw (fatalsToBrowser); print "<html>";print "<head>\n";print "<meta http-equiv='Content-Type' content='text/html; charset=windows-1250'>"; print "<meta http-equiv='EXPIRES' content='0'>"; print "</head>\n"; my $conn=DBI->connect("dbi:ODBC:$server", $login, $haslo) or die "Error in connect $DBI::errstr "; $dbh = $conn->prepare("SELECT password, id_kom, id_ko FROM webklient where user_name='$user_name'") or die "Can't prepare statement: $DBI::errstr"; $dbh->execute or die "Can't execute statement: $DBI::errstr";$dbh->bind_columns(\($pass_d,$kntr_id_kom, $kntr_id_ko)); if ($dbh->fetch) { if ($pass_d ne $password) { $Error = 3; print "wrong password\n"; print "$pass_d \n"; -- here it shows "te" and in database is "test123" ???? print "$password \n"; -- here it shows "test123" this is correct print "$user_name \n"; -- here it shows "test123" this is correct } else... I don't know where is the problem. The Select statment should return 'test123' for user 'test123' but it only retuns first two characters 'te'. When I compare user password from POST with the one form database it is incorrect. Is it ActivePerl, DBI problem or something else? Please help. Andrew
(This post was edited by malachi on Dec 12, 2012, 4:19 AM)
|