Thread: Cookie chaos

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    22

    Cookie chaos

    does anyone know how i could set some cookies when opening a browser window?

    I'm using ShellExecute() to open the default browser to the location I want, but I need to set some cookies for that site before, for authentication purposes.

    Does anyone have any ideas for me?

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Well if you're going to a site that you own, then I would just write some JavaScript to set the cookie when the page loads.

  3. #3
    Registered User
    Join Date
    Jun 2006
    Posts
    22
    unfortunately i dont own it

  4. #4
    Registered User
    Join Date
    Jun 2006
    Posts
    22
    perhaps some explanation as to what I'm using it for...

    I'm in the process of writing a notifier for GMail accounts. Yes I know there are lots, but either they don't support multiple accounts or they're written in a bloated language that chews your resources.

    What I want to do now though is open up a browser to your inbox so you can read the mail. So I'll do all the authentication stuff for you. Only problem is that it needs certain cookies to be present in order for it to work...

    Hence the problem

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Well, all you should need to do is to write the appropriate cookie file to the cookie folder for the user's browser. Which is... a little job in itself

    The thing is, browsers can store cookie files anywhere they want. It is up to you to figure out how many browsers you want to support.

    Or think of a better solution to your problem!
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    http://curl.haxx.se/
    With a bit of effort on your part, most of the work is done for you with this library.
    Then you can make something lightweight and browser-free all at the same time.

    Using a browser just to fetch a bit of HTML is like using an 18-wheeler semi just to do the weekly shopping.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    Jun 2006
    Posts
    22
    libcurl is actually what i'm using to find out if I have any new mails and how many there are

    writing a fully fledged mail client is probably a bit overkill and I doubt there would be many people who would want something that bloated.

    there are actually two applications that I know of that do what I want.
    One is Google's own notifier and another is Massgrid GAlert.
    I'm pretty sure that they get around the problem some how... I just wish I knew

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. erase cookies cookie from webbrowser control
    By hanhao in forum C++ Programming
    Replies: 1
    Last Post: 07-23-2007, 01:28 PM
  2. change cookie - client side
    By ginoitalo in forum Tech Board
    Replies: 2
    Last Post: 03-09-2006, 04:31 PM
  3. The Story Of Pong (my game cookie)
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 05-16-2005, 11:14 PM
  4. cookie dough
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 05-01-2004, 04:48 PM
  5. C Web Application - Cookie Management
    By mrpickle in forum C Programming
    Replies: 0
    Last Post: 02-23-2004, 06:32 AM