PHP - Change Image For The Returning Visitors.
Hi,
I want to show one image for the new visitors of my website and another for the returning visitors. What I want to do is that after the visitor reload the page he will see another image instead of the first one.
Similar TutorialsHi I am new to php, I am trying to capture the url and place into a variable but I only get the 1st digit to show, I just cant see what I am doing wrong. Sorry to ask such a basic question but I just can't work it out, I have attached a screen shot of all me code, your help would be very very much appreciated. Is there any way to only log real visitors, and not get robots? <?php define("DATE_FORMAT","m-d-Y - H:i:s"); define("LOG_FILE","/full_path/logs.shtml"); $logfileHeader='DATE - IP - HOSTNAME - BROWSER - URI - REFERRER'."\n"; $userAgent = (isset($_SERVER['HTTP_USER_AGENT']) && ($_SERVER['HTTP_USER_AGENT'] != "")) ? $_SERVER['HTTP_USER_AGENT'] : "Unknown"; $userIp = (isset($_SERVER['REMOTE_ADDR']) && ($_SERVER['REMOTE_ADDR'] != "")) ? $_SERVER['REMOTE_ADDR'] : "Unknown"; $refferer = (isset($_SERVER['HTTP_REFERER']) && ($_SERVER['HTTP_REFERER'] != "")) ? $_SERVER['HTTP_REFERER'] : "Unknown"; $uri = (isset($_SERVER['REQUEST_URI']) && ($_SERVER['REQUEST_URI'] != "")) ? $_SERVER['REQUEST_URI'] : "Unknown"; $hostName = gethostbyaddr($userIp); $actualTime = date(DATE_FORMAT); $logEntry = "$actualTime - $userIp - $hostName - $userAgent - <A HREF='http://www.domain.org$uri' TARGET='_blank'>http://www.domain.org$uri</a> - <A HREF='$refferer'>$refferer</a>\n"; if (!file_exists(LOG_FILE)) { $logFile = fopen(LOG_FILE,"w"); fwrite($logFile, $logfileHeader); } else { $logFile = fopen(LOG_FILE,"a"); } fwrite($logFile,$logEntry); fclose($logFile); ?> hey guys, I am looking for a way to find out information about the referring site a user clicked through to get to my site. Is that possible and if so, How? Ideally, I am looking for: Site Domain Name The referral URL Meta information of the page I believe I can get this stuff from analytics software, but I am trying to think of a way to do it in my own script. Is it possible and does anyone have any ideas to point me in the right direction? thanks This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=349293.0 Hello PHPers, One more help I think may be wrong. I currently have code as $_GET['width'] . "x" . $_GET['height'];. This provides continually with 640 * 480. believe this to be incorrect as I do not think that everyones screen is set to this. Neither is my screen resolution and is still capturing these figures. Is there something wrong with the variable that should be changed so that it can pick up the visitors screen resolution. Thank you kindly, HJ Hello to all!
I ask myself the following question: Is there a way that is better to calculate the number of members / guests online I'm assuming this has something to do with cookies, which I am not to familiar with as I am pretty new to this PHP world and have mostly worked with wordpress... but this question was brought up to me, and I don't know where to start. If a user is signed up for the mailing list on a site, we would like the home page the user lands on to be different than the page a new visitor who isn't signed up for the mailing list would see. I have tried to google this, but maybe I am using the wrong choices of words? Any advice, links, etc would be so so soooo appreciated. Thanks V Hello, I have some questions about dates/time ... I have a site where registered users will receive messages, I want to include the date/time with that message. I am not sure what is best way to do this, so I am recording the GMT hours offset from users input (from receivers), but then I saw that the hours offset from the GMT is different in different seasons of the year, so how do I detect correct local time for the message receiver? Is it something like a database with start-end time of daylight savings hour adjustment or how is this done? Hello How do I fetch a current visitors ip address, and turn it into a variable? The visitor should only be able to enter the same form once, so I want to compare the current visitor ip address with ip addresses in the database to achieve this. Best regards Morris Can you see any problems with the code below? It doesn't work. What I am trying to do is quite straightforward. The links on my site look like this: go.php?id=1&url=usa go.php?id=1&url=uk go.php?id=2&url=usa go.php?id=2&url=uk When a visitor clicks on one of these links, I want to grab the values of the id and url parameters, count the click, and redirect the visitor. Here's the error that I get when I try the code: Quote Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\sites\go.php on line 18 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\sites\go.php:18) in C:\xampp\htdocs\sites\go.php on line 19 <?php $conn = mysql_connect('localhost','username', 'password') or trigger_error("SQL", E_USER_ERROR); mysql_select_db('database', $conn) or trigger_error("SQL", E_USER_ERROR); $id = intval($_GET['id']); $url = intval($_GET['url']); mysql_query("UPDATE urls SET click_counter = click_counter+1 WHERE id=$id"); if ($url=="usa") $href = "SELECT usa FROM urls WHERE id=$id"; elseif ($url=="uk") $href = "SELECT uk FROM urls WHERE id=$id"; elseif ($url=="aus") $href = "SELECT aus FROM urls WHERE id=$id"; elseif ($url=="can") $href = "SELECT can FROM urls WHERE id=$id"; else $href = "SELECT int FROM urls WHERE id=$id"; $qry = mysql_query($href); list($href)=mysql_fetch_row($qry); header("Location:$href"); mysql_close($conn); ?> Hi all, I am dealing with an html page in which a dynamically created PNG image is shown with: <img src="createchart.php"> The problem arises when users try to download the image since the default name that appears is just "createchart.php". Is there any way to make the browser suggest something like "chart.png"? Than you guys for your help, Mam Using php I have a dynamically filled select box with the names of images. How can I get an image box on my page and change upon selection? Hi ppl, I am not an php expert, but I want to allow my website users to edit a record in mySQL table. I need to allow them changing Name and description of a product, thats all. easy edit. Is there a ready component that will do the hard work for me? Thank you! i want to make virtual money (credits, tokens) whatever you want to call it but make no mistake this is not for profit at this point but i like the concept of visitors having something to do with other members of site for example to kill bordom and create a reason to play games, compete in competetions, it will have to conversion to real money at this point but i wish to do this script using php and mysql and have very basic coding skills in these areas anyone please help me make this script... reply and let me know if you like this idea please help me as this is achievable as fb has it and more sites are moving toward these same ideas, even tho fb is real money it is more to do with fun at this point until we do this stage another stage canot proceed it. This creates an image 1500x1500 pixels. But it creates it in black... how can i make it white. And i have to use imagecreatetruecolor() not imagecreate(). <?php $im = imagecreatetruecolor(1500,1500); // Output the image to the browser header('Content-type: image/jpg'); imagejpeg($im); imagedestroy($im); ?> Thanks! Main URL of website home page: www.mysite.com and this shows image "A" in the header. I want to have a marketing campaign which will send people to my site via this link: www.mysite.com/index.php?ref=att When people get to my site via the 2nd link, I want to show image "B" instead of image "A". I put this at top of home page... Code: [Select] require_once("includes/session.php"); if (isset($_GET['ref']) && ($_GET['ref'] == "att")) { $_SESSION['ref'] = "att"; } else { } and this code is in my header include file, a little further down on the page... Code: [Select] <?php if (isset($_SESSION['ref']) && $_SESSION['ref'] == "att") { echo "<span class='phone'><img src='/images/B.png' /></span>"; } else { echo "<span class='phone'><img src='/images/A.png' /></span>"; } ?> Does this look right? because I can't get it to work. It's showing image A regardless of which URL I use. I have to be missing something obvious because I really thought this would be super easy to do. If anyone sees any problems, let me know. But I'll keep testing and hopefully find my mistake. Thanks! Nothing fancy, I am just looking for a simple php script that would check a text file on my server that has a bunch of domains in it. I want the script to ping a random 5 or 10 sites in the list, and then redirects the visitor to the fastest one, or at least one that responds, and is not down. If all that are checked are down, then it would need to recheck the list. I want it to pick random domains out of the list, as I don't want users directed to the same site(s) all the time, just because it pings the best. When I say ping, I am talking about making sure the user isn't directed to a website that is down, or a slow loading website. I am not sure if "ping" is the correct word for that tho? Can anybody offer me code like this for free, or is this type of request getting into something that would need to be paid code? (and if so, any idea how much? I didn't post this in the freelancing forum, because it sounds like it might be something simple to code. I am not a coder, so I am looking for something complete that I can add to a php file and it works. Thanks for any code, pointers/problems with this idea, or price quotes (if necessary) on this little script I am looking for. HI I'm thinking to do something like this , I've seen this in a website ,I'm a php designer but i don't know who something like this can be done . it's a website that sells sofas . we've the ability to change the color and fabric and see the result right away . for example ,this is the default sofa : then I can select a part of it and I can choose the fabric and color , then it make the result : thats it , How can I do that ? What should I do ? I'm really looking to hear from you King Regards i am new to web designing,
i don't know much about javascript.
<select id="plan" align="center" valign="center"> |