I have a form where I save the data in a cookie with localStorage. This all works fine, but If clear (just deleting with backspace) the value of an input field or textarea so that the placeholder text shows up again and I refresh or come back at the page, the input field and textarea shows 'undefined' in the fields instead of the placeholder text. How do I get rid of 'undefined'? I made a demo form in a pen, so you can see and experience what I'm talking about. http://codepen.io/gentlemedia/full/VevPyP/ The HTML of the demo form : <form> <div> …

Member Avatar
Member Avatar
+0 forum 2

Hello, I am writing this to warn you and because I haven't selected yet witch solution to choose , so your opinion is more than welcomed. The problem: in some version of iPhone / iPad software the cookies aren't separated by “;” but by comma and doubled. The first fatal to that is exception '_Exception_FatalError' with message 'session_start(): The session id is too long or contains illegal characters The cookie that caused was “PHPSESSID=ea4fee7dcf4446d5cd61aabab13a0df2,PHPSESSID=ea4fee7dcf4446d5cd61aabab13a0df2” PHP parses that like PHPSESSID is “ea4fee7dcf4446d5cd61aabab13a0df2,PHPSESSID=ea4fee7dcf4446d5cd61aabab13a0df” that of course is illegal. The problem occurs in these devices + software (with * is all that have …

Member Avatar
Member Avatar
+1 forum 3

This "FakeWebClient" will allow a C# application to send and receive cookies as part of the request. This behaviour is not available by default. Please note that on line 35 there is a possible NullReferenceException, I managed this at a level higher but you may wish to handle it in the client.

Member Avatar
Member Avatar
+3 forum 3

Hi Hope,everyone is doing good out there. I need some help regarding which strategy to use for one of my projects. Here are the project details I want to generate PDF forms, by gathering data from user.There are different questions to ask and based on each answer,we will ask next question.i.e Where do you live? If s/he reply USA, next question will be regarding USA,if s/he reply Outside USA,next question will be different. I'll use FPDF to generate PDF on the go. But my question is how to implement questionnaire.Where should we store the values, either in session or Mysql …

Member Avatar
Member Avatar
+0 forum 6

I have the cookies and subdomain selection for header: <script type="text/javascript" src="/static/js/jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(function(){ var city = readCookie('city'); if(city !=null && city !=''){ window.location.href = 'http://' + city + '.example.com'; } $('#citygo').change(function(){ var city = $(this).val(); window.location.href = 'http://' + city + '.example.com'; }); }); function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c …

Member Avatar
Member Avatar
+0 forum 15

I'm not exactly sure what the problem is but the cookies aren't available for subdomains. Is there any way around this, or is there a better way to set the cookies domain? Thanks! <?php ini_set("session.cookie_domain", ".example.com"); // Set cookie and redirect when user change city if( isset($_POST['city']) && $_POST['city'] != '' ){ $cookie_expire = time() + 50400; setcookie('city', $_POST['city'], $cookie_expire, '/'); header("Location: http://".$_POST["city"].".example.com"); die(); } // Redirect if user selected default city if (isset($_COOKIE["city"])) { $subdomain = array_shift(explode(".",$_SERVER['HTTP_HOST'])); if ($_COOKIE["city"] != $subdomain) { header("Location: http://".$_COOKIE["city"].".example.com"); die(); } }

Member Avatar
Member Avatar
+0 forum 5

Hey daniwebbers, I need to have some Javascript done, and since I'm not a coder myself I thought some of you might have time to help me out! Basically, I need a script that contains a single-line user input form. When the user then clicks a button - which I currently have, so *button.onclick*, it saves the data in a cookie. Then after that, I need a way to show the data from the cookie in plain text (If the font could be Verdana or Tahoma, that'll be great). And after that again, a way to delete the cookie from …

Member Avatar
Member Avatar
+0 forum 2

The cookie is not holding and the domain example.com cannot redirect to a.example.com when I type on the address bar. Anyone good at cookies? Any help will be very much appreciated. $(function(){ var city = getCookie('city'); if(city !=null && city !=''){ window.location.href = 'http://' + city + '.example.com'; } $('#citygo').change(function(){ var city = $(this).val(); window.location.href = 'http://' + city + '.example.com'; }); }); <select id="citygo"> <option value="0">Select City</option> <option value="amsterdam">Amsterdam</option> <option value="newyork">New York</option> <option value="london">London</option> <option value="cardiff">Cardiff</option> </select>

