Help With CGI Scripts and .htaccess


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help With CGI Scripts and .htaccess
# 1  
Old 07-25-2002
Help With CGI Scripts and .htaccess

Hi everyone, I need help with writing a script that does the following:

a client/user goes onto my website, hits a link, it would pop up either
1. user name and password
2. password and directory name

and then after they enter the required info, it would take them to their own folder. So If I use Temp as a user and test as a password, it would go directly to temp folder. What is the easiest way to go about this? I have tried using .htaccess but that doesn't re-direct them to a particular folder, it would give access to a folder they click on. Help me out guys, and thanks. You guys are the greatest.
# 2  
Old 07-29-2002
You can give each user a folder and use .htaccess in that folder. For example, if the user is joe you might just create a joe directory and when they go to website/joe they will get the .htaccess generated BASIC AUTH. This is the easiest way.
# 3  
Old 07-29-2002
Quote:
Originally posted by Neo
You can give each user a folder and use .htaccess in that folder. For example, if the user is joe you might just create a joe directory and when they go to website/joe they will get the .htaccess generated BASIC AUTH. This is the easiest way.
Hi, would you know how to program something in html that has a box which after they enter whatever number xxxx in that box, writes it into the address box of the browser or links them...such as www.test.com/reports/xxxx

www.test.com/reports
Code:
-------------------------
|                             |
| Enter Group #     | 
|       ________      |
|      |__xxxx__|     |
|                             |     
|                             |      
-------------------------
           |
           |
           |

www.test.com/reports/xxxx

thanks.

added code tags for readability --oombera

Last edited by oombera; 02-19-2004 at 02:34 PM..
# 4  
Old 07-29-2002
You might be able to do with with a script that does an HTTP Redirect. If I was going to do it, I would try coding in PHP, capture the text, create the URL and send an HTTP redirect to the browser.
# 5  
Old 07-29-2002
i don't know how to code in PHP, would you code it for me if you have the chance, it shouldn't be to hard, right? thanks if you can do it for me.
# 6  
Old 08-01-2002
Hammer & Screwdriver

OK! You can use .htacces and .htpasswd...

Example your web folder is /home/your_name/html

First you need creat .htpasswd

[binhnx2000@localhost /]# htpasswd -c ./users binhnx2000
New password: pass
Re-type new password: pass
Adding password for user binhnx2000

Have a file is name "user" was creat. It save your password was crypt. You change name to .htpasswd

Now! you need creat .htaccess with content:

AuthName "Restric Area"
AuthType Basic
AuthUserFile /home/your_name/html

require user binhnx2000

# If you use Apache Server, let's add line in file
# To restric down file .htaccess and .htpasswd from Server

<files .htaccess>
Order allow,deny
Deny from all
</files>

<files .htpasswd>
Order allow,deny
Deny from all
</files>

Now! You need set CHMOD is 644 for .htacess and .htpasswd = = > After up 2 file to /home/your_name/html.

You have a message need password and username.

Good Luck

Last edited by binhnx2000; 08-01-2002 at 08:50 AM..
# 7  
Old 08-01-2002
Hammer & Screwdriver

With all Apache Version (have version Windows). You can use .htaccess and .htpasswd.

You need use this code to Crypt your passwd and creat .htaccess

...
$encpass = &encrypt($password);
...
sub encrypt {
my($plain) = @_;
my(@salt);
@salt = ('a'..'z', 'A'..'Z', '0'..'9', '.', '/');
srand(time() ^ ($$ + ($$ << 15)) );
return crypt($plain, $salt[int(rand(@salt))] . $salt[int(rand(@salt))] );
}

After crypt your password. You need creat .htpasswd with content:

Your_user:JNSQVx3F3/n0c = = > Your pass after crypt

Okies
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash scripts - CGI and ssh

Hi Everyone, I started looking at the possibility of making some of our bash scripts available through a web server using CGI and the simple ones works just fine. Now I need to execute remote commands using ssh but can't really get it to work. I got private keys all sorted. Must be ssh... (1 Reply)
Discussion started by: arizah
1 Replies

2. Shell Programming and Scripting

Perl cgi pages out of cgi-bin folder in WINDOWS

Hi team, I have a typical problem with cgi pages in apache webserver in WINDOWS I am able to execute(display) the pages that are saved in cgi-bin folder. But I am not able to execute the pages stored in htdocs or other folder other than cgi-bin folder. Could anyone please let me know how... (1 Reply)
Discussion started by: scriptscript
1 Replies

3. Shell Programming and Scripting

isset() PHP function in cgi bash scripts

Hi! Some minutes ago I've posted a question related with sed regexps because I need to catch information sended with forms with GET action. This is the post: https://www.unix.com/shell-programming-scripting/127800-regular-expression-sed.html But now I have a new question. Does cgi scripts have... (0 Replies)
Discussion started by: GagleKas
0 Replies

4. Web Development

User authentication for some Perl CGI scripts

Hi, I am trying to create a web interface with Perl CGI with 2 pages. The content of these pages is dependent on the user accessing it. Thus, I need some kind of authentication to identify WHO is logging in but I DO NOT WANT to be restricting the pages to a few. What is the best way to prompt... (8 Replies)
Discussion started by: garric
8 Replies

5. UNIX for Dummies Questions & Answers

How to share CGI Scripts across UNIX web server?

Hi, is it possible to create a CGI folder somewhere on the server and allow all domains on that server be able to access the scripts? I tried a ScriptAlias addition in httpd.conf but still no luck. Would greatly appreciate any tips! Thanks. Linux version 2.4.20-021stab028.3.777-enterprise Plesk... (5 Replies)
Discussion started by: karlsworld
5 Replies

6. Shell Programming and Scripting

How to share CGI Scripts across UNIX web server?

Hi, is it possible to create a CGI folder somewhere on the server and allow all domains on that server be able to access the scripts? I tried a ScriptAlias addition in httpd.conf but still no luck. Would greatly appreciate any tips! Thanks. Linux version 2.4.20-021stab028.3.777-enterprise Plesk... (1 Reply)
Discussion started by: karlsworld
1 Replies

7. Programming

Perl CGI Scripts

I need to create a webserver to run Perl CGI Scripts. Anyone have any ideas or good links? Yes I know there are lovely programs out there, but I need to build one in C. Thanks! (1 Reply)
Discussion started by: cb.mark
1 Replies

8. UNIX for Dummies Questions & Answers

Howto locate locally installed Perl module for a CGI script in APACHE .htaccess

Hi, I have the following simple CGI script, just containg header: #!/usr/bin/perl -w use CGI ':standard'; use lib "/home/myname/lib/perl5/site_perl/5.8.5/"; use Mail::Sendmail; I also have included this directive in ~/public_html/.htaccess : SetEnv PERL5LIB... (0 Replies)
Discussion started by: monkfan
0 Replies

9. Shell Programming and Scripting

CGI passing arrays/hashes to another CGI script

If I have a Perl CGI script (script01), which fills an array(s) with information and outputs a HTML page with a link to another CGI page (script02); is there anyway to pass the array(s) from "script01" to "script02" when the page visitor clicks the link? Hope that makes sense! :) (2 Replies)
Discussion started by: WIntellect
2 Replies
Login or Register to Ask a Question