Jump to content

jj20051

Members
  • Posts

    201
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jj20051's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Could you comment your code any better? I had a hard time figuring out what your trying to get it to do... It looks like your trying to get it to pull a random image out of the database and display it along with a next button? If thats the case let me know.
  2. $current_path_array = explode('/', $current_path); $current_path_array = array_filter($current_path_array); echo '/'; foreach($current_path_array as $variable){ $cp = $cp.'/'.$variable; $variable = stripslashes($variable); echo '<a href="filemanager.php?open='.$cp.'">'.$variable.'</a>/'; } Figured it out using an array, a for each and a static variable. Thanks for the help
  3. Here is some example code: <?php $img = $_GET['img']; if($img != NULL){ // Mysql query } ?>
  4. You would add the first part ($_SESSION['username'] = $_POST['username'] after // if login is ok then we add a cookie and the second part goes on the pages you want to protect.
  5. What is your database structure? Try this: $set = mysql_query("UPDATE comments SET matserviewed='yes' WHERE threadid='$t' AND matserviewed='no' AND originalpostby='$username'") or die(mysql_error());
  6. There are 2 pieces: 1 ~ create a session variable and 2 ~ check for a session variable. So as an example when you've checked the user's username/password to see if they are correct set the username into a session: $_SESSION['username'] = $username; Then on the pages you want to prevent users who aren't logged in you'd use the code: $username = $_SESSION['username']; if($username != NULL){ // This is where your protected page's code belongs } else { // If the user isn't logged in take them to the login page instead header("Location: login.php"); }
  7. Well that sort of solves 1/2 my problem, but I need two things: The name of the folder and the path to the folder. So with that I can separate the name of the folder... any ideas for the path?
  8. Ok so I'm coding up a file tree for a script and I've got the system setup so that when a user clicks on a folder it adds that folder to the path. The path is stored in a variable, but I'd like to allow the user to be able to go down multiple directories at once. To do this I'm going to seperate each folder name in the path and link to it so as an example: $path = './home/public_html/folder1/folder2'; how can I separate each of those so I can make a link to that folder so that: /home goes to $path = './home/'; /public_html goes to $path = './home/public_html'; etc... --- Basically just seperate the slashes into an array and seperate each of them off based on how far along it is but I don't know how to do that...
  9. Thank you Adam... that did exactly what I was looking for it to do It appears that linux sends back the \n even though it looks like a space...
  10. Its outputting the following in html: <br>t1.sh t2.sh t3.sh test.sh Which means it thinks there is only one row in the array or something?
  11. I have a script that connects to another server to pull data... When it pulls the data it comes back in the following format: t1.sh t2.sh t3.sh test.sh However using the code bellow does not separate it like it should, it should put one file per line but I think I did something wrong... // Pulls the output from the server: $var_test = $ssh->exec('./test.sh'); // Explodes it... $var_test2 = explode(" ", $var_test); // Echos it one per line... foreach ($var_test2 as $variable) { echo '<br>'.$variable; }
  12. Thank you, I misunderstood exactly how it worked... That fixed it thanks
  13. Alright so I have some code for pagination... the problem is on the middle pages it will display double the number of results... (IE if its supposed to display 5, it displays 10) // Number of messages per page: $user_message_number = 5; $page = $_GET['page']; if($page <= 1){ $low = 0; $high = $user_message_number; } else { $low = ($page - 1) * $user_message_number; $high = $page * $user_message_number; } $messages = mysql_query("SELECT * FROM messages WHERE recipient='$user_id' ORDER BY id DESC LIMIT $low, $high") or die(mysql_error()); while($pull_messages = mysql_fetch_array($messages)) { // Displays content } That's all of the code that would directly effect the outcome... Any thoughts/comments/suggestions are greatly appreciated.
  14. I was wondering how you would go about separating words with commas between them into an array. In this case I want users to be able to message multiple other users by entering their names in the following format: user1, user2, user3, user4 and then have php separate those into an array so I can then run them through a foreach(); so they can be sent to the correct users... Any help or functions I should look into would be great... code not necessary, just point me in the right direction thanks!
  15. I'm attempting to create a file manager in php for a "free webhosting company," however before I begin I was wondering what you guys would recommend as far as security and permissions settings. I would like to make sure that no one user can edit another user's files (even with their own scripts) and I'd like to know exactly what I'll need to do to make sure only my script can access all of the files in the user directories. As an example: I want to make sure my script can edit files on user accounts only if they are logged in... I'm not exactly sure how to prevent users from accessing files that aren't theirs with their own php scripts. I was looking at: http://forums.mydigitallife.info/threads/23790-Apache-Restrict-Folder-Access but I'm not sure if that will work, if it would then I'll just place that in the directory between the user's folders
×
×
  • 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.