Jump to content

McChicken

Members
  • Posts

    10
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

McChicken's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey. I just installed a script that change my site logo on holidays, called "HLogoZ" My problem is that i want the script to show a logo from 1.Dec - 22.Dec and another logo from 23.Dec - 24.Dec. What change do I need to make here: ? } } // Christmas Eve else if ($today == "December 24, $year"){ if (file_exists("$logo_path/$logo_xmaseve")) { echo "<img src='$logo_url/$logo_xmaseve' alt='$logoalt' />"; } else { echo "$imagedefault"; } } // Christmas else if ($today == "December 25, $year"){ if (file_exists("$logo_path/$logo_xmas")) { echo "<img src='$logo_url/$logo_xmas' alt='$logoalt' />"; } else { echo "$imagedefault"; } }
  2. A little change here fixed it:) Thank you again Little chicken! $result = mysql_query("SELECT * FROM `ip_hits` ORDER BY `ip_hits`.`date` DESC LIMIT 0, 30 ; ");
  3. Thank you little chicken. I'm not 100% happy with the results, but it's a good start:)
  4. Hey. I want to generate my database in a table on a php/html page. something like this: Can someone help me with the code? thanks.
  5. I could't get it to work, but i found some scripts and put them together and got them to work. <?php include("config.php"); $sql = mysql_query("SELECT * FROM `ip_hits`"); while ($hit = mysql_fetch_array($sql)) { } $date = gmdate(j); $month = gmdate(F); $sup = gmdate(S); $year = gmdate(Y); $datestamp = $date. '' .$sup. ' ' .$month. ' ' .$year. ''; $ip = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $hit_sql = mysql_query("SELECT * FROM `ip_hits` WHERE `ip` = '" .$ip. "'"); if (mysql_num_rows($hit_sql) == "0") { mysql_query("INSERT INTO `ip_hits` ( `ip` , `clicks` , `date` ) VALUES ('" .$ip. "', '1', '" .$date. "')"); } else { $hit = mysql_fetch_array($hit_sql); $new_hits = $hit["clicks"] + 1; mysql_query("UPDATE `ip_hits` SET `clicks` = '" .$new_hits. "', `date` = '" .$datestamp. "' WHERE `ip` = '" .$ip. "'"); } $show = mysql_query("SELECT * FROM ip_hits"); //Get all the data from the database for showing the count $show2 = MYSQL_NUM_ROWS($show); //Count the rows echo "Unike sidetreff: $show2"; //Echo the # of unique hits ?> It shows Unique Ip's, Total clicks, and last date online
  6. Ok...now database look like this ip varchar(255) latin1_swedish_ci No count varchar(255) latin1_swedish_ci No last_visit varchar(255) latin1_swedish_ci No What will the full code be? thanks
  7. But the id auto is used by the counter that shows on my page. id int(80) Nei auto_increment
  8. id and ip was in the current script, but I can just rename them
  9. Thank you for helping. I'm pretty fresh to php coding. What will the full code be?? My db looks like this: id int(80) No auto_increment ip varchar(255) latin1_swedish_ci No last_visit varchar(255) latin1_swedish_ci No
  10. Hey guys. I have a simple php script, a counter that register unique visitors to my page. I would like to add "last visit time" to the database. I would aslo like a counter in the db that counts how many time a Ip adress has visited my page. How can this be done? here is the script: <?php include('includes/config.php'); // include the db conection file $ip = $_SERVER['REMOTE_ADDR']; //Get user IP $check = mysql_query("SELECT * FROM users_online WHERE ip = '$ip'"); //Check the database for the IP $check_ip = MYSQL_NUM_ROWS($check); if($check_ip == 0) //If the Query shows 0 results { mysql_query("INSERT INTO users_online (ip) VALUES ('$ip')"); //Add the IP to the Database } $show = mysql_query("SELECT * FROM users_online"); //Get all the data from the database for showing the count $show2 = MYSQL_NUM_ROWS($show); //Count the rows echo "Unike sidetreff: $show2"; //Echo the # of unique hits ?>
×
×
  • 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.