Hi everyone,

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.

Problem 1

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
search_engine: 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.

Problem 2

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?




Problem 3

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.

hello world.html

<html>
<head>
<title>Hello World</title>
<a link color="red">
</head>
<body>
<a style="text-decoration: none" href="#"><font size="10" color="#FF0000">Hello World</font></a>
<?
echo $_SERVER["REMOTE_ADDR"];
?>
</body>
</html>