HTML - Need Help Generating Cookies / Saving Variables For Future Use!
Hello. I have a small script developed for tracking sales. The script randomly generates a "transaction ID" by creating a random number when a user visits the thank you page.
It works great, however there is one problem: when a repeat user comes back, it generates a NEW transaction ID and logs a second "sale" when in fact its just a repeat visit. How can I modify this script to remember the transaction ID for each user? I was thinking creating a cookie with the transaction ID would be the simplest way, however I'm not sure. If you can help me decide which way is best, and then show me how to implement this I will be very greatful. Basically I think I would need some sort of second variable, and a script that runs to check for a cookie. If cookie is present, replace "$random_number" with "transaction ID". else if no cookie is present, generate a new number with $random_number. Heres the code: Code: <!------- Random Number Generator For Pixel ----------> <?php srand ((double) microtime( )*1000000); $random_number = rand(0,100000); echo "<script src='https://users.domain.com/sale_third/49.95/$random_number/OPTIONAL_INFORMATION'></script> <noscript><IMG SRC='https://users.domain.com/track_sale/49.95/$random_number/OPTIONAL_INFORMATION'></noscript>"; ?> <!------- End Random Number Generator For Pixel ----------> Thanks in advance. Similar TutorialsI was really wondering what would be the future of html, that css and php has become so popular. I hardly see anyone using HTML. Even if it is, then it is XHTML and not HTML. Will it become extinct in the future. Just curious..... Hi there-- I need to commend out a single line of code in the future. The file is a plain .htm file and needs to have a section of it commented out using sysdate of August 1, 2009. Can anyone help me? Im thinking php but I am not too skilled past there. Thanks So I posted this before on a different website, but it wasn't exclusive to HTML, so I decided to post this here where I can get more opinions and input from a larger group of web savvy people: So currently I've been using XHTML 1 Transitional for about half a year now (I've only been developing websites for that long), but there are so many other different types, such as XHTML 1 Strict, HTML 4 Transititional, HTML 4 Strict, that I'm now confused and don't know which to stick with in order to be best prepared for the future. I did a lot of research on the web and I've hard arguments for both sides... stick with XHTML... switch to HTML.... So which is the better choice and why? Apparently XHTML was supposed to be the future, but then there is now HTML5 in development and a lot of the browsers seem to be leaning towards that.... Than there is also XHTML 2 in the works.... *sigh*... I'm so confused... So what should I do? Should I stick with my current knowledge of XHTML 1, or switch to writing in HTML 4? And then somebody responded and told me to go read up on HTML5 in Wikipedia, and I did, then I responded: So I read the Wiki link; basically the conclusion I got is that HTML5 will be both HTML and XHTML ("XHTML5") compliant? Well... then I guess I have nothing to worry about? Then somebody else (who visits htmlforums.com) responded and told me it best to stick with XHTML. And told me to use Strict instead of Transitional. He then refered me to htmlforums.com. And now I'm here posting this post And FYI, my websites uses much dynamic content and also iframe... so it best I stick with XHTML Transitional? First off, hello everyone, I would like to start by telling everyone thank you for letting me a part of this forum. Now, as to my topic. I am looking for a script that generates a random image of four that I have selected and postions it in the lower left hand corner of the screen every time the screen is refreshed. The only thing is, I need this to be compatible with myspace's possibilites. I would tremendously help it if anyone could give me a helping hand on this issue. I have searched google several times for some help, but all the solutions involve either java script or a certain amount of knowledge of html, neither which I have. Thank you for your time, and here are the urls of the images, I would like shown. http://i23.photobucket.com/albums/b3...cience/All.jpg http://i23.photobucket.com/albums/b3...nce/Turkey.jpg http://i23.photobucket.com/albums/b3...ence/Panzy.jpg http://i23.photobucket.com/albums/b3...ce/Curious.jpg Again, thank you a lot. Hi, I have to edit some part of my website and I need to easily know from which php files my html code is generated. Is there any easy way to know it ? thanks hey guys...i've seen the page of sourceforge where, when the page loads...the download of the file generates automatically.... i want the help related to implement that.... can anyone tell me how to do that.... thanks in advance... Hey all, Well First off let me explain what im trying to do.. I have a form which i made in html.. just something like first name last name city state thats just a example.. but you input your info into a text box.. At the bottom of the form theres a textbox called "number" and a submit button. i need it to be able to reconize the name they enter and save it as a *.html in a random directory so if they enter 123 and click submit it saves to C:\files\123.html i cant get it to work.. does anyone have any ideas? thanks!!! - Jonathan Hello, Does anyone know how to create an input form that saves text to a text file? i.e. a text box with a submit button. Thanks. Hello, hopefully i can find help here I want to save my canvas-content to a single image-file. There are an approach using todataurl(), which works fine. But not if i draw an image-file (e.g. car.jpg or house.png) to the canvas additionally. It does not return the whole image? Here I have my simple example-code: <head> <script> window.onload = function() { var canvas = document.getElementById("theCanvas"); var context = canvas.getContext("2d"); context.fillStyle = "navy"; context.fillRect(0,0,20,20); var imagefile = new Image(); imagefile.onload = function () { context.drawImage(imagefile, 22, 0,60,60); } imagefile.src = "http://www.sign-arts.de/joomla/images/stories/print_proj/mediclin/icon1.gif"; window.open(canvas.toDataURL('image/png')); }; </script> </head> <body id="bodi"> <canvas id="theCanvas" width="500" height="200" > </canvas> </body> Only the HTML5-methods like fillRect() are rendered to the new window, why this is so? What im doing wrong? Thanx in advance for help bilinok Hey everyone, I'm working on a new login form for my site and getting a HUGE headache from it. The login box houses 2 forms but I do some trickery with jQuery for the password field so that I can display the word "Password" in a text input, and then I swap it to a password type input field when the user focuses on it. - The form for logging in contains: Email field [type=text] Fake Password field [type=text] Actual Password field[type=pass] - Another to create a new account contains: Screename [type=text] Email[type=text] Password field[type=pass] Testing in FireFox, I clear the saved passwords/cache from the site, pull up the forms and submit the LOGIN form. It's successful and I choose to "Remember the password". Now I logout and pull up the forms again...and the SIGN UP form's password field, now contains the value I entered in the LOGIN form when I saved earlier. Does it simply look for all password fields on the page and add the value to them? The forms both have different ID's all the input fields have different ID's... I've never dealt with forms on this magnitude, so it may be easy, but man is it a headache! THANKS FOR ANY HELP! When I edit my html code in notebook, and try to save, it somehow messes up the spacing and format of my coding immediately upon saving. I've attached before saving and after saving pictures as examples. What gives? Thanks. Hi, I am very new the Html, just i had created a static page containt a hyper link to open a pdf file. File open in browser itself. The list of activity want to protect from the user. 1. Saving the pdf 2. printing the pdf 3. copy/edit a pdf Please help me how to do it. kanish I am using dreamweaver and for some reason when I save files it's creating extra linespaces. like <br> <br> <br> will show up as <br> <br> <br> How can I fix this? It's a real pain. It must increase my page size? Or is it fine? One page I have, I don't know why, but it has 5-6 lines in between, maybe every time I save it' adds another line? I was hoping you could help me with a problem that came up at work today since I've never worked with this sort of thing before - cookies. This has to do with affiliate marketing. To put things short, my company uses cookies to track the referrer's username (ie the person through whom new users register). This is in turn tracked by our servers and the affiliates are paid a commission for every referral. Basically this process works perfectly in firefox, safari and chrome browsers but not in internet explorer. It seems to be quite random because it does work on the rare occasion but it mostly doesn't save the cookies that contain the username of the affiliate and therefore we cannot track the referrals made through internet explorer by the users. Do you have any idea or experience regarding this? By the way, this is done through a tracking url using redir.cgi and adding the values in the address itself (for example: http://www.---.com/cgi-bin/redir.cgi...le=123&lang=en). I've tried to research about what might be the cause of the problem but all I found were other people complaining that internet explorer gives problems but no solutions. Do you have any idea how this tracking works? Thanks a lot, I would appreciate your help Cookies?! What are they and do I really need one? By the way, check this out www.esaurome.com/index.html and tell m what you think... Also, is it better to give files a .htm or .html extension? Any difference between the 2? hi, what is cookies and sessions .I have listen many times but don't know.. If u know plz tell. Thanks, web development Hi Guys, Hope this is the correct forum for this thread. How do you put a cookie on someones computer when they visit your website? Thanks Is there any way that cookies will work with frames that are showing a site on a different server? Help Me With Cookies, HTML and IE8 For complex reasons, I have to use HTML with JavaScript to set a cookie. I know it is easy to set and get cookies PHP but I have to put the code in HTML. I have searched the internet for some examples and I ran a test based on an example. I ran this Javascript code: Code: <SCRIPT LANGUAGE="JavaScript"> function putCookie() { cookie_name = "specialcookiehuge"; if(document.cookie != document.cookie) { index = document.cookie.indexOf(cookie_name); } else { index = -1; } if (index == -1) { document.cookie=cookie_name+"; expires=Monday, 04-Apr-2020 05:00:00 GMT"; } } </SCRIPT> I tested this code by placing alert statements and I nkow that the line: Code: document.cookie=cookie_name+"; expires=Monday, 04-Apr-2020 05:00:00 GMT"; gets run. I tried to find this cookie (Tools -> Internet Options -> Browsing History ->Settings) And I did not find anything named "specialcookiehuge" in "View Objects" or "View Files". I guess I could try other browsers, but it would be good to know what I am doing wrong. I do not know if I am really setting a cookie. Is there some additional javascript command I am missing? Or, is the cookie being set but I am not looking in the right place according to the tutorials I saw online? |