Member Avatar
Member Avatar
+0 forum 1

Hi I am developing the asp.net using Vb.net code. I need to notify my client if client's browser is disabled the cookies, when the launch the asp.page. Pls help me. Maideen

Member Avatar
Member Avatar
+0 forum 3

Hi, i am new in asp.net and i found it quiet difficult... i was programming in classic asp and sql server, but asp.net looks quiet different, specially if i do program in C# .... Than i hase a couple of questions : 1) if i do a form with 2 textboxes and i want to check if the value of the 2 textboxes are matching with the 2 records of my database (sql server), ho can i pass this 2 value?? 2) if i don't find any record in my database.. how can i check this? 3) ho can i …

Member Avatar
Member Avatar
+0 forum 9

Hi Guys I'm working on a little log in syetms for my website, hwoever have hit a little snag. I'm using cookies to track which users are logged in. I'm trying to make some pages restricted to vistors that have logged in only, so I decided to use `if($_COOKIE["loggedIn"] == TRUE){` This works for the log in page but when I logout using `Inline setcookie("loggedIn", NULL, time() - 60000);` All the other pages apart from the log in page retain the value `TRUE`. I originally set the cookie `setcookie("loggedIn", TRUE, time() + 3600);`. I'm still very new to php so …

Member Avatar
Member Avatar
+0 forum 7

Hi people. I'm writing this topic here in this section because I use OpenSUSE 12.2. I have a weird problem: The page will be displayed to me as gibberish after I write this topic (the next time I access this page). I thought it had something with the cookies but I cleaned them and nothing. Used three different browsers (Opera, Firefox and Chrome) still nothing. Also, I visited other forums, I logged in, and only **here** my page becomes gibberish (with all the browsers I used). I wonder if anyone already have gone through this kind of problem. ![captura6](/attachments/large/4/captura6.png "captura6") …

Member Avatar
Member Avatar
+0 forum 1

Hi friends, Waht are the differences between Sessions and cookies in PHP? Please explain with examples. Thanks & Regards Jasonmark

Member Avatar
Member Avatar
+0 forum 5

I'm trying to create a php script to print fibonaaci series. The idea is to add a new number to the series everytime the page is refreshed and print the series. <?php if (!isset($_COOKIE["fno"])) {setcookie("fno",0,time()+3600);} if (!isset($_COOKIE["sno"])) {setcookie("sno",1,time()+3600);} if (!isset($_COOKIE["series"])) { $text="0 1 "; setcookie("series",$text,time()+3600); } $fno=$_COOKIE["fno"]; $sno=$_COOKIE["sno"]; $fibostring=$_COOKIE["series"]; //echo $fibostring; $tno=$fno+$sno; $fibostring.=$tno . " "; setcookie("fno",$sno,time()+3600); setcookie("sno",$tno,time()+3600); setcookie("series",$fibostring,time()+3600); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Fibonacci Series</title> </head> <body bgcolor="#FFFFFF"> <div style="font-size:20px; color:#cc0000; margin-top:10px"><?php echo $fibostring ?></div> </body> </html> Check out : [din3shie.x10.mx/fibo.php](http://din3shie.x10.mx/fibo.php) Can anybody tell me what's wrong …

Member Avatar
Member Avatar
+0 forum 4

Hello all. For my project I have to create a snack machine with mints and cookies. So far I have gotten an array of cookies with the code below. However an interesting problem I'm having is my output: OATMEAL cookie LEMON cookie null CHOCOLATE_CHIP cookie OATMEAL cookie LEMON cookie null This is the output that I am receiving and repeats for 60 cookie elements. I have no idea how a null element snuck in there. There are only 3 values in the enum class. If anyone could help me point out the problem I would very much appreciate it. Thank …

Member Avatar
Member Avatar
+0 forum 6

