How do I protect 1 .php page on a project behind a password?

Issues related to forms.
Post Reply
User avatar
etcbbu
 
 
Posts: 460
Joined: Mon Apr 23, 2007 3:00 pm

How do I protect 1 .php page on a project behind a password?

Post by etcbbu »

Hello all,

I have a potential client who wants to have a single .php page on our project that is password-protected, such that only about 5 people (who we have given a password to) can log-on and see this page.

How can I do this with the Form/or Login tools with WB?
https://ktravisj.com

Travis J Consulting, LLC
⚫️Website Design/Development/Maintenance
⚫️Web-Marketing/Social Media
⚫️SEO/Search Engine Optimization

https://ktravisj.com
User avatar
etcbbu
 
 
Posts: 460
Joined: Mon Apr 23, 2007 3:00 pm

Re: How do I protect 1 .php page on a project behind a password?

Post by etcbbu »

I am trying to use the "Login" object, within my WYSIWYG Web Builder .WBS file right now, and I have gone into its "Properties" and chosen that I would like to use the MySQL method to have users, but when I am at the point where I need to fill in

MySQL Database Name
MySQL Password
MySQL Server
MySQL Table Name
MySQL Username

I filled out all of them except for MySQL Table Name, because, when I created a new MySQL Database from within my Web-Host, it gave me all of these details. But, I do not know what to fill in for "Table". Do I just need to go to phpmyadmin from my host, and create a table that way?

Because, when I click the "Create Database" button, from within the "Login" Object Properties within my WYSIWYG Web Builder software, and the dialogue box says, "Please use the following SQL statement to create the MySQL table on the server", and then has this code:
CREATE TABLE `` (
`id` int(10) NOT NULL auto_increment,
`username` varchar(50) NOT NULL,
`fullname` varchar(75) NOT NULL,
`password` varchar(50) NOT NULL,
`email` varchar(75) NOT NULL,
`active` tinyint(1) NOT NULL,
`code` varchar(75),
`role` varchar(50),
`avatar` varchar(50),
PRIMARY KEY (`id`));
whenever I go to the phpmyadmin in my MySQL Database from within my web-host, and I clicked "SQL" at the top of that page, and I pasted the code into that first text-box, and then clicked the "Go" button, it seems like phpmyadmin gave me this error:
Error
SQL query:


CREATE TABLE `` (
`id` int(10) NOT NULL auto_increment,
`username` varchar(50) NOT NULL,
`fullname` varchar(75) NOT NULL,
`password` varchar(50) NOT NULL,
`email` varchar(75) NOT NULL,
`active` tinyint(1) NOT NULL,
`code` varchar(75),
`role` varchar(50),
`avatar` varchar(50),
PRIMARY KEY (`id`))
MySQL said: Documentation

#1103 - Incorrect table name ''
I know I am doing something wrong, but, I just don't know what. Just trying to fill in what I need to fill in and follow instructions correctly.

Am I supposed to be putting some sort of name in-between the two " ' " marks on the SQL statement? And then whatever I put as the name there, go back over to that "MySQL Table Name" field from within the Login Object Properties and put that same table name there?
https://ktravisj.com

Travis J Consulting, LLC
⚫️Website Design/Development/Maintenance
⚫️Web-Marketing/Social Media
⚫️SEO/Search Engine Optimization

https://ktravisj.com
User avatar
etcbbu
 
 
Posts: 460
Joined: Mon Apr 23, 2007 3:00 pm

Re: How do I protect 1 .php page on a project behind a password?

Post by etcbbu »

Ok, so, update, I did this thing:
Am I supposed to be putting some sort of name in-between the two " ' " marks on the SQL statement? And then whatever I put as the name there, go back over to that "MySQL Table Name" field from within the Login Object Properties and put that same table name there?
and I just called it

table

so I put that in the SQL statement, in between the two ' marks, and it seemed to create the table. And then, on "MySQL Table Name", I also put the exact same string

table

So, I'm guessing, if I publish this, that's all well and good.

But, now, how do I actually edit peoples' usernames? I did what the Help topic said, where I created a new table called "USERS", by copying/pasting this:
CREATE TABLE `USERS` (
`id` int(10) NOT NULL auto_increment,
`username` varchar(50) NOT NULL,
`fullname` varchar(75) NOT NULL,
`password` varchar(50) NOT NULL,
`email` varchar(75) NOT NULL,
`active` tinyint(1) NOT NULL,
`code` varchar(75),
`role` varchar(50),
`avatar` varchar(50),
PRIMARY KEY (`id`));
into my SQL, within phpmyadmin, and it seemed to have created that "USERS" table! But, I mean, so do I use the "Insert" link, in phpmyadmin, and just fill things out that way, each time we want to add a user?

Because, I tried doing that, and just filled in a made-up username, and made-up full name, a password, and an e-mail address; so I filled in those four strings, and clicked "Go" in phpmyadmin . And it shows me as a record, there, in the table. But, when I then go to my live-active WB-page where I put the "Login" object an attempt to use this username and password, it doesn't work. Now, I left all of the "FUNCTIONS" fields, empty, on each of these four fields I filled-in to create this test-record to try a login. Do I need to set the "FUNCTIONS" to something, on these username, full name, password, e-mail fields?
https://ktravisj.com

Travis J Consulting, LLC
⚫️Website Design/Development/Maintenance
⚫️Web-Marketing/Social Media
⚫️SEO/Search Engine Optimization

https://ktravisj.com
User avatar
Pablo
 
Posts: 21585
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: How do I protect 1 .php page on a project behind a password?

Post by Pablo »

But, I do not know what to fill in for "Table".
The default value is 'USERS'

If you do not enter a value then the SQL query will not be valid.
But, now, how do I actually edit peoples' usernames?
You can use the Admin tool to create users.

See this related tutorial:
http://www.wysiwygwebbuilder.com/login_basics.html
User avatar
etcbbu
 
 
Posts: 460
Joined: Mon Apr 23, 2007 3:00 pm

Re: How do I protect 1 .php page on a project behind a password?

Post by etcbbu »

I can use the admin tool even though I used MySQL for this one? I thought that page and the help topics all seemed to be saying that the admin tool is only for use with the flat-file method?
https://ktravisj.com

Travis J Consulting, LLC
⚫️Website Design/Development/Maintenance
⚫️Web-Marketing/Social Media
⚫️SEO/Search Engine Optimization

https://ktravisj.com
User avatar
etcbbu
 
 
Posts: 460
Joined: Mon Apr 23, 2007 3:00 pm

Re: How do I protect 1 .php page on a project behind a password?

Post by etcbbu »

Here are some screens to illustrate what seems to be happening for me, right now:

https://www.ktravisj.com/ipstest/scrn1.png

And when you go here:

https://www.ktravisj.com/ipstest/index.php

and try those logins, it doesn't work.
https://ktravisj.com

Travis J Consulting, LLC
⚫️Website Design/Development/Maintenance
⚫️Web-Marketing/Social Media
⚫️SEO/Search Engine Optimization

https://ktravisj.com
User avatar
Pablo
 
Posts: 21585
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: How do I protect 1 .php page on a project behind a password?

Post by Pablo »

I can use the admin tool even though I used MySQL for this one?
Yes
I thought that page and the help topics all seemed to be saying that the admin tool is only for use with the flat-file method?
The admin tool is for both MySQL and flat file.

You cannot manually edit the database because the password is hashed. You will need to use the admin tool to create users.
Post Reply