Results 1 to 10 of 10

Thread: [RESOLVED] Cookie don't creat

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2006
    Location
    Iran
    Posts
    48

    Resolved [RESOLVED] Cookie don't creat

    hi
    i want to use setcookie() function like below code:
    PHP Code:
    setcookie('CookieName','ShaMSofT',time()+60*60); 
    but i see this error:
    Warning: Cannot modify header information - headers already sent by (output started at J:\wamp\www\Project\Hotel CMS\Copy of Ex.php:1) in J:\wamp\www\Project\Hotel CMS\Copy of Ex.php on line 13
    i use "WAMP5 Version 1.6.4"
    help me please

    -----------
    Sorry For Bad My English
    Sorry For Bad My English

  2. #2
    Fanatic Member McCain's Avatar
    Join Date
    Jan 2002
    Location
    Sweden/Denmark
    Posts
    802

    Re: Cookie don't creat

    you're probably echo:ing something before trying to modify the header information...

    If you post your entire file I could have a look...
    Never argue with fools, they will only drag you down to their level, and beat you with experience.

    Q: How do you tell an experienced hacker from a novice?
    A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Cookie don't creat

    output started at J:\wamp\www\Project\Hotel CMS\Copy of Ex.php:1

    Make sure you have no blank lines or spaces before the first opening <?php
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4

    Thread Starter
    Member
    Join Date
    Dec 2006
    Location
    Iran
    Posts
    48

    Re: Cookie don't creat

    hi my dear
    i attach my code
    Attached Files Attached Files
    Sorry For Bad My English

  5. #5
    Fanatic Member McCain's Avatar
    Join Date
    Jan 2002
    Location
    Sweden/Denmark
    Posts
    802

    Re: Cookie don't creat

    You need to move your setcookie() lines. They have to be first in the file. (They have to be before any output, like html code)
    Never argue with fools, they will only drag you down to their level, and beat you with experience.

    Q: How do you tell an experienced hacker from a novice?
    A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer

  6. #6

    Thread Starter
    Member
    Join Date
    Dec 2006
    Location
    Iran
    Posts
    48

    Re: Cookie don't creat

    ok. thank Mr McCain
    Sorry For Bad My English

  7. #7
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: [RESOLVED] Cookie don't creat

    I Love it
    PHP Code:
        $connect mysql_connect("localhost",$USER$PASS) or die ("Hey loser, check your server connection."); 
    Suffice to say, the positioning of your setcookie's is the least of your worries. That code needs some serious re-working.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  8. #8

    Thread Starter
    Member
    Join Date
    Dec 2006
    Location
    Iran
    Posts
    48

    Re: [RESOLVED] Cookie don't creat

    I Love it
    what means?

    Suffice to say, the positioning of your setcookie's is the least of your worries. That code needs some serious re-working.
    yes,i know
    i want to finish the coding quickly now. in the next version patch the security bug and making the better code.
    Last edited by shamsoft; Jun 15th, 2007 at 11:40 AM.
    Sorry For Bad My English

  9. #9
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] Cookie don't creat

    You should get into the habit of coding correctly from the beginning. That will save you development time in future.

  10. #10

    Thread Starter
    Member
    Join Date
    Dec 2006
    Location
    Iran
    Posts
    48

    Re: [RESOLVED] Cookie don't creat

    You should get into the habit of coding correctly from the beginning. That will save you development time in future.
    thanks for your advice i try to it
    Sorry For Bad My English

Posting Permissions

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



Click Here to Expand Forum to Full Width