password-protection

ZIP a file and protect with a password in PHP

删除回忆录丶 提交于 2019-12-17 19:53:59
问题 I'm having this code to zip files but i need to protect this file with a password $file = 'backup.sql'; $zipname = $file.'.zip'; $zip = new ZipArchive; $zip->open($zipname, ZipArchive::CREATE); ZipArchive::setPassword('123456'); //$zip->setPassword("123456"); $zip->addFile($file); $zip->close(); when i use $zip->setPassword i don't get any errors but the file is not protected at all and when i use ZipArchive::setPassword i get this error "Fatal error: Non-static method ZipArchive::setPassword

Set password on Zip file using DotNetZip

≡放荡痞女 提交于 2019-12-17 19:17:55
问题 I'm using DotNetZip to zip my files, but I need to set a password in zip. I tryed: public void Zip(string path, string outputPath) { using (ZipFile zip = new ZipFile()) { zip.AddDirectory(path); zip.Password = "password"; zip.Save(outputPath); } } But the output zip not have password. The parameter path has a subfolder for exemple: path = c:\path\ and inside path I have subfolder What is wrong? 回答1: Only entries added after the Password property has been set will have the password applied. To

Plain text password over HTTPS

你说的曾经没有我的故事 提交于 2019-12-17 17:34:06
问题 I'm currently working on a PHP OpenID provider that will work over HTTPS (hence SSL encrypted). Is it wrong for me to transmit the password as plain text? HTTPS in theory, cannot be intercepted, so I don't see anything wrong. Or is this unsafe at some level and I'm failing to see this? 回答1: It is safe. That's how the entire web works. All passwords in forms are always sent in plain text, so its up to HTTPS to secure it. 回答2: You still need to make sure you send it via POST request, not GET.

Easy way to password-protect php page

。_饼干妹妹 提交于 2019-12-17 10:14:16
问题 I have a page I want to password-protect. I've tried doing HTTP authentication, but for some reason it doesn't work on my hosting. Any other quick (and easy) way to do this? Thanks! 回答1: Not exactly the most robust password protection here, so please don't use this to protect credit card numbers or something very important. Simply drop all of the following code into a file called (secure.php), change the user and pass from "admin" to whatever you want. Then right under those lines where it

What is the best way to password protect folder/page using php without a db or username

爱⌒轻易说出口 提交于 2019-12-17 05:41:15
问题 What is the best way to password protect folder using php without a database or user name but using. Basically I have a page that will list contacts for organization and need to password protect that folder without having account for every user . Just one password that gets changes every so often and distributed to the group. I understand that it is not very secure but never the less I would like to know how to do this. In the best way. It would be nice if the password is remembered for a

Password protect a specific URL

主宰稳场 提交于 2019-12-17 02:21:23
问题 The site is on shared hosting. I need to password protect a single URL. http://www.example.com/pretty/url Obviously that's not a physical file path I'm trying to protect, it's just that particular URL. Any quick solution with .htaccess? 回答1: You should be able to do this using the combination of mod_env and the Satisfy any directive. You can use SetEnvIf to check against the Request_URI , even if it's not a physical path. You can then check if the variable is set in an Allow statement. So

Reading a password from std::cin

馋奶兔 提交于 2019-12-16 19:46:11
问题 I need to read a password from standard input and wanted std::cin not to echo the characters typed by the user... How can I disable the echo from std::cin? here is the code that I'm currently using: string passwd; cout << "Enter the password: "; getline( cin, passwd ); I'm looking for a OS agnostic way to do this. Here there are ways to do this in both Windows and *nix. 回答1: @wrang-wrang answer was really good, but did not fulfill my needs, this is what my final code (which was based on this)

How to password protect pdf programmatically in .NET?

情到浓时终转凉″ 提交于 2019-12-14 03:45:37
问题 I need to programmatically protect a PDF file with a password in C#. The same PDF file must be saved with different names and different password. Does anyone know a method for this (no expensive tools, please..)? 回答1: It can be done using itextsharp: using (var input = new FileStream("test.pdf", FileMode.Open, FileAccess.Read, FileShare.Read)) using (var output = new FileStream("test_encrypted.pdf", FileMode.Create, FileAccess.Write, FileShare.None)) { var reader = new PdfReader(input);

Regular Expression for Password

纵饮孤独 提交于 2019-12-14 03:37:32
问题 I need help creating a password regex. A password must contain at least 4 characters, letters (uppercase and lowercase), numbers and special characters - no spaces. msn like regular expression. 回答1: This regex works - see test data and output below: ^(?=.{4,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.* )(?=.*[@#$%^&+=i.,!?:;*/]) Test data in passwords.txt (only the first should pass): aB#1 aB #1 ab#1 AB#1 aB#a aB1a aB1 mac-osx> grep -P '^(?=.{4,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.* )(?=.*[@#$%^&+=i.,

Android - How to protect or delete an account when application is uninstalled?

左心房为你撑大大i 提交于 2019-12-13 15:43:06
问题 Following Udinic's blog shows us how to create our own authenticator and manage our own accounts. The problem is that if two applications try to manage the same account type, only the account authenticator of the first application will be used (and only the first application can access certain methods of the AccountManager). However, if the first application is uninstalled, then the second application's account authenticator takes its place and the second application has full access to the