jimfog
-
Posts
1,803 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by jimfog
-
-
well, what is missing above(and the one that I do not know how to implement it ) is an if statement that checks if there is a cookie in the user's computerand act appropriately depending on that fact. If there is not a cookie, I go and set one(the code is ready for that-it is in the very beginning of the script). The problem is how implementing the if logic IF there is already a cookie in the user's computer.The problem is that I must take into consideration that this must be done before output. How am I going to do this if statement-integrating it to the one above?
-
Yes I have a problem in my design/logic. WHat I am trying to do-in a few words- is that I am trying to fit in a script the login form, the if statement that it was filled and an if statement that checks if a cookie has been set in the user's computer. I have managed the first 2 but I am having difficulty with the setcookie if statement as there is the constraint that this has to be done before any output sent. here is some code-not complete:Why? That sounds like a problem in your design.<?php session_start();require 'userauth_admin.php'; if(!empty($_POST['remember'])) { $conn=db_connect(); $identifier=uniqid(); uniqid_to_db($identifier); setcookie('cookiename', $identifier, time() + 60 * 60 * 24 * 7, '/', '' , true); }?> <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="css/admingeneral.css"/> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" ></script> <script type="text/javascript" src="js/js-code.js"></script> </head> <body> <div id="wrap"> <?php require 'output_functions_admin.php'; try { if (isset($_POST['username'])&& (isset($_POST['password']))) { if(empty($_POST['username'])&& (empty($_POST['password']))) { throw new Exception('Ουπς, δεν συμπληρώσατε τα στοιχεία -πίσω στην φόρμα λοιπόν για να τα συμπληρώσετε.'); } else { $username = $_POST['username']; $passwd = $_POST['password']; if (login($username, $passwd)) { $_SESSION['valid_user'] = $username; output_header('output_header_list',$username); ?> <div id="cust_icon"><img src="Images/administrator_40.png" alt="customers" /></div> <?php //output_customers(); output_buttons(); } ?><div id="leftcolumn" align="center"> <div id="calendar_div" name="calendar_div"> <?php output_leftside_cal(date('n',strtotime($newdate)),date('n',strtotime($newdate)),date('Y',strtotime($newdate))); ?></div> <?php output_leftbuttons(); ?> </div> <div id="timeslots"> <?php output_day();?> </div> <?php } } else output_login_form(); }
sorry for the much code.
-
I am trying to set up a persistent login mechanism where I have to cal setcookie/session start before any output. The problem is that, the way I see it output, will come out soon, either way,let me explain:
if(!empty($_POST['remember'])) { $conn=db_connect(); $identifier=uniqid(); uniqid_to_db($identifier); setcookie('cookiename', $identifier, time() + 60 * 60 * 24 * 7, '/', '' , true); }session_start();?>
I mean that the code is separated into 2 bockls, whether the user ticked the remember me option and when not.If the user did not then not setcookie will be called,here, in this case no output is produced-BEFORE sessionstart() is called- so we do not have problem here. But, when the user ticks the remember me option output HAS to be produced-that is located BEFORE sessionstart() in the code and as a result the familiar message "headers already sent" appears. It should be sth easy to fix-I am just confused a little. The problem is placing the code in the proper place in the script, something which depends when setcookie/sessionstart gets called. I want to avoid producing the whole output of the page, when remember me is ticked and when not, using an if...else statement I hope I was clear...if not, ask more info.
-
oh......
-
Here is a function that contains an insert statement, which statement does not achieve inserting the data into the db table:
function uniqid_to_db($uniqid) { $conn = db_connect(); $result = $conn->query("insert into session [(randnumber)] values values($uniqid)");}
Do you see anything wrong abobe? Randnumber, is the second column in the session table.I have tried various syntax combination but with no result.
-
cookie name
in PHP
pass_hass Is the name. DO the following. Call setcookie() with the required paramters, use fiddler and in it, you will see the name you putin setcookie(). In fiddler, you will see the name in the following way. name=value(where name is the name you used in setcookie)
-
cookie name
in PHP
No need to bother, I found it.
-
cookie name
in PHP
I am using fiddler to see details about the cookie sent from w3scools forums. My question is form where I will see the name of the cookie? I mean the name the we put on the setcookie function. The only thing I see is(along with some other things) is pass_hass.....followed by a random number.
-
According to a view, we must not use the username but some other random number, an identifier. What is your opinion about the above?
-
I am looking into ways to hash the username(to use it in the setcookie function). And I am trying to examine what is the route I should follow. Using a function like sha1 provided by PHP or something more advanced like phppass http://www.openwall.com/phpass/. What do you think should I do?
-
facebook, on the right, has the messenger pane-I suppose you know that. I want to make sth similar on my site. My feeling is that I will do this using javascript and I want to ask if my logic to implement this sounds ok. Probably it is an if statement that upon clicking an element, the pane appears and at the same time div maincontainer(this is the element's name of Facebook's central column) becomes smaller-by altering some css. What do you think about the above logic?
-
-
-
I am using fiddler to see details about the cookies. And here is what has caught my attention. When the user "lands" in the first page and sees the login form I start a session. I notice, in fiddler, the sessionID after 3-4(I do not know about more that that) times the stays the same. I tought/think the sessionID changes every time a session is started. How can the info of fiddler can be explained. We are talking here about only session,nothing to do with persistent login mechanisms.
-
-
-
-
Strange...just realized that the above code checks both the key and the value of the POST array.Meaning...isset($_POST) just checks for the key. I should have noticed it earlier... such a crucial detail.If the code above checks if the form fields have been filled then what exactly the code below does?function filled_out($post){ // test that each variable has a value foreach ($post as $key => $value) { if ((!isset($key)) || ($value == '')) { return false; } } return true;}
Does the above code does the same thing with a different way?
-
session start
in PHP
Now it is more clear-I just now want to work with code and see it from a practical standpoint. I maybe post some code later-here, or I might open a new topic, but for now I got the answer I was searching for.
-
session start
in PHP
Yes I know, in the other thread though, this was not the main issue of discussion-other was.the rule of thumb is where you will need to work with $_SESSION array you will need to start it.this has been answered already in different thread.
And to avoid confusion...sure we are going to put session start in the page where the form is, even if the form action is in a different page? I want to stress the above.if you need to show the login panel to only the user who are not signed in then you will need to start the session cause you will check the authentication is session. same goes for sighn up page. if you dont want to let any sighned in user enter in sighnup page (show sighn up page only to guest or logout user), you will like to check its authentication and do action depends on that. so it is all depend on how you are going to use it. -
session start
in PHP
As far as I know, session start goes to every page the user might or might not be logged in. Does that include also the page where the signup or login form is located? Let us assume for now, that the form action are in a different page-both for the login form and the sign up form.
-
Just noticed that the effect I want to achieve appear only in Chrome. in FF and IE, the placeholder text, onfocus, dissapears.
-
It is clear, but it does not work, here is some code, which according to you will do the job and tell meif you find anything wrong at it:
body{margin: 0 0px;font-family: georgia;color: #999999;font-size: 12px;background-color: #e1e1e1;}::-webkit-input-placeholder { color:#333333;font-size: 12px;}
According to what you are saying the above should work.
-
I want the placeholder text color change ONFOCUS-go see Facebook, the search field on top of the page.
setcookie...output problem
in PHP
Posted · Edited by jimfog