Jump to content

Osram

Members
  • Posts

    28
  • Joined

  • Last visited

Posts posted by Osram

  1. I have made a Php program that downloads an Inno setup installation file for installing a program. However, if I for one or another reason want to make a new download of the same Inno setup installation file, the previous file will still be found in the Download folder. Each of the downloads get a number in parenthesis, setup(1), setup(2), setup(3) etc. However, I wondered if it is posible to erase the previous file in the same process as I download a new one, so that however many downloads I do, there will all the time only be one occurence of this file in the Download folder.

    The download code is as follows:

    $exe = "Inno script/Test_setup.exe";
    	header("Content-Type: application/octet-stream"); 
    	header("Content-Disposition: attachment; filename=\"Test_setup.exe\""); 
    	header("Content-Length: " . filesize($exe)); 
    	readfile($exe); 

    Thanks in advance.

    Sincerely

     

  2. Ok, thanks. But one more thing: Is it then so that it's not possible to get any information about the client's system, like the Mac address or the PC name? I came across this code on the internet:

    $MAC = exec('getmac');
    $MAC = strtok($MAC, ' ');
    echo "Mac address is $MAC";

    I didn't get it to work. Again got the HTTP ERROR 500, while the the error_reporting didn't work neither.

  3. By the way, the error message for the second option:

    $keyhandle = reg_open_key('HKEY_LOCAL_MACHINE', 'Software\Microsoft\Cryptography\MachineGuid');
    $value = reg_enum_value($keyhandle,1);
    echo $value;

    is the following:

    Fatal error: Uncaught Error: Call to undefined function reg_open_key() in /customers/f/d/7/dmusic.com/httpd.www/dhvnd/dhru/test.php:10 Stack trace: #0 {main} thrown in /customers/f/d/7/dmusic.com/httpd.www/dhvnd/dhru/test.php on line 10

    and line 10 is

    $keyhandle = reg_open_key('HKEY_LOCAL_MACHINE', 'Software\Microsoft\Cryptography\MachineGuid');

     

  4. I am making some kind of licensing system and want to read a key value from the registry that identifies the PC of the client. I found some code on the internett, but which doesn't work, and I was hoping someone could explain me why.

    I want to read the key from the following address: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid. I am fully aware that this value can be changed, but I can use it anyway. 

    I have found two methods. The first is the following:

    $Wshshell= new COM('WScript.Shell');
    $data= $Wshshell->regRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid');
    echo $data;

    And this is the second one:

    $keyhandle = reg_open_key('HKEY_LOCAL_MACHINE', 'Software\Microsoft\Cryptography\MachineGuid');
    $value = reg_enum_value($keyhandle,1);
    echo $value;

    What am I missing to make these work, or are there other way to do it? 

    Thanks in advance.

    Sincerely

  5. Hi,

     

    Yes, now it worked. Thank you so much. I have actually been troubling with this for a long time, having been trying many similar scripts that didn't work, because I didn't know that you had to strip them for all the regular html stuff. So I'm very happy that I now finally made it.

     

    If I could just make more one more following up question.  In my web server I have to place the index file in my root directory, and I don't have access to any directory above or outside of the root. Do you have any other ideas how I possibly could hide the download file? One idea I have is to block the diretory listing with htaccess while using a long and complicated directory name, but maybe there could be better solutions?

     

    Best regards

  6. Thank you very much for your answer. I guess, however, I must be doing something wrong, because when running the script, I don't get the exe file downloaded to my download folder, but only some strange text appearing on my web-site window, beginning with

     

    MZ@ !L!This program cannot be run in DOS mode. $]Y

     

     

    I have called the exe file for Testprogram.exe and placed it in a directory called Testing.

     

    Here is the whole program:

     

    <!DOCTYPE html>
    <?php
    $exe = "Testing/Testprogram.exe";
    header("Content-Type: application/octet-stream");
    header("Content-Disposition: attachment; filename=\"Testprogram.exe\"");
    header("Content-Length: " . filesize($exe));
    readfile($exe);
    exit;
    ?>
    <html>
    <body>
    </body>
    </html>

  7. Hi

     

    I have a program that I want to distribute through the internet. The files of the program are packed in an exe installation file that I need to download to the users download tray. The only way I know to do this is by using an html form, like this:

     

    $file = "Progdirectory/installation-file.exe";
    echo "<form action=$file method=\"get\">";
    echo "<input type=\"submit\">";
    echo "</form>";

     

    The problem with this solution is that everything is open. One can go into the source script and find the installation file and its address and then later download it directly from the URL address field of the browser. This is not what I want. I want to have full control with the downloading of the program and at least save the users e-mail address in a database.

     

    I know I can use a htaccess file to prevent access to the program folder, but I don’t want the user to have to type in a username and a password in a system pop-up dialogue window. I want to control all possible authentications from my own php program.

     

    In addition, I also want another web-page to open when the file is downloaded. This web-page will contain instructions of how to install the program.

     

    If someone at least could give me some hints of how to resolve some of these issues, it would be greatly appreciated.

     

    Best regards

     

     

     

     

×
×
  • 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.