DCP - A Download control panel/tracker and Auto-updating class

Discussion in 'Resources' started by Kalman Olah, Jul 7, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    cronikkk

    Found that function!!!

    PHP:
    function safe($s) {
       
    // removes words that contain sql syntax
       
    $s preg_replace(sql_regcase("/(from|select|insert|delete|where|drop table|show tables|#|\*|--|\\\\)/"),"",$s);
       
    $s trim($s); // strip whitespace
       
    $s strip_tags($s); // strip HTML and PHP tags
       
    $s addslashes($s); // quote string with slashes
       
    return $s;
    }
     
  2. Offline

    wwsean08

    so simple to set up, great work
     
  3. Offline

    Kalman Olah

    Glad you like it :)

    I have a bit of time today, so I'll try to finish DCP v2.0.0.
    Screencap of current version:
    View attachment 5346

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  4. Offline

    wwsean08

    The only suggestion I have (which I did on my own) is make it so the password field on the index is a password field and not a text field, but beyond that this is great
     
    DrAgonmoray likes this.
  5. Offline

    DrAgonmoray

    I agree
     
  6. Offline

    Kalman Olah

    Just did that :p.
     
  7. Offline

    wwsean08

  8. Offline

    Kalman Olah

    DCP v2.0.0 has been released. Because it is quite late, I didn't really have the time to add every little thing I wanted to add. However, the current release is ready for use, and I will be adding suggestions to DCP in the coming days. So remember to post feedback.

    You'll want to read the edited OP to set up DCP, as a lot of things have changed, including the auto-updater class and SQL structure.

    A screenshot of DPC v2.0.0 can be found here: http://kalmanolah.net/files/DCPscreens/capped.jpg .

    I would also like to note that DCP 2.0.0 is backwards compatible with <2.0.0, meaning that if you add a download to DCP 2.0.0 with the same name / dl.php & check.php file locations, your plugins should be able to keep auto-updating just fine.
     
  9. Offline

    DrAgonmoray

    @Kalman Olah

    Just upgraded to 2.0. First thing I noticed:
    On the login screen I get this error:
    Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in D:\BLABLABLA\DCP\web\includes\database.inc.php on line 22

    And after logging in, on the download page I get this:
    Code:
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Hosting\7814934\html\DCP\web\includes\database.inc.php on line 19
    Edit:
    Also looking at database.inc.php, it looks like you don't have a closing php tag (?>) :O

    Please fix it :( All my download links are down and I didn't save a backup of my old DCP.
     
  10. Offline

    Kalman Olah

    Did you fill in your config.inc.php? Did you remember to clear your MySQL database and to execute the new .sql file?
     
  11. Offline

    DrAgonmoray

    Yes and.. wat?
    If I clear it won't I lose all my download data? D:
     
  12. Offline

    Kalman Olah

    Yeah, you will. Hence why it's the "major 2.0.0 update" and not the "minor cosmetic update" :p.
     
  13. Offline

    DrAgonmoray

    i deem this misleading.

    Good bye downloads D:
     
  14. Offline

    Kalman Olah

    I was talking about the auto-updater. DCP 2.0.0 works with plugins that use the old auto-updater class, provided you recreate the download. You'll still want to release a plugin update containing the latest auto-updater class, though. I pretty much put the entire auto-update process in a try/catch block to make sure the plugin doesn't crash if the auto-updating fails.
     
  15. Offline

    DrAgonmoray

    Oh. But now the DL links aren't working.
    whyyy cruel world.

    http://livecraft.net/DCP/web/dl.php?id=WorldManager&ver=latest

    Just gives me a blank page. The download doesn't start either. But the download count does go up.

    @Kalman Olah

    After debugging your code, I found that
    PHP:
    if (file_exists('./files/'.$id.'-'.$row2["version"].'-'.$row2["filename"])) {
    Always returns false, so the download doesn't start. Then upon further inspection, the "files" folder is empty.
    Hmm

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  16. Offline

    Kalman Olah

    Did you remember to overwrite the dl.php too? There's a new one in the .rar.

    You have to CHMOD your /files/ folder to 777. I wrote this in the OP too :).
    EDIT: You'll have to remake your downloads after you do this, so the files actually upload.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  17. Offline

    DrAgonmoray

    I'm pretty sure I completely overwrote everything. I'll try again.

    Edit:
    DOH! The CHMOD thing AGAIN! it seems I never learn :)
     
  18. Offline

    drampelt

    I managed to add my plugin fine at version 0.1, but when I go to upload version 0.2, it doesn't show up. Should it upload automatically? I don't see a submit button for the form.

    EDIT: Nevermind, figured out you click add new download. *facepalm*
    EDIT (again): My plugin won't update itself.
    Code:
    16:37:39 [INFO] [Daisy] Initiating auto-update...
    16:37:40 [INFO] [Daisy] A new version of Daisy, v0.2 is available.
    16:37:40 [INFO] [Daisy] Starting download of Daisy v0.2...
    16:37:40 [INFO] [Daisy] Error while checking for latest version.
    16:37:40 [INFO] [Daisy] loading Daisy v0.1
    
    On my DCP web interface it says more downloads every time I try but it doesn't download it.
     
  19. Offline

    Kalman Olah

    Delete your downloads, CHMOD your /files/ folder to 777, and remake them.
    Currently the auto-updating doesn't work because the files haven't been uploaded properly. This is caused by you not having write permissions for the /files/ folder. You can solve this by setting folder permissions (CHMOD) to 77 for the /files/ folder. You will need to delete/remake your downloads in order for the files to get uploaded :).
     
  20. Offline

    drampelt

    I did that, chmod 777 the files folder, and re-added the files, 2 versions. It still gives me the same error when loading on server startup.
     
  21. Offline

    Kalman Olah

    go to http://<yoursite.com>/check.php?id=<yourDLname> and tell me what shows up.
    What you SHOULD see is "0.2&plugin.jar" or the like.
    EDIT: Go into the /files/ folder. Is there anything called Daisy-0.2-daiy.jar ?
     
  22. Offline

    drampelt

    Yes as well as 0.2.1 that I added. I edited your class to log the exception when it says error updating and I get this:

    [Daisy] java.io.FileNotFoundException: plugins/Daisy/update/Daisy-0.2.1-Daisy.jar (No such file or directory)
     
  23. Offline

    Kalman Olah

    I suppose this means it can't create the file. Make sure the server isn't located in C:/Program Files or something. Or CHMOD/CHOWN it if you're on Linux. Give me a moment to make sure I'm not having the same issue.

    Just checked for myself. No issues. Does the /plugins/Daisy/ folder exist?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  24. Offline

    drampelt

    No, the only thing in plugins is Daisy.jar
     
  25. Offline

    Kalman Olah

    Try creating a /Daisy/ folder in there, and see if it works.
     
  26. Offline

    drampelt

    Awesome, that worked. Any idea how to make the plugin generate that folder if it doesn't exist so other people that use it don't have to?
     
  27. Offline

    Kalman Olah

    Well, the class already generates the /update/ folder if it doesn't exist :p. I'll give it a shot :).

    http://kalmanolah.net/files/dl.php?id=DCP&ver=2.0.1

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  28. Offline

    drampelt

    One more quick question, could you make it (or show me how) so that once it downloads the update, it deletes the old file and replaces with the new?
     
  29. Offline

    Kalman Olah

    Just don't make it create a file in the name-version-filename format. Change it to the same file every time. Something like name.jar. If you need specifics, let me know
     
  30. Offline

    drampelt

    Sorry, fairly new to java. I have no clue how to do this :/
     
Thread Status:
Not open for further replies.

Share This Page