Jump to content

MortimerJazz

Members
  • Posts

    60
  • Joined

  • Last visited

    Never

About MortimerJazz

  • Birthday 10/24/1978

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling
  • Location
    Bedfordshire

MortimerJazz's Achievements

Member

Member (2/5)

0

Reputation

  1. Afternoon all - I'm hoping you might be able to help me with a DB design issue I've got. Let's say for example, I'm building a website which will track the price of shares over the course of a 7 day period. These prices will be initially downloaded to a database and then extracted to be displayed in a graph using something like FusionCharts. My question is that I really don't know where to start in terms of designing the database to ensure that data is stored in the most efficient manner. I don't suppose anyone can point me in the direction of a good tutorial/book which would help me out with this could they? Thanks very much in advance!
  2. Just wanted to give this a bump? Can anyone help at all? I can't seem to find anything about this anywhere and I'm starting to pull my hair out! Thanks,
  3. Definitely - thanks for the replies so far. Here's the code I'm using in my index page. You can see the include function four lines from the bottom: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="http://www.mydomain.com/style.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../style.css" type="text/css" media="screen" /> <? include "functions/getStyle.php"; ?> <link rel="icon" href="http://www.playpokeronline.net/favicon.ico" type="image/x-icon"> <meta name="google-site-verification" content="cwKF364Iet1xHF8hrPgV2prykHYo4I2vN7JU3p2GufQ" /> The getStyle.php contains this code which basically queries a Maxmind Database to determine a player's location. Dependant on the results, the script should then load one of a handful of CSS files. <?php include("geoip.inc"); // Uncomment if querying against GeoIP/Lite City. // include("geoipcity.inc"); $gi = geoip_open("/home/user/public_html/geoIP/GeoIP.dat",GEOIP_STANDARD); $ip=$_SERVER['REMOTE_ADDR']; $country=geoip_country_code_by_addr($gi, "$ip"); geoip_close($gi); switch ($country) { case US: echo '<link rel="stylesheet" href="../style/us.css" type="text/css" media="screen" />'; break; case GB: echo '<link rel="stylesheet" href="../style/gb.css" type="text/css" media="screen" />'; break; case CA: echo '<link rel="stylesheet" href="../style/ca.css" type="text/css" media="screen" />'; break; case AU: echo '<link rel="stylesheet" href="../style/au.css" type="text/css" media="screen" />'; break; default: echo '<link rel="stylesheet" href="../style/default.css" type="text/css" media="screen" />'; } ?> Technically it works - the correct style sheet loads up, but I'm left with this extra HTML tag in the middle of my original <head> tag. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> </body> </html> I hope that makes sense - feel free to ask any more questions if not. I really appreciate the help!
  4. Are there any problems with calling an include file from within the <header> tags? The reason I'm asking is that I'm trying to load a speficied Style sheet based on a user's location and so I'm running a short script to determine which Style sheet needs to be displayed ... and that script is called from within the header tag. I haven't heard of any problems with doing this in the past, but the script seems to be generating an extra set of <HTML> tags in my source code and I can't figure out why this might be! Thanks,
  5. This is a bit of a wierd problem, but I haven't been able to solve it so I thought I'd post it up here. Basically, I'm using the following function to access Maxmind's GEO IP database (so that I can target visitors to my site based on their location): <?php // This code demonstrates how to lookup the country by IP Address include("geoip.inc"); // Uncomment if querying against GeoIP/Lite City. // include("geoipcity.inc"); $gi = geoip_open("/home/bounce6/public_html/geoIP/GeoIP.dat",GEOIP_STANDARD); $ip=$_SERVER['REMOTE_ADDR']; $country=geoip_country_code_by_addr($gi, "$ip"); geoip_close($gi); ?> The function is being called using this line from a separate file: include "/home/username/public_html/mydomain.com/functions/getCountry.php"; Now the code does what it's supposed to do, in as far as it's able to give me a string which details where a visitor is located. However, for some strange reason it seems to be adding a new HTML tag into my existing header tag. The code which has been inserted is as follows: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> </body> </html> I've managed to isolate the problem to this script, so I know that there must be an issue with it, but I'm not quite sure what it is. Can anyone suggest why this extra source code is being produced? Is there a particular function that I'm using which is forcing additional headers or something?! Any thoughts would be really appreciated!
  6. Thanks for the response David, but I thought that section of code listed basic wildcard patterns as opposed to Regular Expressions which would be ok for sscanf ()
  7. Ok, now I'm a little confused. This is the print out I get on the screen when the script is run: It would seem that I'm not getting any keywords in my array, which I'm pretty sure wasn't happening before ...
  8. Ok, quick update as this hasn't quite worked. Here's the ammended code (the ammended part is the print_r() function at the end) <? function parse_ga_cookie($cookie) { $values = sscanf($cookie, '%d.%d.%d.%d.utmcsr=%[^|]|utmccn=%[^|]|utmcmd=%[^|]|utmctr=%[^|]'); if (count($values) !== { // return false; trigger_error(...); ... or whatever you like throw new InvalidArgumentException("Cookie value '$cookie' does not conform to the __utmz pattern"); } $keys = array('domain', 'timestamp', 'visits', 'sources', 'campaign', 'source', 'medium', 'keyword'); return array_combine($keys, $values); } // Cooookkkkkkiiiiiiieeeeeeeeeeee, om nom nom... $keyword=print_r((parse_ga_cookie($_COOKIE['__utmz']))); ?> The output has changed now, but it's still not quite correct. Instead, I'm getting the value '1' in the $keyword variable now. I'm trying to figure out if that's a string or a value from the array. Can anyone help out at all? Cheers,
  9. Morning all, I hope I'm posting this in the correct section - if not, please feel free to move it. What I'm trying to do is extract keyword information from the Google Analytics cookie and pass it into the header when a click is generated. Having hunted around I understand that I need to extract the utmctr value from the __utmz campaign cookie, which looks like this: So here's a short function that I wrote to try and extract the keyword information: function parse_ga_cookie($cookie) { $values = sscanf($cookie, '%d.%d.%d.%d.utmcsr=%[^|]|utmccn=%[^|]|utmcmd=%[^|]|utmctr=%[^|]'); if (count($values) !== { // return false; trigger_error(...); ... or whatever you like throw new InvalidArgumentException("Cookie value '$cookie' does not conform to the __utmz pattern"); } $keys = array('domain', 'timestamp', 'visits', 'sources', 'campaign', 'source', 'medium', 'keyword'); return array_combine($keys, $values); } // Cooookkkkkkiiiiiiieeeeeeeeeeee, om nom nom... $keyword=(parse_ga_cookie($_COOKIE['__utmz'])); Unfortunately though when I go to print out the value $keyword I'm just getting the value 'Array' Is anyone able to help me out at all here? I can't see where the problem lies. Thanks a lot for your help ...
  10. Could you give me a simple example at all fenway? Thanks a lot for your help ...
  11. Afternoon everyone, Here's the rough layout of a page I'm currently working on - it's a bit like a 'profile' page I suppose: Apologies for the rather quick Photoshopping ... but you can see roughly where I am. What I'd like to make happen is to allow visitors to the page to click on Pic2 or Pic3 and have that image swap with the main image, so that the smaller pics can be seen larger. Now the problem is that I somehow need to be able to check which of the three images are currently in the Main Image area, so that I know which two to swap. So my question is, how can I see exactly which picture is currently being displayed in the main image area? And how do I update this each time that one of the smaller images are clicked on. ANY help would be really appreciated! Thanks,
  12. Hi Fenway, Thanks for the reply. Most of the content is stored in VARCHAR fields or short text fields. Stuff like the number of doors is stored in NUMBER fields and any features like (leather seats, 4WD to keep the example above going) is recorded by a "TRUE" in the relevant field name. Does that help at all?
  13. That's not a very descriptive title, so let me try and explain what I want to do. Basically, when a user searches through the database, I don't want the results page to show up blank if nothing matches the criteria which the user has inputted. Therefore if the database doesn't find an exact match, it would be nice if it brought up records which were similar to what the user wants. So let's say someone's looking for a car and wants a 4 Door Red Audi. Nothing like that is in the database, but I'd like my script to effectively say "We don't have that, but we do have a 4 Door Blue Audi" Can anyone suggest the best way of doing this please? Thanks,
  14. Thanks lilman. The code's quite simple so far: [code] $message="The following person has expressed an interest in your toy: <p> Reference Number: <a href="http://www.mysite.com/viewtoy.php?toy=$ref <p> User: $username"; $sql = mysql_query("INSERT INTO prv_msg (sender, recipient,         subject, message, sell_msg, date_sent, ip_sender)         VALUES('$username', '$recipient', '$subject', '$message', '1', now(), '$ip')")         or die (mysql_error()); [/code]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.