Need help with htaccess to multiple directories
Posted: Mon Sep 06, 2004 6:41 pm
feyd | Please use
What I would like to do is have a protected directory for each of my clients based on the user entered field for their user name and then direct them to the password protected directory based on the same name. I am surmising that I should be able to do this by modifying the variable:
to something like:
but this is not working, probably because of the syntax related to the forward slash between $domain and $user is incorrect.
In another BB it was suggested to me that the correct syntax for the above line would be:
but this produces the folowing error:
Parse error: parse error, unexpected T_STRING in /home/ehamburg/public_html/clients/phplogin.php on line 27
Please note that this code is contained is contained in a file named phplogin.php and is called from a web page with the entry form for the user ID and password with the following code:
Any help in getting me pointed in the right direction is appreciated.
feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I am a novice scripter. I am trying to create a section on my website where I can validate various clients and direct the to web page with work product for their various engagements I have with them. I downloaded the following script from hotscripts.com and can get it to work with appropriate modifications to the variables to validate to a single directory:Code: Select all
<html>
<?php
#############################################
# PHP/Htaccess login made simple #
# #
# This script made by AvidNewmedia © 2004 #
# #
# This script will work with any htaccess #
# protected directory. It will also work #
# with CPanel access for hosting companies #
# #
#############################################
// the domain variable is where you would place
// the directory or URL that is htaccess protected.
// Make sure you DO NOT use the trailing slash, and don't include "http" in the
// domain variable or it won't work.
#your domain or ip
$domain = "foo.com/foo";
// Get Variables and create a url
$user = $_GET['username'];
$pass = $_GET['password'];
$pre = "http://";
$goto = "$pre$user:$pass@$domain";
?>
<body onLoad="setTimeout('document.forms[0].submit();',2)">
<form action="<?=$goto?>" method="post">
<input type="hidden" name="user" value="<?=$user?>">
<input type="hidden" name="pass" value="<?=$pass?>">
<input type="hidden" name="login" value="login">
</form>
</body>
</html>Code: Select all
$goto = "$pre$user:$pass@$domain";Code: Select all
$goto = "$pre$user:$pass@$domain/$user";In another BB it was suggested to me that the correct syntax for the above line would be:
Code: Select all
$goto = '$pre' . '$user' . ':' . '$pass' . '@' .'$domain' . '/' . '$user';Parse error: parse error, unexpected T_STRING in /home/ehamburg/public_html/clients/phplogin.php on line 27
Please note that this code is contained is contained in a file named phplogin.php and is called from a web page with the entry form for the user ID and password with the following code:
Code: Select all
<div id="layer2">
<h3>Client Login</h3>
<form id="FormName" action="http://www.foo.com/foo/phplogin.php" method="get" name="Client Login">
<label>User ID: </label><input type="text" name="textfieldName" size="20"><p>
<label>Password: </label><input type="password" name="textfieldName" size="20"></p>
<p><button name="Submit" type="button">submit</button></p>
</form>
</div>
//feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]