Jump to content

alejandro52

Members
  • Posts

    87
  • Joined

  • Last visited

    Never

Posts posted by alejandro52

  1. I keep having the same problem when i run my script on the server. the error is

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/alliapop/public_html/ekloges2010/ekloges2010/eisagogi.php:1) in /home/alliapop/public_html/ekloges2010/ekloges2010/includes/session.php on line 1

    I know i have to put session start at he very first line and i did but the problem keeps showing up. What else should i check?

  2. i divide two number but the result is something like 4,5555555. I want to show the two tenths after the , and to round it up so the result to look like 4,56. What is the function to do that? I know it's preaty easy.

  3. No, not quite. Are you implementing your own custom sessions here? If not and you're just using standard PHP sessions you don't need to worry about any of this. Just call session_start and PHP will handle the rest - remember to call session_start() on any page you need sessions though.

    Yes, i know how to use session start and i know how to use just sessions without cookies. My main problem is how am i goiing to restore the session when the user comes back to my web page. Should i store the session name in a cookie and also in a table in my database and check if they match? or should i check if the users ip is the same with that on the cookie?What is the best practice when you want to restore a session after the browser is closed and reopoened?

  4. So step by step what i'm going to do: user types in username and password. with the php post method i check if they are correct. If they are i set the user id and username in the session. I also set the users ip inside a cookie. Now when the user closes the browser the session is destroyed. When the user reopens the browser and comes back to the web page i check to see if the user ip is the same as the user that came back. If it is i set once again in the session the usename and user_id. Is that correct? BTW how come php remebers my username even if my ip has changed?

  5. First of all cookies should never be used to store important/private data, nor be trusted. A user can easily modify a cookie to anything they want. If you store usernames in them, all the user would have to do is modify their cookie and they can be any user they wish. Really the only time you should use cookies is to store non-private/insecure data, like for example page references, 'remember' tokens that are validated server-side, session IDs, etc.

     

    PHP sessions on the other hand are stored on the server and cannot be manipulated by the user. A session ID is automatically generated and stored within the user's cookies to link the user to the session. This isn't "trusted" however - additional checks are done to verify the user hasn't just stolen somebody else's session ID. You can store private data (to a degree) in these relatively securely. Of course if there's a major security hole in your system then the data may be compromised.

     

    Thanks for the reply, you got me kind of covered. But if i use session, when the browses closes so does the session. How am i supposed to restore the session when the user reopens the browser. If i store the session id inside a cookie whould that be ok(is it true that firefox does that automaticaly unlike iexplorer)? And how am i supposed to prevent another user from stealing the session id.

  6. What is the best practice to use cookies and sessions? Should i create a cookie and keep inside the cookie the name of the username the user has logged in or a session? How am i supposed to compine theese two? Is there any example or a tutorial on this? For example how does php freaks sessions and cookies work.

  7. I have the following problem. I have some div tags and inside of the some other div tags like this

    <div>
         <div id="div1" float:left>
                  (some other div tags)
         </div>
          <div id="div2" float:right>
                  (some other div tags)
          </div>
    </div>
    

    the problem is that in firefox the div2 floats right but in iexplorer goes below the div1 tag. a tested with javascript to find the parent nodes and they had different in iexplorer and different in firefox. does any one know what may cause the problem?

  8. I have two one database with tables users and blogs. The two are connected with user_id. What i want is to create a table with ratigns witch stores the rating of the user to the blog(like the rating of the youtube user to the video). What is the best way do that. Create a table witch stores the user_id, blog_id and have the rating inside?What if the ratings are a lot?

  9. I want to return an array using ajax to javascript.

     

     if(xmlhttpmail.status ==200){	  myarray = xmlhttpmail.responseText;	   for(i=0;i<10;i++){		  document.getElementById("mylabel").innerHTML += myarray[1];; 	   }  }else{	   document.getElementById("mylabel").innerHTML=xmlhttpmail.status;  }

     

     

     

    if(isset($_GET["id"])){$id=$_GET["id"];$sql="SELECT * FROM keimena WHERE keim_id = '".$id."'";$result = mysql_query($sql);$num = mysql_num_rows($result);$row = mysql_fetch_array($result);if($num == 1){	echo $row;}else{	echo false;}}

     

    As you can see i awant to return an array but it doesn't return anything.

  10. I want in my form to validate on the fly(when the user enters the user name) to validate if the user name exists or not. How am i supposed to check if the field name is the same or not with a name in the database.Should i use ajax or javascript? is there any simple example on how to do that.

  11. I want to create a page where php reads the database and returns the data.in rows. if the data in the database are more than 10 i want the user to click on a button and return the next 10 data in the database. what comand should i pass to go to the next 10 arrays in the row?

×
×
  • 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.