el_makong Posted November 10, 2015 Share Posted November 10, 2015 Hi, How do i generate generic text file when account is created and only available for download by the client having that service? using fopen to write the file then what should i do? stored in /download folder? Thanks 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 11, 2015 Share Posted November 11, 2015 If you need to restrict access to these files, you have to save it outside of the website public directory just how you did with WHMCS writable folders (downloads, templates_c, etc). Save filename with the related clientID in database (create new table for that). make new function inside your module or new page in client area, this page will be responsible for the client validation and download, so when your client click on the download link inside "Product Details" page, Email message etc the URL will be that page, it will check if the current client own the right to access/download this TXT file. is that clear enough? 0 Quote Link to comment Share on other sites More sharing options...
el_makong Posted November 11, 2015 Author Share Posted November 11, 2015 yeah.thats clear and solving my 2nd question.so i just need to create client validation for the download function in my module. what if the admin need to download it from admin area?same function?or the validation user & admin? still unanswered, how do i create text file with a template. or maybe from module configuration(where the admin can customize it) 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 11, 2015 Share Posted November 11, 2015 yeah.thats clear and solving my 2nd question.so i just need to create client validation for the download function in my module.what if the admin need to download it from admin area?same function?or the validation user & admin? for the admin side, you can only check if admin is logged in then download any file requested by this admin. still unanswered, how do i create text file with a template. or maybe from module configuration(where the admin can customize it) using fopen function you can read the content from template file, maybe apply some changes to it, and create new file. 0 Quote Link to comment Share on other sites More sharing options...
el_makong Posted November 11, 2015 Author Share Posted November 11, 2015 for the admin side, you can only check if admin is logged in then download any file requested by this admin. by using $_session? using fopen function you can read the content from template file, maybe apply some changes to it, and create new file. using preg_replace?or can i use smarty?so the template is stored as .tpl file 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 12, 2015 Share Posted November 12, 2015 by using $_session? yes, $_SESSION['adminid'] using preg_replace?or can i use smarty?so the template is stored as .tpl file yes for both 0 Quote Link to comment Share on other sites More sharing options...
el_makong Posted November 12, 2015 Author Share Posted November 12, 2015 thank you for your response, will try. if i got stuck again, i will post here 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.