Using a script to check the login and username (html)


 
Thread Tools Search this Thread
Top Forums Programming Using a script to check the login and username (html)
# 1  
Old 03-15-2010
Tools Using a script to check the login and username (html)

I made this named "confirm.sh":
Code:
#/bin/sh
#username and password are already given by the login form
if [ -s /home/alex/Desktop/Myfirstsite/allusers/$username ]; then
realpass=`cat /home/alex/Desktop/Myfirstsite/allpasses/$username`
if [ "$password" = "$realpass" ]; then
#continue with index.html
else
echo "Bad password"
fi
else
echo "Unknown username"
fi

because I wanted to make a program that checks if the clues given in the login form like this:
Code:
<table cellpadding=5 cellspacing=0 border=0>
<td style="padding:30"><br>
<form method="post" action="./confrim.sh" name=pform>
<input type="hidden" name="action" value="login">
<input type="hidden" name="user" value="deluxe">
<input type="hidden" name="hide" value="">
<table>
<tr><td><font style="font-family:times;color:Red" face="verdana,arial" size=-1>username?</td><td><input type="text" name="login"></td></tr>
<tr><td><font style="font-family:times;color:Red" face="verdana,arial" size=-1>pass?</td><td><input type="password" name="password"></td></tr>
<tr><td><font  style="font-family:times;color:Red" face="verdana,arial" size=-1>&nbsp;</td><td><font face="verdana,arial" size=-1><input type="submit" value="Enter"></td></tr>
<td colspan=2><font face="verdana,arial" size=-1>&nbsp;</td>
</table>
</form>
</td></tr></table></td></tr></table>
<tr><td colspan=2><font style="font-family:times;color:Red" face="verdana,arial" size=-1>DNot a member? click<a href="./register.html">HERE</a> to become</td></tr>
</html>

As you can see I have selected to start confirm.sh on click.In fact, when I click, the only thing it does is to download confirm.sh to my download folderSmilieSmilieSmilie.How can I told to the html code to call confirm.sh only to confirm the username and the pass? Or, could you suggest me a better way on hoe to do this?(I think I should use <script> but I am not so sure how to use it...)
Sorry for the (maybe) to big answers you meed to write but I am tottaly new to html and so it is quite difficult for me to understand how I have to think.I can use unix scripting quite easily so you dont need to explain me further on this issue!
# 2  
Old 03-15-2010
you should use some cgi,php,jsp to accomplish such things
if you want the script to be executed you can do that from the above php...etc
they have inbuilt command to call a system command.

intially u need webserver apache, php ..

my prefernce is lamp,xamp,or wamp


use php to do that

Login PHP Script - Login PHP - Free Login PHP Script
# 3  
Old 03-16-2010
Contrary to what phoenix_nebula said, it is possible to write CGI applications using shell scripting. But it's hard, as you don't have any of the nice features of other languages (like Perl or PHP) at your disposal, like parameter splitting, URL recoding, ...

For example, save this script as example.sh in your servers cgi-bin directory, make it executable for everyone, and then call it through the browser as http://localhost/cgi-bin/example.sh?param1=value1&param2=value2&param3=value%203
Code:
#!/usr/bin/ksh

echo "Content-Type: text/plain; charset=US-ASCII"
echo
export LANG=C

env

Somewhere in the output should be a line like this:
Code:
QUERY_STRING=param1=value1&param2=value2&param3=value%203

Those are your input parameters, which you'd have to split and decode yourself (in case you're wondering, %20 would be a space character).

If you really want to start on Web Development, start with simple HTML (without any CGI), then go on to CSS, maybe JavaScript, and only then a CGI language like Perl, PHP, Ruby, or Python (in no particular order).
# 4  
Old 03-17-2010
thx for your answers. I'll try them out!
# 5  
Old 03-21-2010
why don't you use apache authentication?
htpasswd
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Login failed username password is incorrect

Hi all, For one of our server (Windows 2008R2), we sometimes will received "login failed username password is incorrect" when login in as domain account (the username & password is correct). Only after a reboot of the server (using local account), we can login without the above error. Can... (2 Replies)
Discussion started by: beginningDBA
2 Replies

2. Shell Programming and Scripting

Check for Specific Username Password Expire

hey Guys, I haven't posted in a while, But you guys were really helpful alst time. I have had a issue with User Passwords expiring, and since I dont check /var/cron/log on the regular I never know these suers are expiring, making certain nightly jobs not run. With this script, I want to be... (14 Replies)
Discussion started by: gkelly1117
14 Replies

3. Shell Programming and Scripting

Simple check login script

Hello, I just started with shell and i am doin simple script to check if certain user is logged in. Script takes 3 args. name sleep time and quit value if there is q for quit then date and user name is printed to file, not to screen. so far i have got this... login() { while :... (3 Replies)
Discussion started by: shelllo
3 Replies

4. Shell Programming and Scripting

Javascript or HTML to retrieve apache username

I have a internal wesbite set up and any visitor must enter username / passwd as defined in apache (I've set these up using htpasswd) I use cgi scripts set up using ksh or javascript to populate pages / tables etc. I want to be able to get the apache username that the used authorised... (3 Replies)
Discussion started by: frustrated1
3 Replies

5. UNIX for Advanced & Expert Users

Login through SFTP using username and password

Hi All, I want to login to a server through SFTP by giving username and password, in an automated script. I know that this can be done through public key authentication, but my requirement is to login ONLY through username and password. I am using GNU/Linux server. Please advise me !!!... (4 Replies)
Discussion started by: sparks
4 Replies

6. Web Development

Login page in html on unix

I want to create a login page in HTML which is hosted on apache server. The login page first authenticate the user and then directed to a form which in turn run a script on the server. I want to make login page without php or jsp. Please advice. (13 Replies)
Discussion started by: ravi18s
13 Replies

7. Shell Programming and Scripting

trouble with outputting html to check vmfs volumes

Hi - I found a script on the web to check vmfs volumes on ESX servers and create an html file for the output. Sometimes the script works fine, but sometimes it seems to break at the "vdf -h -P" line. More often than not, when I run it myself it works - but when run from chron it usually fails. ... (2 Replies)
Discussion started by: kpowell10
2 Replies

8. Solaris

How to : check username & password is same or not in solaris 10 ?

Thanks AVKlinux (5 Replies)
Discussion started by: avklinux
5 Replies

9. Shell Programming and Scripting

Script to calculate user's last login to check if > 90 days

I need a script to figure out if a user's last login was 90 days or older. OS=AIX 5.3, shell=Korn Here's what I have so far: ==== #!/usr/bin/ksh NOW=`lsuser -a time_last_login root | awk -F= '{ print $2 }'` (( LAST_LOGIN_TIME = 0 )) (( DIFF = $NOW - $LAST_LOGIN_TIME )) lsuser -a... (3 Replies)
Discussion started by: pdtak
3 Replies
Login or Register to Ask a Question