Professional Web Applications Themes

cookies and php - PHP Development

Hi Is it possible to add information (username + password) into a cookie so that i can get to that information when it is required, eg somebody logs on, and on every page for that information in the cookie? i would use mysql but blueyonder dont support it. Thanks...

  1. #1

    Default cookies and php

    Hi
    Is it possible to add information (username + password) into a cookie so
    that i can get to that information when it is required, eg somebody logs on,
    and on every page for that information in the cookie? i would use mysql but
    blueyonder dont support it.
    Thanks


    djdaz Guest

  2. #2

    Default Cookies and PHP

    I am looking to store a cookie on a client (machine) and then when the
    client revisits, to populate part of the form with data held on my
    server (ok this is for a my course).

    A I will need to get the initial data from the client.
    B Store it on my server with an account number.
    C Create a copy on the host or alternatively an account number.
    D When the user logs back on I will need to populate the form with
    the data they already entered.

    Any pointers or help appreciated.

    J
    James Guest

  3. #3

    Default Re: Cookies and PHP

    James wrote:
     

    Hi James,

    That is a real nice client/server assigment. :-)
    For details go to www.php.net

    Some pointers:

    Okay, so start by making a HTML page that contains a form.
    Let's say it contains two variables: name and age.
    (send.html)
    Make the action of the form some PHP-script on your server.
    (store.php)

    Code store.php so that it receives the form-data. Have a look at the
    $_POST["varnamehere"] or $_GET["varnamehere"]
    Use them to get the values your send.html sended.

    Now:
    1) store that received name and age on the server.
    You can do this by file or database. Be sure you 'invent' some unique number
    or something as filename or unique key.

    2) Put that unique number in a coockie you send back to the clientmachine.
    Have a look at www.php.net and study the cookie-functions for details.

    Now create one more PHP-script (can also be the same one you just coded, but
    that is confusing I guess in this stage)
    This script reads the coockie that the clientmachine sends (check again the
    cookie-routine on www.php.net) and uses the unique number to read the file
    with that name or queries the database based on that number.
    Output the result.

    Good luck.
    Erwin Moller

    Erwin Guest

Similar Threads

  1. cookies under php 4.06
    By Chris Kranz in forum PHP Development
    Replies: 3
    Last Post: September 4th, 10:32 PM
  2. [PHP] need help with cookies
    By Jaap Van Ganswijk in forum PHP Development
    Replies: 0
    Last Post: August 18th, 10:24 PM
  3. need help with cookies
    By Dan Anderson in forum PHP Development
    Replies: 1
    Last Post: August 18th, 09:57 PM
  4. cookies in asp
    By Baroiller Pierre-Emmanuel in forum PHP Development
    Replies: 0
    Last Post: July 24th, 10:27 PM
  5. No cookies
    By Bill Butler in forum Windows Setup, Administration & Security
    Replies: 0
    Last Post: July 9th, 12:38 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139