Hey people Im going try to renovate my website using php/mysql scripts

4 Likes

Thanks I work on it tomorrow

Hey Thanks Greenreader9 It is working now, No more problems, I modified the connect.php a bit its a good thing I have GD Library PHP enabled, now its time to edit Style CSS

I’m trying password protect a upload music button so I can only upload it, I need help with htaccess and htpasswd the script is php/mysql

You can use the “Protected Directories” tool from the Client Area without the need to write .htaccess and generate a .htpasswd file which probably won’t even work on free hosting, but note that for it to work the secret pages you’re going to create should go to a separate folder, not to the same one the original code is in; else you’ll end up protecting the entire music player script. If you still want the upload page to be in the same folder as the script, you probably need to work out a database table with your user details on it and a log in page with a working session system, but that would be too complicated to explain here, so here’s a tutorial you could integrate with the upload page:

1 Like

I’m going to continue using infinity free, XAMPP makes it easy to edit on php/mysql scripts

I see in JavaScript no protection I will continue working tomorrow in Xampp and then upload the file when I can

@LukaszMusic2023 using javascript containing the password in plain text within the code is an extremely bad idea as anybody can view the page source code and get the details so this is no protection at all

what you need to do is what @JxstErg1 recommended

3 Likes

I have figured it out how to use .htaccess and .htpasswd to protect a single php file :slight_smile:

2 Likes

Well done :+1:

1 Like

I’m trying to protect a single page with htaccess and htpasswd I had sucess on xaamp but not much success with inifnityfree, I was able to protect it and gave me error 500 not found, after I enter the password, On Xaamp it works fine

AuthUserFile https://lukaszmusic1.is-great.net/MusicPlayer1/htpasswd.txt 
AuthType Basic
AuthName "You need to be authorized!!"
Require valid-user

<Files "upload_music.php">
Require valid-user
</Files>

I saw something wrong on the first line: AuthUserFile should be a full path to your .htpasswd file, NOT a remote URL for that file! So, to fix this, to formulate the full path to your file, you’ll have to find your hosting account’s home directory on the Client Area; after you found it, add /htdocs/MusicPlayer1/.htpasswd (if your domain isn’t pointed anymore to that folder, it should be /yourdomain/htdocs/MusicPlayer1/.htpasswd; obviously you’re better off renaming htpasswd.txt to .htpasswd to try this out). After my explanation, here’s how the first line should look like after these changes:

AuthUserFile "{home directory}/htdocs/MusicPlayer1/.htpasswd"

To try this out, replace {home directory} with the home directory you found on your hosting account’s page on the Client Area.

2 Likes

I am still getting 500 error

# set variable NO_PASS if URI starts with /test/page/
SetEnvIfNoCase Request_URI "https://lukaszmusic1.is-great.net/MusicPlayer1/upload_music.php/" NO_PASS

# Allow NO_PASS but ask for password otherwise
AuthType Basic
AuthName "My Protected Area"
AuthUserFile {/home/vol1_7/infinityfree.com/info here}/htdocs/MusicPlayer1/.htpasswd
Require valid-user
Satisfy    any
Order      deny,allow
Deny from  all
Allow from env=NO_PASS

The curly brackets were just to indicate it’s a placeholder, they are not part of the actual path. The right directive should look like:

AuthUserFile /home/vol1_7/infinityfree.com/if0_12345678/htdocs/MusicPlayer1/.htpasswd
3 Likes

I’m going to use php/mysql simple login script, I installed the script on Xaamp I have and it works amazing the script here is the link, the script worked on Xaamp and I hope it will work on infinityfree I will install the script when I have time, see ya later everyone

Here is git hub

GitHub - codingWithElias/Login-System-PHP-and-MYSQL: Login System Using PHP and MYSQL

1 Like

DO NOT use that software! It stores passwords in plaintext (NEVER do this, if you get hacked all of the passwords are exposed)!

5 Likes

then what software am I supposed to use?

You discovered WordPress before, starting from it is a good idea.

3 Likes

It depends on what you want to do and your technical skill (or willingness to learn).

A standalone login system is not particularly useful for anything more than a demo. For anything resembling a real site, I would suggest to choose either:

  • A fully features CMS (like WordPress), which can either do everything you need already, has plugins to do what you need, or for which you can create a plugin yourself.
  • Use a well known framework, like CodeIgniter or Laravel, that lets you build your own website features, while still taking care of some of the heavy lifting, like authentication and authorization.
  • Develop your website completely from scratch. This is the most difficult and probably not the most efficient, but if you want to learn, this is a good way to start. Be sure to educate yourself on how to do authentication properly and apply those lessons yourself.

Going for just a login system is not a good idea. Going for a login system that someone probably hacked together in an afternoon is a very bad idea.

3 Likes