================================================================== Cookie.c - cookie extraction functions for CGI programs. Website : http://www.txtswap.com/cookie/ Contact : phil@txtswap.com Revision : v1.1 17/04/2002 Copyright (c) 2002 Philip Rhys Worgan. All Rights Reserved. Redistribution in part or in whole strictly prohibited. This code is provided as is no support can be guaranteed whatsoever, however i will try to answer questions when i have time. ================================================================= Produced on behalf of Txtswap.com - Spread the Word Txtswap is a Txt based website promotion network, please visit Txtswap.com for more information ================================================================== COPYRIGHT NOTICE: Copyright 2002 Philip Rhys Worgan. All Rights Reserved. This program is being distributed as freeware. It may be used and modified free of charge for any use, so long as this copyright notice and the header above remain intact and so long as there is a link made to txtswap.com from somewhere within your site. If you do not wish to make this link please contact me and i will provide information about licensing this product. Please also send me an email, and let me know where you are using this script. By using this program you agree to indemnify Philip Rhys Worgan and Txtswap.com from any liability. Selling the code for this program without prior written consent is expressly forbidden. Obtain permission before redistributing this program over the Internet or in any other medium. In all cases copyright and header must remain intact. ===================================================================== TABLE OF CONTENTS 1. Welcome 1.1 About the Script 1.2 Registration 2. Installation 3. Customizing the look. 4. Problems 1. Welcome ---------------------------------------------------- Cookie.c is a set of functions for use in C/C++ based CGI programs. It allows the information stored in client side cookies to be accessed by a CGI programs. 2.Usage ---------------------------------------------------- The user will require a knowledge of C/C++ to be able to make use of this code. The file cookie.h must be included where you intend to call these functions from using the #include syntax. Both the .c and .h file must then be present in the directory where you intend to compile the program from. The easiest way to explain how to call these function is by example, so below we have an example of getting a member number and email address from cookies stored when the member logged in. /*Variables*/ char *memnum; char *email; int main(VOID) { /*First read in all cookies visible to this page*/ getCookies(); /*Then get the cookies we are interested in*/ memnum = extractCookie ("memnum"); email = extractCookie ("email"); /*Do what you want to with it*/ sdfnsdbfhsbdhfbh sdfghjsgahfgsdhj sdygfhdsg..... /*Free Memory allocated by my functions*/ freeCookies (); } Its as easy as that. The parameter of the function extractCookie is the name that the cookie was set with. 3. Bugs and Issues ------------------------------------------------------ I have no doubt that there are probably bugs in this code but it has been usage extensively within the txtswap.com systems and should therefore be fine for most purposes. If you do however find a bug i do not have time to fix it. However if you fix i would be more than happy for you to email me the fixed version at phil@txtswap.com and i will put it up on the site, giving you acknowledgement of course. Have Fun Phil