I'm getting ` Session: Error while trying to free lock for ci_session` show up in the error log a couple times a minute, sometimes, and every 15 minutes other times. Using Redis for sessions. It's not happening on a different server that has almost the same code base and is sharing the same Redis server, albeit with a different session name. I'm using session_write_close() on every page as soon as I'm done handling sessions.

Member Avatar
Member Avatar
+0 forum 5

Hi i am currently building a admin section for my website but i am stuck at a certain point, right now my user authentication is working and my form validation is working great, when i log in as admin i want it to display the admin dash and when a user logs in i want to show the dash but with diffrent links. So what i want to do now is just modify my current login function to accommodate the diffrent roles here is my login function: public function do_login() { $data['error'] = 0; if ($_POST) { $username = $this->security->xss_clean($this->input->post('username', …

Member Avatar
Member Avatar
+0 forum 1

Hi guys i have simple captcha that seems to working but the only problem i have seems to be with the callback function on the validation have a look at the captcha: function index() { $this->load->helper('captcha'); $this->load->library('form_validation'); //Input field, Friendly name, Attributes $this->form_validation->set_rules('name', 'Name', 'trim|required'); $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email'); $this->form_validation->set_rules('number', 'Contact Number', 'trim|required|numeric'); $this->form_validation->set_rules('userCaptcha', 'Captcha', 'required|callback_check_captcha'); $userCaptcha = $this->input->post('userCaptcha'); //Check the fields for Validation Errors if ($this->form_validation->run() == FALSE) { $random_number = substr(number_format(time() * rand(),0,'',''),0,6); $values = array( 'word' => $random_number, 'img_path' => './captcha/', 'img_url' => base_url().'captcha/', 'img_width' => 140, 'img_height' => 32, 'expiration' => 7200 ); $data['captcha'] = create_captcha($values); …

Member Avatar
Member Avatar
+0 forum 1

Hi all okay so when i click on my home page on my login button it takes me to my login screen that all works well but when i submit the form it just reloads the page and does not redirect to the page specified in my controller. Also the error i want to display on the form does not work it gives me a parse error and i know that it is correct on the page. Here is my controller <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Users extends CI_Controller { public function login() { $data['error'] = …

Member Avatar
Member Avatar
+0 forum 3

Hello every one, I want develop an android application that should be implement seperate xml views for separate users when they are logged in. I don't know which package will be used in it and what are they called. And data of each user should be stored in cloud database. I need help in it.

Member Avatar
Member Avatar
+0 forum 1

Hi, I am working on an aplication which contains two different portals (admin and members). `http://localhost/app/` is used for the members login and `http://localhost/app/admin` is used for admin's login. When I log in into members and admins portal both works fine but if I logout from one portal another portal logged out automatically. I checked that the session file created in `/tmp/` directory stores the sessions information for both the portals in a single file which causes the above problem. The work around I think is to save the session information of both portals in different directories. I searched a …

Member Avatar
Member Avatar
+0 forum 4

I have the following code in my php files, but i am having a following error while loading my page? "Notice: Undefined variable: username in C:\xampp\htdocs\fyp\cms\cms.php on line 48" My page is successfully loading up, but username is not being shown in the page and the error is popped up in it. Can someone tell whats the error here? login.php <?php include_once("../includes/connection.php");?> <!DOCTYPE html> <?php session_start(); ?> <html lang='en'> <head> <meta charset="UTF-8" /> <title> HTML Document Structure </title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div id="wrapper"> <?php $current_page = $_SERVER['PHP_SELF']; ?> <form name="login-form" class="login-form" action= "<?php echo $current_page;?>" method="post"> …

Member Avatar
Member Avatar
+0 forum 7

I am getting a very mysterious bug when I run my java website in Browser Mode: IE9 Compatibility View - the sessions stop working and I have no idea why. I don't think there is a tag or any code that I can include in my website that can force the client browser not to run in Compatibility View. I am using this tag to force the browser to pick the latest Document Mode though: <meta http-equiv="X-UA-Compatible" content="IE=edge"> I am using this code for setting the session in my LoginController.java: import javax.servlet.http.*; HttpSession session = request.getSession(true); session.setAttribute("userObj", curr_user); and this …

Member Avatar
Member Avatar
+0 forum 3

Im developing a web chat and was wondering, when Im displaying recent messages how do I get individual usernames to display. For example: when i log in as a user and send a message, it shows that its from me, but when I log in as a different user, all the messages are from that particular user ? Im not sure how to make it show the different user names. Any help would be apreciated. Thanks, Jessica.

Member Avatar
Member Avatar
+0 forum 31

<?php session_start(); $_SESSION['form'] = $_POST; ?> <?php if(isset($_POST['First'])) { echo htmlentities ($_POST['First']); }?> <?php */?> <tr valign="baseline"> <td nowrap="nowrap" align="right">Last Name:</td> <td><input type="text" name="Last_Name" id="Last_Name" autofocus value="<?php $_SESSION['form']['Last_Name'] ?>" placeholder="last name" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">City:</td> <td><select name="LookupCity" id="LookupCity"> <option value="" <?php if (!(strcmp("", $_GET['City']))) {echo "selected=\"selected\"";} ?>>Select from menu</option> <?php do { ?> <option value="<?php echo $row_fmCity['City']?>"<?php if (!(strcmp($row_fmCity['City'], $_GET['City']))) {echo "selected=\"selected\"";} ?>><?php echo $row_fmCity['City']?></option> <?php } while ($row_fmCity = mysql_fetch_assoc($fmCity)); $rows = mysql_num_rows($fmCity); if($rows > 0) { mysql_data_seek($fmCity, 0); $row_fmCity = mysql_fetch_assoc($fmCity); } ?> </select> <a href="ZipLookup.php?Last Name=<?php echo $Last_Name ?>">select</a></td> Please give an example.

Member Avatar
Member Avatar
+0 forum 21

Ok, I may be missing something very easy but when I submit and query the database the session doesn't set for some reason and I'm sent back to admin.php per instruction of my index.php file. Could someone please give this a look over, maybe it's a very simple fix, but I've been stuck for a while now. When I enter my username and password, I do not receive an error, however I am sent back to the admin_login.php file. I am aware $_SESSION['manager'] isn't being set but I can't figure out why. Please help. Thank you. #1 admin_login.php <?php // …

Member Avatar
Member Avatar
+0 forum 19

can any body explain how to manage sessions in the pages that without login no user must access any page and if tries to access using browser address bar then redirect it's location to login page.....pls do reply what to check to manage this by using session......

Member Avatar
Member Avatar
+0 forum 1

Hi guys, i have an application that seats on a single webserver that depends on a third party application running mssql, so i use mssql over free tds. now i have to scale this site so i have to think about how to handle the sessions. i ma basically looking at using the db(mssql) which i think is going to be the slowest of my options. b) memcached, which i think is faster but i read something about loosing the data when u need to reboot a box and c) reddis which i just found out about. does anyone have …

Member Avatar
Member Avatar
+0 forum 1

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

Hello This is a simple php login script with sessions. It connects to mySQL for usernames and passwords. I’m using a variation of the code from [url]http://www.phpportalen.net/wiki/index.php?page=Enkel+Inloggning+med+Mysql+och+sessioner+-+Komplett+kod[/url] (index.php is the relevant part) Here is my code (my script is called login.php): [code=php] <?php session_start(); // Always at the top include "conn.php"; // Databaseconnection include "functions.php"; // Functions // Login if (isset($_POST['submit'])){ $_POST = db_escape($_POST); $passwd = safepass($_POST['passwd']); $sql = "SELECT id FROM members WHERE user='{$_POST['user']}' AND pass='$passwd'"; $result = mysql_query($sql); // Didn't find username and password if (mysql_num_rows($result) == 0){ header("Location: login.php?badlogin="); exit; } // set session with unique index …

Member Avatar
Member Avatar
+0 forum 11

Hi Im trying to create a web based quotation system with php and mysql. I wanted to create something like shopping basket where people store the items and when they click generate quote the system will display the quote of the items and qty selected. Only when the person has clicked generate quote I wanted to store the quote on the system. I was thinking to store the items and qty in the session until the person has clicked generate quote. so finally my question. Is it ok to store the items and qty the user has selected in the …

Member Avatar
Member Avatar
+0 forum 1

Hello there i would like someone to have a peek at this code and does it solve the question correctly ?? Are there any mistakes or any improvements i could add ?? Also i struggle in this questions as i do not get it fully(in fact i dont get what sessions ment to do here), any help appreciated :) Question: Add user authentication. Modify checkuser.php so that a user can log in, and modify search.php so it will only run for an authenticated user logged in with checkuser.php.(Use sessions) Add JavaScript user input form validation to the log-in form. checkuser.php …

Member Avatar
+0 forum 0

Simple table like this [CODE] CREATE TABLE IF NOT EXISTS `users` ( `id` int(255) NOT NULL AUTO_INCREMENT, `username` varchar(25) NOT NULL, `password` varchar(25) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=101 ; [/CODE] [CODE]<?php session_start(); function insert(){ if(isset($_POST)&& isset($_SESSION['post_vars'])){ $insert_query="insert into users set username = '".$_SESSION['post_vars']['username']."' , password ='".$_SESSION['post_vars']['password']."'"; $result = mysql_query($insert_query); if($result) {echo "<h1> successfully Added"; session_unset(); session_destroy(); return; } } } foreach($_POST as $key => $value) { $_SESSION['post_vars'][$key] = $value; } $connection = mysql_connect('localhost','root','***'); if(!$connection)die('could not connect to the server check'.mysql_error()); else{ if(!$db=mysql_select_db("my_data",$connection))die('<p>error connecting to the database'.mysql_error()); else { $query_all="select * from users"; $query = "select …

Member Avatar
Member Avatar
+0 forum 1

Hi all, I have question about sessions in web services (VB). I created a function that allows me to login to my web service. I created a session here and added some values I retrieved from a stored procedure. The code will explain more :) [code=vb] <WebMethod(EnableSession:=True)> _ Public Function GebruikerLoginWeb(ByVal strGebr As String, ByVal strWachtw As String) As Boolean Try Dim fm As New Methods_Functions() Dim dsLBPHL As DataSet dsLBPHL = fm.GebruikerLogin(strGebr, strWachtw) If dsLBPHL.Tables.Count > 0 Then boolStatus = True Session("Gebruikersnaam") = dsLBPHL.Tables(0).Rows(0)(0).ToString dsTemp = fm.GebruikerSelecteerAlle(Session("Gebruikersnaam").ToString) Session("Wachtwoord") = dsTemp.Tables(0).Rows(0)(1).ToString Session("Voornaam") = dsTemp.Tables(0).Rows(0)(2).ToString Session("Achternaam") = dsTemp.Tables(0).Rows(0)(3).ToString Session("Adres") = dsTemp.Tables(0).Rows(0)(4).ToString …

Member Avatar
Member Avatar
+0 forum 1

Hi all, I came to think of something in my code, which might cause a problem, but I am not sure. After a user of the site has succesfully put a product in the shopping cart - I set a session['cart_succes'] = 'something'; - to display to the customer (after I have used headers to redirect to another page, and avoid to add extra products if the user refreshes the page.) How does sessions work, if lets say - there is another customer on the webpage. If he/she browses to same same page as another customer has just been to, …

Member Avatar
Member Avatar
+0 forum 2

Hello all, I've been having an issue with php variables recently. I don't have much experience working with sessions, but I know that domain.com and [url]www.domain.com[/url] are viewed differently when working with sessions. The problem I have is with included files. I am calling .../logbook/header.php from ...logbook/Graphs/index.php. When I use include_once('header.php') from files within logbook/, I am able to use the session variables, but when I include the full path in the include_once() command, I can't access the session. How can I set the session so that it is accessible to both 'header.php' and '.../full path/header.php'?

Member Avatar
Member Avatar
+0 forum 6

Hi, I want to get information from each session set, EXCEPT when the session name is 'navigation': So basically: Create an exception for the session called 'navigation'.. [CODE] foreach ($_SESSION as $name => $value) // $name = navn på session: f.eks. 1 eller 2 - $value indeholder antallet der er i kurven) { if(substr($_SESSION,0,10) != 'navigation') // Doesnt work { echo $name .' har ' .$value.' varer<br />'; } } [/CODE] How do I do this, without getting the information from the session called 'navigation'? Regards, Klemme

Member Avatar
Member Avatar
+0 forum 4

My PHP Session Log-in and log-out works fine but this is the problem I have a site consists of admin folder and outside the admin folder are the customer page files. both of them has sessions for log-in and log-out purposes but it acts so WEIRD because if I'm running on a same browser... the admin page log-in data value copies to customer page file and vice versa (from customer to admin page). If I set to run the admin or the customer page file on a different browser it seems to work fine but what I want to know …

Member Avatar
Member Avatar
+0 forum 5

On a new site I'm making, sessions are not working. They were working previously, and stopped without a single change of the code. Once a login goes through the verification, it runs: [CODE]$_SESSION['uid'] = getIdFromEmail($email);[/CODE] getIdFromEmail is a function I built to get the user's ID from their email address. But the session does not register, as when I do [CODE]print $_SESSION['uid'];[/CODE] I get "Notice: Undefined index: uid". I did check by printing "success" to make sure the login was OK. Of course, I have a session_start at the top of the page. - Aaron.

Member Avatar
Member Avatar
+0 forum 2

I have literally been banging my head on my keyboard out of frustration. I'm trying to display PHP sessions as values in my php form, but it's not going so well. here's what I have: [CODE]<?php session_start();?><html> <head> <title>Create An Event</title> <style> label {float: left; width: 100px;} input[type=text],textarea {width: 210px;} </style> </head> <body> <form enctype="multipart/form-data" action="" method="post"> <p><label for="name">Event Name</label><input type="text" name="name" value="<?php echo $_SESSION['name'];?>" /></p> <p><label for="description">Event Description</label><textarea name="description"><?php echo $_SESSION['description'];?></textarea></p> <p><label for="location">Location</label><input type="text" name="location" value="<?php echo $_SESSION['where'];?>"></input></p> <p><label for="">Start Time</label><input type="text" name="start_time" value="<?php echo $_SESSION['begin'];?>"></input></p> <p><label for="end_time">End Time</label><input type="text" name="end_time" value="<?php echo $_SESSION['end'];?>"></input></p> <p><input type="submit" value="Create Event" /></p> …

Member Avatar
Member Avatar
+0 forum 4

I'm seeing a problem where some $_SESSION variables are passed from one page to another, and others are not. The session is setup on login, with user identity held in $_SESSION["id"]. At a later date, I want to shift the identity to another, subordinate account. The change is handled by a simple form that is processed by the following snippet: [CODE] <?php // $_SESSION["id"] is initially 2 if (isset($_POST["id"])) { $member = cMember::retrieve($_POST["id"]); // pull new user object from DB $_SESSION["foo"] = $member->getField("me_id"); $_SESSION["id"] = $member->getField("me_id"); $_SESSION["bar"] = $member->getField("me_id"); redirect("blank.php?".$_SESSION["id"]); //redirect($dest); } ?> [/CODE] and $_SESSION["id"] is being properly set, …

Member Avatar
Member Avatar
+0 forum 6

Hi, well im working on a project for school but I can't seem to get it to work. Its an app that is connected to a DB with 3 tables, this is my sql syntax of the db: [CODE] Table structure for table `income` CREATE TABLE `income` ( `idincome` int(11) NOT NULL AUTO_INCREMENT, `DoI` date NOT NULL, `Quantity` int(11) NOT NULL, `Type` varchar(45) COLLATE latin1_general_ci NOT NULL, `Comment` varchar(45) COLLATE latin1_general_ci NOT NULL, `iduser` int(11) NOT NULL, PRIMARY KEY (`idincome`), KEY `iduser` (`iduser`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1; Table structure for table `outcome` CREATE TABLE `outcome` ( `idoutcome` int(11) …

Member Avatar
Member Avatar
+0 forum 1

Hello. I'm wondering if someone could help me. I have a simple like/dislike voting voting system. Everything works fine but a user is able to click both up and down freely without checking if they have voted. So what I'm going for is 'Php sessions' because I dont want to clutter a table in mysql with ips and its superficial voting. I'm using ajax to avoid a refresh which calls on two scripts to add the +1 count to the columns in my table (up/down) up.php [CODE] <?php include("dbcon.php"); if($_POST['id']) { $id=$_POST['id']; $id = mysql_escape_String($id); $sql = "update comments set …

Member Avatar
Member Avatar
+0 forum 1

Hey looking over sessions was confusing the hell out of me but I found my solution again on this forum... now I have a session that as a time out and 'logs out' the user after 10 mins so next time they try do something it takes them to the log in page. I was wondering if it is possible to have a pop up after 10 mins of inactivity to tell them they are being logged out and asking if they want to log back in, and also one prior to that saying your about to be logged out... …

Member Avatar
Member Avatar
+0 forum 1

Hi All, I am trying to create a form using sessions so that the submit button is only submitted once in a two minute duration. I need the form to still complete the onclick action so that a calculation happens, but I only want the mail() function to send an email only once in that two minute duration.. even if the submit button is clicked more than once... here is what I got so far.. but doesnt work..?? What am I missing..?? <?php session_start();?> if (!isset($_SESSION['form1'])) $_SESSION['form1'] = time(); if (time()-$_SESSION['form1'] < 120) die('Post limit exceeded. Please wait at least …

Member Avatar
Member Avatar
+0 forum 12

The End.