Results 1 to 3 of 3

Thread: [RESOLVED] Need help with my assignment

Hybrid View

  1. #1
    Join Date
    May 2013

    resolved [RESOLVED] Need help with my assignment

    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

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

  2. #2
    Join Date
    Jul 2012
    Problem 1:
    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:
    Session Hijacking
    SQL Queries

    Problem 2
    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.

    Problem 3
    Easy, use javascript. the onClick event listener will signal to a a corresponding function. Likewise:

    function do(){
    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"

  3. #3
    Join Date
    May 2013
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.11830 seconds
  • Memory Usage 2,948KB
  • Queries Executed 13 (?)
More Information
Template Usage (29):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (3)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (27):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./includes/functions_threadedmode.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates