473,725 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Login page perl/CGI

hello,,,,,,,,,
i am creating login page using Perl/CGI facing prob... able to
connect DB but from there facing prob
If u have related code of login page in Perl please send me on
sa************@ gmail.com

please help me
i am using MySQL as DB user name:root password:root database name:ITS

and Table is User_login,
Column 1: User_Name
Column 2: User_Pass

--
#!c:/perl/bin/perl.exe
use CGI qw(:standard);
use CGI::Carp qw(warning's fatalsToBrowser );
use strict;
use DBI;
print "Content-type: text/html\n\n";
print <<BodyHTML;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html lang="en" xml:lang="en" xmlns=" http://www.w3.org/1999/xhtml">
<head>
<title>Registra tion Form</title>
</head>

<body>
<form name = "login" action = "logincheck .cgi " method = "POST">
<table>
<tr>
<td>
User Name<br />(25 characters or less)
</td>
<td>
Password<br />(8 - 15 alphanumeric characters)
</td>
</tr>
<tr>
<td><input type = "text" name = "UserName" id = "UserName" size = "25"
maxlength = "25" tabindex = "0" />
</td>
<td><input type = "text" name = "Password" id = "Password" size = "15"
maxlength = "15" tabindex = "1" />
</tr>
<tr>
<td>
<input type = "submit" value = "Login" tabindex = "2" />
</td>
</tr>
<tr>
<td>
<p>To register go to the <a href = "register.cgi"> registration</a>
page.</p>
</td>
</tr>
</table>
</form>
BodyHTML
print end_html;

my $dbh = DBI->connect("DBI:m ysql:database:l ocalhost","its" ,"root",
{ RaiseError =1,
AutoCommit =1 }) or &dienice("Ca n't connect to database:
$DBI::errstr");

my $UserName=param ('UserName');
my $Password=param ('Password');
my $sth = $dbh->prepare("selec t * from User_Login where User_Name
= ?") or &dbdie;
$sth->execute($UserN ame) or &dbdie;
if (my $name = $sth->fetchrow_hashr ef)
{
my $sth = $dbh->prepare("selec t * from user_Login where root = ?") or
&dbdie;
$sth->execute($Passw ord) or &dbdie;
if (my $pass = $sth->fetchrow_hashr ef)
{
print redirect(- location=>"inde x.cgi");
}
else { &dienice(qq( The password is invalid. Go to the <a href =
"passreset.cgi" >password reset</apage to reset your password.)); }
}
else { &dienice(qq(Use rname does not exist. Go to the <a href = "
custreg.cgi">re gistration</apage to register.)); }
$dbh->disconnect;
print end_html;

sub dienice {
my ($msg) = @_;
print "<h1>$msg</h1>";
exit;
}

sub dbdie {
my ($errmsg) = "$DBI::errstr<b r />";
&dienice($errms g);
}
Sandip B Bhosale.

Apr 27 '07 #1
0 6488

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
4869
by: Ghazan Haider | last post by:
I am posting this for the lack of a better newsgroup, and for the knowledge of people here, and because its only partially OT. We have a bunch of users with their computers at work. There are reports that the users need, which could be in html, php, asp, jsp, whatever. Now I am trying to eliminate the login window entirely. In an html request, the client (firefox, ie, etc) sends the clients hostname, IP, a bunch of other stuff, but...
4
16277
by: dschruth | last post by:
Hello. Can anybody solve this problem? I am using a server-side language (PERL) to *try* to POST data to a HTTPS login script that doesn't have a standard "submit" button. The form appears to use javascript to submit the document via the browser's DOM. <form action='loginScript.cgi' method="post" name="loginForm">
1
3029
by: james2 | last post by:
I am trying to write a perl script that will do remote machine. I have done user loging using simple command; $telnet->login('test', 'test123'); But now I want to do root login or superuser login. So I tried the superuser command, $telnet->cmd("su"); But I am not able to send the password , like,
6
2116
by: joe t. | last post by:
The subject may sound a little cryptic, so i'll try my best to explain. Details are unavailable, as i am under a nondisclosure agreement, but i'm looking for general principles and tips, not necessarily fixes for existing code. There is a website that requires me to log in using a web-form. Obviously, POST vars are sent and verified and on success i'm given a Session and/or Cookie. Within this logged-in area, there are links leading to...
3
2674
by: Hari Sekhon | last post by:
Hi everyone, I want to create a test that will do a proper login test to a web site but I need some pointers. I need to login to the website by accessing an https url and posting to that, which should return a very small 302 reply with the address of the internal page. I need to take that page href and then access it, if I can do all that then the test passes. Of course because I have to access two urls I also need cookies for session...
3
5405
by: focussys | last post by:
hi i am a student and am doing this for one of my assignments i am trying to create a login using perl and mysql database.i was succesful in doing that now i want to use cookies for authorisation how can i do this
4
8589
by: Freedolen | last post by:
Hi All, I had a perl script which is used to login in a web page, but it gives the error as "301 Moved Permanently". What does this means and how can it be rectified? Can anyone help on this? Code Snippet: use HTTP::Cookies; use HTTP::Request;
6
5508
by: sherrygomindes | last post by:
Hi I have written a perl script using the Telnet module. I need to remotely login in from one windows XP machine to another XP machine. But i get errors which i can't figure out the reason. Please someone help me its very very urgent. here is my code: #!/usr/bin/perl -w
12
3065
by: tvnaidu | last post by:
I have Two kinds of web pagess, one is for control page for only admin login, another one is to view status for user login. initially both html files can view with 192.168.0.10/control.htm and other file is 192.168.0.10/status.htm. I searched on Internet and I got some login code. this login comes when I give 192.168.0.10, then I gets login page, I can login with admin/admin, also I can login with user/user, once login, the corresponding page...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8097
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.