karthiksrinivas Posted April 28, 2009 Share Posted April 28, 2009 Hello My question is.. After a User is logged in he would be displayed with different menus like changepassword logout downloads etc. after clicking downloads it should display the contents of the directory that is assigned to the user example if tthe username is TEST in the server the directory structure /public_html/downloads/test/ when the user logs in and clicks the downloads file it should display the contents of Test folder please help me. Link to comment https://forums.phpfreaks.com/topic/155957-downloadsphp-file-should-display-a-specific-folder-assigned-to-a-username/ Share on other sites More sharing options...
trq Posted April 28, 2009 Share Posted April 28, 2009 Your code? Link to comment https://forums.phpfreaks.com/topic/155957-downloadsphp-file-should-display-a-specific-folder-assigned-to-a-username/#findComment-820964 Share on other sites More sharing options...
karthiksrinivas Posted April 28, 2009 Author Share Posted April 28, 2009 <?php $time = time(); // Check if there is a cookie, if there isn't then exit! if (!isset($_COOKIE['cookie_info'])) { echo "Cannot access this page: You aren't logged in"; exit; } // If there is a cookie, validate the cookie else { // Use Connect Script include("connect.php"); // Include the validation of user file include("validateuser.php"); // If user and password are correct if (validateuser() == true) { // Use cookie and Extract the cookie data (Username and Password) $cookie_info = explode("-", $_COOKIE['cookie_info']); $namecookie = $cookie_info[0]; $passcookie = $cookie_info[1]; // Get username from Database and it in a variable $query = mysql_query("SELECT * FROM userdata WHERE userid = '$namecookie'"); $nameuser = mysql_result($query,0,13); ?> <b> <font face="Arial">Change Password</font></b> <form action="passwordchanged.php" method="POST"> <?php // Display User Details echo " <table border='0' width='100%' id='table1' height='250'> <tr> <td width='115'><font face='Tahoma'>Username:</td> <td> <font face='Tahoma'>$nameuser</font></td> </tr> <tr> <td width='115'><font face='Tahoma'>Old Password:</font></td> <td> <input type='password' name='oldpassword' maxlength='15'/></td> </tr> <tr> <td width='115'><font face='Tahoma'>New Password:</font></td> <td> <input type='password' name='newpassword' maxlength='15'/></td> </tr> <tr> <td width='115'><font face='Tahoma'>New Password again:</font></td> <td> <input type='password' name='newpasswordagain' maxlength='15'/></td> </tr> <tr> <td width='115' height='44'> </td> <td height='44'> <input type='submit' value='Change Password'> </td> </tr> </table>"; ?> <?php $dirpath="V:\Core\htdocs\phpreg"; $dir="$dirpath\\$usernamelogin"; if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != ".htaccess" && $file != "test.php") { $list .= '<a href="'.$file.'">'.$file.'</a><br>'; } } closedir($handle); } ?> Files:<br> <?=$list?> Link to comment https://forums.phpfreaks.com/topic/155957-downloadsphp-file-should-display-a-specific-folder-assigned-to-a-username/#findComment-820973 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.