Jump to content

Login.php help


mtb211

Recommended Posts

Hey I asked this yesterday but i can not find the post

 

basically I have a joomla website, I have a link for customers... when they click it

I want the user to go to the correct folder pending on there user name...

 

http://punktewolke.de/kunden/each user

 

Here is the code I came up with but it doesnt seem to work for every user .. only one user at a time

 

does anyone see why this doesnt work?

 

<html>

<head>

<title>Unbenanntes Dokument</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

 

<body>

 

<?php

 

$dir = $uname;

$user = $_POST['user'];

$pass = $_POST['pass'];

 

// Aktuelles Verzeichnis ermitteln

$thisdir = str_replace(strrchr($_SERVER['SCRIPT_FILENAME'],'/'), '', $_SERVER['SCRIPT_FILENAME']);

 

// Gewünschtes Verzeichnis erstellen

$oldumask = umask(0);

mkdir($dir,0777);

umask($oldumask);

// Daten für .htaccess erstellen

$htaccess = 'AuthType Basic

AuthUserFile '.$thisdir.'/'.$dir.'/.htpasswd

AuthName "Geschuetzer Bereich"

order deny,allow

allow from all

require valid-user';

 

// Daten für .htpasswd erstellen

$htpasswd = $uname.':'.crypt($pw, substr(md5(uniqid(rand())), 0, 2));

 

// Testdatei erstellen (wird angezeigt beim erfolgreichen Login)

$handle = fopen($dir.'/index.php', 'w');

fwrite($handle, '

 

<?

echo "Hier sind die Bereitgestellten Dateien<br><br>";

$action=opendir("./");

while($datei=readdir($action)){

if(!preg_match("!(\.|\..)$!", $datei)){

if ($datei!="index.php" && $datei!=".htaccess" && $datei!=".htpasswd" ) {

echo "

<a href=\"$datei\">

 

$datei</a><br>"; } } } ?>');

fclose($handle);

 

// .htaccess erstellen

$handle = fopen($dir.'/.htaccess', 'w');

fwrite($handle, $htaccess);

fclose($handle);

 

// .htpasswd erstellen

$handle = fopen($dir.'/.htpasswd', 'w');

fwrite($handle, $htpasswd);

fclose($handle);

 

?>

</body>

</html>

 

Link to comment
https://forums.phpfreaks.com/topic/136364-loginphp-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.