Jump to content

Osram

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by Osram

  1. Sorry, I don't quite understand what you mean. Is there something I can add to the Content-Disposition line?
  2. So how should one then intiate and make this dialog?
  3. 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
  4. 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.
  5. Ok, I understand. So there's no way to do this. Good to know. Thanks for your comments. Sincerely
  6. The client will enter information into a form and click ok. But it maybe doesn't help. But is there no way the php program could download an exe program to the clients PC that could read the registry and transfer the variable to a php variable?
  7. The code will be on the server of the host, and the client run it from a web-site they visit.
  8. I don't quite understand what you mean by that, as the PHP code can be hidden on the server. Can you explain some more?
  9. I went into https://www.php.net/manual and searched for it, and got the message that it doesn't exist. I got it from this web-site: https://www.sitepoint.com/access-the-windows-registry-from-php/ But at Stackoverflow: https://stackoverflow.com/questions/41800894/undefined-function-reg-open-key-in-php-7-0 I am told that I have to install win32std, but with no instruction how to do it.
  10. 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');
  11. Ok, but thanks anyway. I understood a little more. Sincerely
  12. No, I don't have anything else than just the script I've shown you. No class using require or include or any com file.
  13. Line 6 is $Wshshell= new COM('WScript.Shell'); I also now see that when I don't use the error reporting code, I get the message HTTP ERROR 500. Sorry, I overlooked it.
  14. After inserting the error reporting code, I got the following message: Fatal error: Uncaught Error: Class 'COM' not found in /customers/f/d/7/dmusic.com/httpd.www/dhvnd/dhru/test.php:6 Stack trace: #0 {main} thrown in /customers/f/d/7/dmusic.com/httpd.www/dhvnd/dhru/test.php on line 6
  15. I am not using any special IDE for editing php code. It's very seldom that I do programming in PHP. But it's maybe a good idea to get such a program anyway. As it is now, I only get the message that the page doesn't work.
  16. 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
  17. Well, I found the answer myself: You can have a deny all phrase in your htaccess file for a directory, and yet you can download a file from it. So this should be ok.
  18. 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
  19. 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>
  20. 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.