Jump to content

toter

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

toter's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. toter

    COPY()

    you know the strange thing is that when i tried this before i used ftp url in the copy function. it worked only few times then pages started being blank. i thought maby too many ftp connections were being made? wierd well probally will have to talk to my providers. thanks every 1, TT
  2. toter

    COPY()

    [quote author=Daniel0 link=topic=112091.msg454814#msg454814 date=1161329254] Then try opening it with the w flag. Also try to run this file: [code]<?php header("Content-type: text/plain"); system('ls -l ..',$result); echo $result; ?>[/code] It should give you some rows like this: [code]drwxrwxrwx 49 www-data www-data 4096 Oct 19 15:16 www[/code] Paste it here. [/quote] this is what i got: (Censored: <username>) [code] <br /> <b>Warning</b>:  system() has been disabled for security reasons in <b>/home/<username>/public_html/leaders/tod/copy.php</b> on line <b>3</b><br /> [/code]
  3. toter

    COPY()

    [quote author=Daniel0 link=topic=112091.msg454805#msg454805 date=1161327626] Is safe-mode on? [/quote] ive tried this and it says no so safe-mode is off. [code]<?php if(ini_get('safe_mode')){echo "yes";}else{echo "no";}?>[/code] thanks everyone who has helped me out, tt
  4. toter

    COPY()

    [quote author=Daniel0 link=topic=112091.msg454808#msg454808 date=1161327758] If it is 777 then user, group and others all have read, write and execute permissions on the file, so it should obviously be writeable. Try to open it with fopen and see if it is possible. [/quote] k tried this: [code]<?php fopen("file.php", "r");?>[/code] got no errors
  5. toter

    COPY()

    [quote author=Daniel0 link=topic=112091.msg454805#msg454805 date=1161327626] Is safe-mode on? [/quote] safe-mode, how do i check/change that? *note i am on a company server not my own.
  6. toter

    COPY()

    [quote author=btherl link=topic=112091.msg454806#msg454806 date=1161327648] You might want to try this too: [code]print "I am in directory " . getcwd() . "\n"; print "My uid is " . getmyuid() . "\n"; print getcwd() . " is " . (is_writable(getcwd()) ? "writable" : "not writable") . "\n";[/code] It's possible that newfile.php exists and the permission problem is there.. [/quote] ok i got this: (Censored:<username>) I am in directory /home/<username>/public_html/leaders/tod My uid is 33300 /home/<username>/public_html/leaders/tod is not writable so this means i cant write files to this folder via copy right?
  7. toter

    COPY()

    that would make sense but i just now checked in cpanel and all files and folders are set to 777
  8. toter

    COPY()

    i am having trouble with the copy function. [code] <?php copy('file.php','newfile.php');?> [/code] produces an error: Warning: copy(newfile.php): failed to open stream: Permission denied in /home/cs115896/public_html/leaders/tod/copy.php on line 1 all my files and folders are set to 777. does any 1 know why this is? thanks in advanced, TT
  9. toter

    php HELP

    i am also having trouble with this simple bit of code: [code] <?php copy('file.php','newfile.php'); ?> [/code] i get an error of this: Warning: copy(newfile.php): failed to open stream: Permission denied in /home/<username>/public_html/leaders/tod/copy.php on line 2 but all my files and folders permissions are set to 777 any body know? thanks a bunch, TT
  10. questions: how are you having the users view there files? is it through a php web page? and are u using the database to keep track of all the uploaded files? please explain to me how you have this setup in grave detail because there are many routes i can take with this route 1: (files are managed by php not mysql) make page www.domain.com/members/login.php have the user login and redirect to www.domain.com/members/username/index.php this page alows members view account data, ect. to upload and view files make page www.domain.com/members/username/files/index.php this page will show the all the files in there "root" (root meaning: www.domain.com/members/username/files/) folder using the ftp_nlist() function (http://us2.php.net/ftp_nlist) and to create subfolders the mkdir() function (http://us2.php.net/manual/en/function.mkdir.php) will be used and to view the subfolders a page called index.php will be coppied to it so when the user look at his sub folder lets say "/root/music/" (www.domain.com/members/username/files/music/) the index.php page will show the contens of music and so on. uploading will be on every 1 of these index pages so to upload a page to /root/music/rock/ under music the user will click on view files (www.domain.com/members/username/files/index.php) then click on the music folder icon (www.domain.com/members/username/files/music/index.php) then click on rock (www.domain.com/members/username/files/music/rock/index.php) then click on Browse in the file field then click on upload. of course each an every time he clicks on a folder he will see the contents b/c of ftp_nlist(). AND of course each & every time before ftp_nlist() is executed a simple login check will be preformed to make shure that it is the user that is the viewing there own folder. route 2 is same as route 1 but instead the files are not organized by folder but by mysql (unless you store the file in database) and every file from every person can be stored in 1 location. advantages/disadvantages rt1 + are no mysql databases for the files - any one that knows the url can access the file but not the index.php so they wont know the contents of your folder but if 1 of your users were to want to use your site as a file server for someones site they can. rt2 + 1 "catch-all" file folder for all users or seperate if desired. + you can keep the "catch-all" folder hidden so no 1 can leach off of you. - if you use the database to store the actuall file (optional you still can use mysql for your files with out this) the databaese will gain in size fast witch may not be the best thing but it will insure that only a logined user can access no matter what. hope this helps, TT
  11. OOPS Wrong button hold on!! ok here is what id do login i would do something like this: [code] <?php //starts a session needs to be the first line session_start(); //check if user is logined if($_SESSION['login'] != 1){ ?> !---login form <form> <div align=center>Please login <input type="text" name="username"><br> <input type="text" name="password"> <input type="submit" value="Login"> </div> </form> <?php }else ?> [/code]
  12. or you can try this in your script: [code] if($_FILES['file_field_name']['size'] > 15728640){           echo "File is too big"; } else{           upload script } [/code]
  13. toter

    php HELP

    I am trying to copy a file using the copy function and when the page is loaded the coppied file is blank? [code] <?php // set up basic connection $ftp_server = "<host>"; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name = "<username>"; $ftp_user_pass = "<password>"; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // get contents of the current directory $path = $_SERVER['REQUEST_URI']; $path = "public_html" . $path; $contents = ftp_nlist($conn_id, $path); // Create Folder if user wants to if($_POST['action'] == 'Create'){ $dir_name = $path . $_POST['dir_name'] . '/'; ftp_mkdir($conn_id, $dir_name); $template_file = 'ftp://<username>:<password>@<host>/path/to/index.php'; $index_file =  'ftp://<username>:<password>@<host>/' . $dir_name . 'index.php'; copy($template_file,$index_file); } ?> [/code] thanks, TT
×
×
  • 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.