Tip:
Highlight text to annotate it
X
LivingLinks Case Study - Part III Using FileZilla
Here is a quick look at our file structure using FileZilla showing
what is on the hard drive and out on the server.
We are logged into the t.server
and you can see that I'm in public_html
I've set up a livingLink folder
and inside of it are all the .php files and the css files.
Remember when I talked about the passwordID.txt file?
We are going to take a quick look at this file.
You can see that the editAction.php
is going to go up one directory "..". It is really going to go up two directories "../.."
and I'm going to save that. I am fiddling around out on the server...
The editAction.php is going to go up one level
directory taking us into the public_html directory
and then it is going to go up a second directory
and there you can see the cgi-bin folder.
Look inside of that you can see the cciPass.txt file.
This contains the encrypted password. We will take a quick look at that
and it is just what we wanted to see.
Now, I'll go back to the main directory
into our public_html and livingLink folders.
Now the reason we do that, is
when people view the web pages, they can see what is
inside public_html, but they cannot see these files that are outside public_html.
So, by putting cgi-bin above public_html
in this directory above everything
this protects it from unauthorized users.
We have to go up two directories because we created another level/folder called livingLink
where we have all our files. So, when editCareer.php needs
to find that file, it has to go up two levels "../.."
Now, let's run our program
It is going to break because we don't have the right database name and userID
in it. I'll show you how it breaks and then how to fix it.
So, we are going to go out to
the website (http://)
and remember we are going to go into the livingLink folder.
And we are going to use the edit.php file.
Ahhh, the upper case caught me!
Livinglink with a lower case caught me.
Change that to a capital "L" and test the page.
You can see that we have been denied access.
for our localhost (which is out on the t.server, not the 'localhost' on your machine!)
So, if you go into the cPanel
(use https:// for secure server)
(use port :2083 at the end of the URL)
And, move down to the database section...
Scroll down to the User and Database Name section
We can see here that the user is peterjt_iamdata
and the database is named peterjt_career. (You won't have the t on your user name or database name.)
Our password is
the password you typed in without the prefix on it. Just the userName and database have a prefix.
So, let's go into the code and change that.
We are going to be in
editAction.php
I'm sorry, editCareer.php
and go down to the bottom of the code. And, you are going to see
that our user
has a variable that will be changed to
... let me double check...
peterjt_iamdata
changes the variable $user.
The password is going to be 'please' (This is wrong, but I'll discover that later....)
And the table is going to be changed to "peterjt_career"
So we edit that file: editCareer.php
Go to FileZilla
and send it off to our server.
Go back to our page, do a refresh
Looking for what is causing the error...
Changes the password to the correct password. [Chair squeeks]
Refreshes the page....
And there we can see it worked (after the password was corrected in the code!)
Get the right userName and password in order to access the database!
So now, if I check on "Part-Time Direct Support"
and click on okay, you can see
here are the header, description, and these go
requirements, contact information, and deadline, all relate to
field1, field2, field3, and field4 in the database.
Let's take a look at those side-by-side.
Go back out to the cPanel.
Go into the Database area.
Select the phpMyAdmin icon.
Select the career database and do a browse.
Update the career.php file
You can look here and you can see our page, header
and our fields
Here, on the web page, we can see the same information in the header
field1 in the database
is Sexton North and out on the web page
you can see that here in the description.
If we make changes on the web pages.
Let's put an XYZ on the end of the Header where it is noticeable
do a "Save" by clicking on the button
and then go to the career opportunities page (career.php)
and we will have to check the userID password in this code as well.
So, that is the career.php page that the user will be looking at.
In career.php we are going to have to update
our career.php as well so our
at the very top we are going to put in the correct username
password and update the variable name for the database ($database)
and then I use those in the lines of code that follow
Also notice my error
connecting to the CCI database (LivingLinks used to be called CCI)
which is connecting to the $database variable.
Updating the code error message to print out the username and password if they are not correct using the appropriate variables.
After you save the file don't forget to upload it to the server.
Oops, I lost my connection....
Reconnecting to the server.
Going into the LivingLink folder out on the sever so the files are uploaded into the correct spot.
Once these changes have been made, click on the "Career Opportunities" link
and you can see the change shows up on the end-user page. (Look for the XYZ in the header.)
WebExplorations.com