View Full Version : Cookies
chrisgocrazyH
22-01-2008, 05:25 AM
Hello im using a cookies script But i need a simple code that goes up the top of the page how to Like <script> AddCookie ('cookie.filename') </script> i have no clue if its possible or if you need MYSQL any help with this one pls
Jackboy
22-01-2008, 08:10 AM
So you want to give a user a cookie yeh?
Hello im using a cookies script But i need a simple code that goes up the top of the page how to Like <script> AddCookie ('cookie.filename') </script> i have no clue if its possible or if you need MYSQL any help with this one pls
Google for christ's sake...
Hitman
22-01-2008, 11:52 AM
Use sessions, they're safer. One little 'problem' is that when you close the browser they're destroyed.
But this is how you use them...
session_start(); // allowing you to start sessions
$_SESSIONS['whatever'] = "Whatever is in the session, a username or whatever"; // makes the session
session_destroy(); // destroys the session
I don't know about cookies, much, as I never use them.
Jackboy
22-01-2008, 03:44 PM
Use sessions, they're safer. One little 'problem' is that when you close the browser they're destroyed.
But this is how you use them...
session_start(); // allowing you to start sessions
$_SESSIONS['whatever'] = "Whatever is in the session, a username or whatever"; // makes the session
session_destroy(); // destroys the session
I don't know about cookies, much, as I never use them.
Same ^
But he could want a spam cookie + not a user login cookie? :P
Invent
22-01-2008, 03:57 PM
To set a cookie using Javascript use a function like this:
<script type="javascript">
<!--
function SetCookie(cookieName,cookieValue,nDays) {
var today = new Date();
var expire = new Date();
if (nDays==null || nDays==0) nDays=1;
expire.setTime(today.getTime() + 3600000*24*nDays);
document.cookie = cookieName+"="+escape(cookieValue)
+ ";expires="+expire.toGMTString();
}
//-->
</script>
But seriously, ******* Google it next time :\
MrCraig
22-01-2008, 04:01 PM
or in php..
<?php
ob_start();
setcookie("Cookie Name","Cookie Value",time()+3600);
?>
chrisgocrazyH
23-01-2008, 02:21 AM
or in php..
<?php
ob_start();
setcookie("Cookie Name","Cookie Value",time()+3600);
?>
And that means with the habbo Room maker im working on it will save it so every one can see how i have dragged it and put it in the room ""every one will be able to see that"" not just a fresh new room with no furni?
Caleb
23-01-2008, 02:41 AM
You seriously need to learn how to spell and speak before posting again, it is driving me crazy.
Edited by Agesilaus (Forum Super Moderator): Please do not post off topic.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.