Jump to content

sofia403

Members
  • Posts

    78
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

sofia403's Achievements

Member

Member (2/5)

0

Reputation

  1. ok, thank you guys, much appreciate the advise Guru. have an awesome day
  2. Thanks for reply. I will try to explain this again maybe it will make a little more sense at what I'm trying to achieve. Again lets say we have two users(UserA and UserB) who use the same computer at home. They both use the same browser to access a website, but each have their own account. Now UserA logs in to edit his profile in one tab, then while he is still logged in user UserB tries to edit her profile using the same browser only using a different tab. When UserB loged in to her account and if we go back to UserA tab and refresh it it will beUserB information. Im trying to prevent this from happening. So if one person is still logged in in one tab, the other person would be restricted to log in or the first one would be restricted to view the information about the second. does that make sense?
  3. I have a problem with login system. I have two users, userA and userB in the same computer. userA enters to his account in one browser; userB gets access to his account in the same browser. My system thinks that now userB is also userA and userA is still connected to its own account but his name appears as userB. If these two users get access into different browsers, there is NO problem. Do you have any idea how would i fix this so that users are restricted to only having one account the logged in to from one browser window? thanks Welcome.php <? session_start(); session_id(); if (empty($_SESSION['username'])){ header("location:login.php"); exit; } ?> login.php <? include('config.php'); session_start(); if(isset($_GET['reg'])){ $reg=$_GET['reg']; }else{ $reg=""; } if($reg==1){ $msg1="<font color=\"#009900\"><b>Your account has been created, please login</b></font>"; }elseif($reg==2){ $msg1="<font color=\"#009900\"><b>You have been successfully logged out.</b></font>"; } if(isset($_POST['submit'])){ if( empty($_POST['uname']) && (empty($_POST['upass']))){ header( "Location:Messages.php?msg=1" ); exit(); } //transfer to shorter var $n=mysql_real_escape_string($_POST['uname']); $p=mysql_real_escape_string($_POST['upass']); //put in session vars $mytime=time(); $mytime=date("H:i:s A",$mytime); $_SESSION['time'] = $mytime; $_SESSION['status'] = 'logged'; $_SESSION['username'] = $n; //goto next page header("location:welcome.php"); exit; }else{ $_SESSION['status'] = 'not logged'; header( "Location:Messages.php?msg=2" ); exit(); } } ?>
  4. awesome! thanks, i will try this approach.
  5. that makes sence and yes you exactly right thats how i have it. thats my first time designing this kinda stuff so im still learning along the way. lol. so if i would want to have 2 separate pages that show 2 separate things i can store all my user information in 3rd table and grant permissions which table they can access?
  6. I guess im worried since i have different logins on a website. the way it works now i have several tables and each has unique user name and password so if user will create 2 accounts for 2 separate tables and then log in from same browser that will overwrite one of his sessions.
  7. So can i changed the cookie name by adding session id along with it or something, or i can leave it the way it is? and yes its happening only with same browser. same computer and different browser works no problem.
  8. could that be a cookie issue?
  9. Hi, I have two login tables for visitors, different login scripts for both Table1 - Username1 Table2 - Username2 If i login with username1 and then login with username2 without loginout either of them, and if i do a refresh of the page of Username1 i will get transfered to Username2 page (without all the information field, but with all the table names ) Basically the previous username gets transfered to the new one that i sign in with even though they in different tables. What is causing this and how can i prevent this? Does that makes sence? I can provide additional information if needed. Oh i also should add - its only an issue if i use same computer to login to different accounts, it works as it suppose to if i use different computers. Thank you.
  10. Ok so for data istelf it would be user input values. those are pulled from db. So for Status = "Approved" or "Disapproved" or "Withdrawn" uname = "username" country = "country" And I'm afraid it has to be JSON. the whole grid works in that format. You can look up Flexigrid. Theres not much info unfortunately out there on it.
  11. this is for my grid. POST2.PHP gets values from db and posts them to the grid and INDEX.PHP display them. POST2.PHP $sql = "SELECT Status,uname,countryif ($rc) $json .= ","; $json .= "\n{"; $json .= "Status:'".$row['Status']."',"; $json .= "cell:['".$row['Status']."','".$row['uname']."'"; $json .= ",'".addslashes($row['country'])."'"; INDEX.PHP <script type="text/javascript"> $(document).ready(function(){ $("#flex1").flexigrid ( { url: 'post2.php', dataType: 'json', colModel : [ {display: 'Status', name : 'Status', width : 85, sortable : true, align: 'center', renderer:negativecontrol}, {display: 'Username', name : 'uname', width : 80, sortable : true, align: 'left'}, {display: 'Country', name : 'country', width : 60, sortable : true, align: 'left'}, I tried using this code, but cant get it to work. function negativecontrol(val,cell,row){ if(val=='Approved'){ return "<span style='color:red;'>"+val+"</span>"; // OR // $(cell).css('color','red'); return val; // we have to return the value to be printed; }else{ return "<span style='color:green;'>"+val+"</span>"; // OR // $(cell).css('background-color','red'); return val; // we have to return the value to be printed } }
  12. thanks MrAdam i changed that now but it has no affect and still not working.
  13. Hi fugix and arbitter, thanks for your responses, however its still not working and im not quite sure if thats what i can use in this situation. Basically i have a mysql db and a grid that displays the data from db. Grid is similar in concept with the Ext Grid only its pure jQuery. first I just query out what we need from mysql and pass it on to the grid with POST2.php and then INDEX.PHP display the data as shown below. and i just want the cells that have certain values to be highlighted. At the very bottom im quoting a code how to supposedly get it to work but im not having luck implementing it. POST2.PHP $sql = "SELECT Status,uname,countryif ($rc) $json .= ","; $json .= "\n{"; $json .= "Status:'".$row['Status']."',"; $json .= "cell:['".$row['Status']."','".$row['uname']."'"; $json .= ",'".addslashes($row['country'])."'"; INDEX.PHP <script type="text/javascript"> $(document).ready(function(){ $("#flex1").flexigrid ( { url: 'post2.php', dataType: 'json', colModel : [ {display: 'Status', name : 'Status', width : 85, sortable : true, align: 'center', renderer:negativecontrol}, {display: 'Username', name : 'uname', width : 80, sortable : true, align: 'left', renderer:negativecontrol}, {display: 'Country', name : 'country', width : 60, sortable : true, align: 'left', renderer:negativecontrol}, QUOTE so the scenerio is from our data we get the active value as 1 and 0 , but we need to print "True" or "False". So first of all we define a function for our renderer. function truefalse(val,cell,row){ // val => value of the cell // cell => cell itself // row => parent tr tag of cell if (val==1){ return "True"; }else{ return "False"; } } Be careful! you have to return at least a variable or a value to print something in your cell. otherwise cell will be empty. so after we defined our function we can add the property to our colModel {display: 'Active', name : 'Active', width : 80, sortable : true, align: 'center', renderer:truefalse} after we save and refresh the grid, you'll see that instead of 1,0 values in Active column "True" or "False" texts. You can populate this render functions as much as you want for a column. here is another example ( I'll just give the function because the renderer property will be the same way) function negativecontrol(val,cell,row){ if(val<=0){ return "<span style='color:red;'>"+val+"</span>"; // OR // $(cell).css('color','red'); return val; // we have to return the value to be printed; }else{ return "<span style='color:green;'>"+val+"</span>"; // OR // $(cell).css('color','green'); return val; // we have to return the value to be printed } } function negativecontrol2(val,cell,row){ if(val<=0){ $(row).css('color','red') // makes all row red }else{ $(row).css('color','green'); // makes all row green; } }
  14. hi arbiter, yes i just want the cell to be colored lets say green or red based on the value in it. how do i find out the id of the cell? i have a grid with column 'Status' and there i have all this values. {display: 'Status', name : 'Status', width : 85, sortable : true, align: 'center'}, {display: 'Username', name : 'uname', width : 80, sortable : true, align: 'left'}, {display: 'Country', name : 'Country', width : 60, sortable : true, align: 'left'}, {display: 'Date', name : 'Date', width : 76, sortable : true, align: 'left'}
  15. Hi, i was wondering if someone could help me out with some javascript function. i have very little knowledge on this topic and searched everywhere to solve my problem, but cant find the answer still. Im thinking its probably a very straight forward for some one who knows this stuff. basically i have a grid that pulls data from my sql, i would like some of the cells to be highlited based on the value in them. So for that im using this function below which im thinking should color the cell to red if value is "disapproved" or green if its some other value, function negativecontrol(val,cell,row){ if(val=='dispproved'){ return "<span style='color:red;'>"+val+"</span>"; // OR // $(cell).css('color','red'); return val; // we have to return the value to be printed; }else{ return "<span style='color:green;'>"+val+"</span>"; // OR // $(cell).css('color','green'); return val; // we have to return the value to be printed } } then i just call that function like so, but still it doesnt work....please can someone point me in the right direction here? thank you! {display: 'Status', name : 'Status', width : 85, sortable : true, align: 'center', renderer:negativecontrol},
×
×
  • 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.