Hi, Iam trying to post a form with cookies using [Requests module](http://docs.python-requests.org/en/latest/). When I post the form and see the page with the results, there is an error in the page, saying that I didnt fill one field right. Iam absolute sure I fill that field right. When I post the data with web browser, its all right. I think it must be cookie problem, becose when I disable the cookies in the browser and post the right data, it shows the exact same error when I send it via Python. There is the code: # -*- coding: utf-8 -*- …

Member Avatar
Member Avatar
+0 forum 1

Hi all, I want to get a cookies value from one .aspx.vb page to another .aspx.vb page.but i can not get it. i give the code bellow: This is in:(webForm2.aspx.vb):in this page I set the Cookies value webForm2.aspx.vb (code): Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click Dim str2 As String Request.Cookies.Remove("userInfo") str2 = "myValue" Response.Cookies("userInfo")("userName") = str2 Response.Cookies.Add(aCookie) Dim str5 As String = Server.HtmlEncode(Request.Cookies("userInfo")("userName")) Response.Redirect("webForm1.aspx") End Sub I can not retrieve cookies value from another page :webpage1.aspx.vb: webForm1.aspx.vb (code): If Not Request.Cookies("userInfo") Is Nothing Then Dim aCookie As HttpCookie = Request.Cookies("userInfo") Dim str As String …

Member Avatar
Member Avatar
+0 forum 3

Okay I have a database where it stores the users information, like their login name, email, and password. They can upload videos to my site, when they upload the videos, it saves to a database, the database is set up like this, VIDEONAME EMAIL NAME funny sample@email.com abcd.mp4 It stores the users email who posted the video, and it saves the location of the video when it was uploaded, which is the field called NAME and it saves the name the user gave it once he uploaded the video. Which is VIDEONAME. Now the user can view his the videos …

Member Avatar
Member Avatar
+0 forum 3

Hi Guys I am currently setting up a cookie message to tell users of the site that cookies are being used (EU cookie law) I have managed to get this working on all desktop browsers, however I am having issues with mobile device ie iPhone, iPad, Galaxy tab etc I am using the following to set the cookie once the accept button has been pressed. setcookie("acceptCookies","yes",time()+(86400*60),"/","domain.co.uk"); To detect if a cookie is set I am using if(!isset($_COOKIE["acceptCookies"])) { echo('show cookie message'); } Is anyone able to see if I have missed something so it works on mobile devices, I have …

Member Avatar
Member Avatar
+0 forum 2

I am having trouble with this code: This is the init.inc.php file <?php //init.inc.php file session_start(); $exceptions = array('signup', 'login', 'index'); $page = substr(end(explode( '/', $_SERVER['SCRIPT_NAME'])), 0, -4); // SQL stuff. mysql_connect('SQL host','username','password'); mysql_select_db('database name'); include('user.inc.php'); //$_SESSION['uid'] = 1; if (isset($_COOKIE['username'], $_COOKIE['password'])){ if (valid_credentials($_COOKIE['username'], $_COOKIE['password'])){ $_SESSION['username'] = htmlentities($_COOKIE['username']); setcookie('username', $_COOKIE['username'], time() + 3600); setcookie('password', $_COOKIE['password'], time() + 3600); } } if (in_array($page, $exceptions) === false){ if (isset($_SESSION['username']) === false){ header( 'Location: login.php' ); die(); } } This is the login.php file: <?php include('init.inc.php'); $errors = array(); if (isset($_POST['username'], $_POST['password'])){ if (empty($_POST['username'])){ $errors[] = 'The username field is empty.'; } if …

Member Avatar
Member Avatar
+0 forum 3

Hello, I created a site where you have to log in and it begins a session. I wanted to make a stay logged in feature so I started using cookies. I made it so if there was no session then check for cookies. My site also sends out emails with links. While on the site with cookies enabled, I would go to my email and click the link and it would say that there is no session or cookies. Then if I sign in for a second time and then click the link in the email it says it works. …

Member Avatar
Member Avatar
+0 forum 4

I have a web application that needs the identification or some uniqueness of the machine that is calling it. Based on that "id" of the machine the web application will provide information back relevant to that machine. I can certainly call my website with some unique Query params that will let it know what machines the call is coming from, but that is not practical for this application, since the folks installing it will not have the ability to specify unique parameters for every machine. Ideally, if there was some INI or configuration file on the CLIENT machine that could …

Member Avatar
Member Avatar
+0 forum 3

I've looked everywhere and haven't found a clear step by step tutorial on how to secure sessions/cookies. Here are snippets of my code, i'd like to know how i can improve on session security to prevent fixation/hijacking and cookie safety. This is snippets of code for the user login system. login.php if ($username==$dbusername&&$hashed_password==$dbpassword) { setcookie('username[0]',$username,time()+(60*60*24*365)); setcookie('username[1]',$userid,time()+(60*60*24*365)); if($admin=='1') { $_SESSION['admin'] = 1; } $_SESSION['logged-in'] = 1; header( 'Location: ' . $return ); } logout.php $time = time()-(60*60*24*365); setcookie('username[0]', '',$time); setcookie('username[1]', '',$time); unset($_COOKIE['username']); unset($_SESSION['logged-in']); unset($_SESSION['admin']); I call session_regenerate_id() on everypage, is that correct to stop session fixation/hijacking? session_start(); session_regenerate_id(true); php.ini session.use_trans_sid = …

Member Avatar
Member Avatar
+0 forum 1

A number of the nation's biggest media sites were hit with a lawsuit last week, claiming that they are violating federal eavesdropping and hacking laws by using "zombie cookies." [ATTACH=right]16245[/ATTACH]The technology, created by Quantcast, allows sites to use Adobe's Flash player to reproduce tracking files, even after a user has deleted them, according to [URL="http://www.zdnet.com/blog/btl/big-media-sites-sued-over-use-of-zombie-cookies/37301?tag=mantle_skin;content"]ZDNet[/URL]. The class action suit names ABC, ESPN, Hulu, MTV, MySpace and NBC as defendants, as well as Quantcast. The lawsuit calls Internet users "fish in a fishbowl," completely exposed to Web sites' all-encompassing and wholesale collection of data, which could then be bought and sold. …

Member Avatar
Member Avatar
+0 forum 3

Hello, I am familiar with PHP and MySQL and teaching myself how to create a login script, I am not sure if I am simple missing something or something is worong with the code. I am able to signup a user and submit the data to the MySQL table, It connects to the database ok too, but when I try to login and fetch the data from the table when I click on submit it does not validate correctly, I am using Sessions and cookies. All it does is go to login_process.php, it does not redirect me to index.php. What …

Member Avatar
Member Avatar
+0 forum 7

hi i am developing a website in php actually i want to welcome a user by getting his name in text field and give him an option to choose the desired color in which welcome note displayed i-e(red , green .blue) so how can i do it

Member Avatar
Member Avatar
+0 forum 1

Hi! Im a noob to PHP but had to use it instead of ASP because I couldn't retrieve images from database using ASP + MS Access... Anyways.. I have couple questions: Number 1: How to retrieve and displaymultiple(!) images(jpg) from mysql DB? NUmber 2: I have a main page that displays iframe with multiple images (they are hardcoded for now). When pressing on any image it will redirect to a page with that image and text box for a comment..(thats the plan anyway) . And is it possible to disable redirect option if the user is not logged in (based …

Member Avatar
Member Avatar
+0 forum 1

Hi! Im a noob to PHP but had to use it instead of ASP because I couldn't retrieve images from database using ASP + MS Access... Anyways.. I have couple questions: Number 1: How to retrieve and displaymultiple(!) images(jpg) from mysql DB? NUmber 2: I have a main page that displays iframe with multiple images (they are hardcoded for now). When pressing on any image it will redirect to a page with that image and text box for a comment..(thats the plan anyway) . And is it possible to disable redirect option if the user is not logged in (based …

Member Avatar
Member Avatar
+0 forum 18

Hi Everyone, Hoping someone here can help me fix this problem I have of setting a cookie variable from a databse $id = $row["id"]; variable. This seems to work fine when using session data, but I am trying to use cookies and I am a bit stuck. . . here is the code I have been trying with, you will see where I am setting the cookies, but I need to make the cookie variable = $row ["id"] [code] if ($_POST['sms'] != "") { include_once "../includes/config.php"; // Be sure to filter this data to deter SQL injection, filter before querying …

Member Avatar
Member Avatar
+0 forum 2

I have 2 links ('black' & 'white'). I wish for the user to click on one of these links in order to addClass and removeClass to the body and for that change of body class to persist throughout as the user browses other pages of the website (or indeed on their revisit for a set period after also). I have the addClass/removeClass thing working but don't know how to add the cookie so that the class is carried over to subsequent pages that the user visits. There's a tutorial here [URL="http://www.ilovecolors.com.ar/using-cookies-jquery/"]http://www.ilovecolors.com.ar/using-cookies-jquery/[/URL] that does almost what I want however I can't …

Member Avatar
Member Avatar
+0 forum 2

The End.