[RESOLVED] Need help with my assignment
I'm new to this forum and to the web development. I have an assignment that I'm having a hard time coming up with answers. If anyone can help I'd be greatly appreciate. Below are only 3 problems that I couldn't come up with answers. I tryed to answere last on and got helf way done until I realized that I cant get IP Address of the user with HTML.
First up, we want to see a little bit of php and mysql work.
Most of the visitors to our site come from either a search engine, like Google, or an affiliate website that sends us traffic. Users starts on the page www.simpleweb.com/landingpage.php (this is not a real page), and we use PHP and MySQL to save a session in our database and then save the id from that session to a cookie to track the user as they move through our site.
This is stored in the table `sessions` under the `simplefilings` schema which has the following fields (field name : field type):
id : integer – auto increments
insert_time : datetime
user_ip : varchar
affiliateid : integer
When a user gets to landingpage.php they'll have a URL variable of either ‘affid’ or ‘srch’, though you probably won’t see a URL of http://www.simpleweb.com/landingpage...42&srch=google, as that would imply a user coming in from an affiliate website and a search engine on the same link.
So… using PHP and MySQL, and anything else you feel the need for, code the section of landingpage.php that sets up the variables, inserts a row into the sessions table, pulls back the session id, and inserts that id into a cookie. Feel free to make up any missing information needed to finish this (like the username, password, and host of the database) and make a comment of it in the code.
The second problem deals with apache and linux. We’re just looking for a high-level explanation of how you would implement the following, no coding required.
We have one web page under our base simplefilings.com directory called generic.php (again, this is not a real page). What we want is to be able to call 50 different URLs with the format of www.simpleweb.com/statename/generic.php, and the title and a link are different on each of the 50 pages. For example, if someone came to www.simpleweb.com/kansas/generic.php the title would read ‘Register Your Business in Kansas’, and the link would go to kansas_filings.php.
So the question is, how can we implement this functionality without creating 50 different generic.php files?
Finally, we want to see a little bit of web page coding.
Create a web page that says “Hello World”. Put the text in an anchor tag and make it red. When the user clicks on it, instead of triggering any sort of page load, just have it display (or hide if already displaying) a line of text below “Hello World” which says “I see you” followed by the user’s IP address.
<a link color="red">
<a style="text-decoration: none" href="#"><font size="10" color="#FF0000">Hello World</font></a>
This one is actually pretty easy. Have you ever created a login system? On the landing page do this order:
Read the request header to find where the user came from, though the problem is: a user could have manipulated this or something else to make user appear to come from a different place. But, at least we are tracking them inside your server. First, fetch the session ID, make sure it is valid, and check the last INSERTED url, which would of been from the user being at a previous page already logged in, and php inserted the url for the page into database. Now that we can see this, either replace or append the landing page url. IP address is actually fairly irrelevant, because user might not have the same IP thus is why we use the sessions (and we don't want to always ask user to login 24/7). Make sure to research session security as well, since they can easily get hijacked if not done right.
Things to look into:
Not very clear on the question, but things to look at:
Associative Arrays, using the keys to make easy on you to type.. 1, instead of an entire url. So have user select state on a main page.
document.getElementById("YOURHELLOWORLDID").style.display = "none";
document.getElementById("YOURIPAREASID").innerHTML += "is your IP address";
Make sure to set appropriate global ID's for the area's you want to manipulate. I suggest making use of DIV's, and you do not need that extra FONT tag, you can do this in the style. Likewise:
<a style="text-decoration:none;color:#ff0000;" href="#">
This makes it easier to access, and add an id in here so you can manipulate the display property to this specific area... id="whateverthehellyouwant"
Thank you jazzmasterkc for your advice, although on th 1st problem I have never worked with html so if you don't mind writing me a begginers code so I can build on top of it. On the 3rd problem I impliment function do() just like you said but it did not work.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread