Jump to content

asmith

Members
  • Posts

    967
  • Joined

  • Last visited

Posts posted by asmith

  1. this file :

    <?php

    session_start();

    session_register('count');

    $_session[count]++;

     

    $msg="u've been here $_session[count]";

    ?>

    <html>

    <head>

    <title>start a session</title>

    </head>

    <body>

    <?php

    echo $msg;

    ?>

    </body>

    </html>

     

    do not work , when i load this page , the only thing i get is " you've been here 1" , by refreshing the page that "1"  does not change, just 1 again and again ,

     

    but this file :

    <?php

    session_start();

     

    if (isset($_SESSION['count']))

      $_SESSION['count']++;

    else

      $_SESSION['count'] = 1;

     

    $msg="you've been here {$_SESSION['count']} ";

    ?>

    <html>

    <head>

    <title>start a session count</title>

    </head>

    <body>

    <?php

    echo $msg;

    ?>

    </body>

    </html>

     

    it works by refreshing that number add each time, BUT when i close my brower , and open again , the session won't end, and gives me the last number i was refreshing  ! 

     

    what is wrong with the first file ? and why the second do not end the session when i close it ?

  2. i want to make something which my registered users can add/delete/update some records in mysql database, and i may have some e-currancy working , i wanted to know which will be the best and the most secure user identifing option ?

    cookie or session or something else i don't know ?

  3. i have add a line in mysql for a user like :

    GRANT ALL On *.* to john@localhost IDENTIFIED BY "smith";

     

     

    and in the "add user" page , i have

    $connection = mysql_connect ("localhost","john","smith");

     

    $sql= INSERT INTO table_name (username, password) values (....bla bla

    mysql_query ($sql,$connection);

     

     

    i wanted to know when i upload such file to my web site,

    is there anyway for someone who could download these php codes ?

    i mean in this file i have certainly said that there is a john with a password smith user for my mysql ,

    so can anyone download my php code to find out this ?

  4. this book is now trying sessions , i've tried this :

     

    <?php

    session_start();

    session_register('count');

    $_session[count]++;

     

    $msg="you've been here $_session[count] times";

    ?>

    <html>

    <head>

    <title>start a session count</title>

    </head>

    <body>

    <?php

    echo $msg;

    ?>

    </body>

    </html>

     

     

    when i load this page i only see,  you've been here 1 times,

    by refreshing the page that number won't add up ! as the book says !

    pleeease help !!

    the only change i made for sessions was i did a little change in php.ini , session.save_path = c:/temp , now i can see some file in this directory with session type id ,  (have restart apache too)

    but why neither cookie nor sessions are working ?? :((((((

  5. what to do exactlly ?

    $abc=print_r($_cookie)

    and echo it ?

    btw it seems i have no cookie aaa set to bbb , it means no cookie ! maybe i should ask why that cookie function idn't work ? but it has worked, i got no erroe !  ???  >:(  :-[

     

  6. does that make any diffrence?

    at down of that page where $msg = "hello!"

    in the body tag ,

    <body>

    <?php

    echo $msg;

    ?>

    ...

     

    i can't get it working don't know why , the book has written you browser should alert you about recieving a coockie, but i've got nothing, then again i've looked at IE option , i can't find cookie option , but in fire fox the option goes to cookie has checked , nothing wrong is with FF cookie option it is "allowed" .

    what is it i'm doing wrong?

  7. hi

    i'm studing php with a book

    in a "login page" i put these lines :

    if  ($num !=0)    \\  $num for mysql_num_rows which identied the user

    {setcookie("aaa","bbb",time()+1800,"/","127.0.0.1",0);

    $displayblock = "<a href=\"a.php\"> a page </a>";}

    else {$displayblock = "your username and password do not match!";}

    .

    .

    .

    echo $displayblock ;

     

     

    when i load this page and sign in i can see the a page link , but my browser do not warn me about recieving cookie (and no "eye" icon in the status bar (each IE 6 and FF 2))

     

    and in a.php i have at the top :

    if ($_COOKIE[aaa] == "bbb")

    {$msg="hello !!!";}

    else {header("location: /loginpage.html");

    exit;

    }

    .

    .

    .

    and when i click in a page link , it shows up the login page again which means $_COOKIE didn't worked...  please help !!!!

     

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