Hiển thị kết quả từ 1 đến 5 / 5
  1. #1
    Tham gia
    27-12-2007
    Bài viết
    87
    Like
    0
    Thanked 0 Times in 0 Posts

    mình không xóa cookie được

    mình viết trang logout.php có nội dung sau:
    if(isset($_COOKIE['islogin']))
    {
    echo $_COOKIE['islogin'];
    setcookie('islogin');
    echo $_COOKIE['islogin'];//kiểm tra thử còn cookie hay không
    }
    kết quả cookie không bị xóa, mong các pro trên diễn đàn chỉ giúp
    Quote Quote

  2. #2
    Tham gia
    07-09-2006
    Bài viết
    295
    Like
    0
    Thanked 2 Times in 2 Posts
    tớ chả phải pro gì nhưng chắc có thể giúp câụ ...
    Trước tiên câụ phải hiêủ cookie cái đã .
    setcookie(name, value, expire, path, domain);
    name : tên cookie.
    value : nội dung cookie
    exprire : thơì gian hết hạn.
    path : đường dẫn cookie.
    domain : domain của site bạn.

    để tạo cookie
    setcookie("user", "Alex Porter", time()+3600, "path/cookie");

    nêú muốn xóa cookie thì
    setcookie("user", "", time()-3600, "path/cookie");

    lưu ý nêú bạn xóa cookie ... setcookie("user", "Alex Porter", time()+3600, "path/cookie"); thì bạn phải chọn đúng cái path lúc khởi tạo cookie setcookie("user", "Alex Porter", time()-3600, "path/cookie");

  3. #3
    Tham gia
    01-08-2008
    Location
    *_*
    Bài viết
    675
    Like
    0
    Thanked 1 Time in 1 Post
    PHP Code:
    //từ chỗ này trở lên ko echo, print gì hết
    if(isset($_COOKIE***91;'islogin'***93;))
    {
    // echo $_COOKIE***91;'islogin'***93;; // bỏ dòng này đi.
    setcookie('islogin');
    echo 
    $_COOKIE***91;'islogin'***93;;//kiểm tra thử còn cookie hay không


    [=========> Bổ sung bài viết <=========]

    Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace.
    Được sửa bởi BossFTP lúc 08:09 ngày 22-04-2009 Reason: Bổ sung bài viết

  4. #4
    Tham gia
    27-12-2007
    Bài viết
    87
    Like
    0
    Thanked 0 Times in 0 Posts
    cho minh hoi them cach upload tap tin len mot thu muc minh phai lam nhu the nao? code don gian thoi nha, con rau ria minh tu lam

  5. #5
    Tham gia
    21-09-2008
    Bài viết
    22
    Like
    0
    Thanked 0 Times in 0 Posts
    Gồm 2 File


    function upload_file()
    {
    ?>
    <table width="70%" border="1" align="center" bordercolor="#00FFFF">
    <tr>
    <td><form enctype="multipart/form-data" action="action_class.php" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
    Choose a file to upload: <input name="uploadedfile" type="file" /><br />
    <input type="submit" value="Upload File" />
    </form></td>
    </tr>
    <tr>
    <td>File Sẽ Được Tự Động Đưa Vào Thư Mục download/ </td>
    </tr>
    </table>


    <?php

    }



    File action_class.php



    <?php
    /*------------------------------------Upload_File----------------------------------*/
    $target_path = "download/";

    $target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

    if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))
    {
    echo "File: ". basename( $_FILES['uploadedfile']['name'])." File Đã Đựơc Lưu Vào Thư Mục download/";
    echo "The file ". basename( $_FILES['uploadedfile']['name']).'<p><a href="admin_full.php">Click here to Admin</a> </p>';
    }


    ?>

Bookmarks

Quy định

  • Bạn không thể tạo chủ đề mới
  • Bạn không thể trả lời bài viết
  • Bạn không thể gửi file đính kèm
  • Bạn không thể sửa bài viết của mình
  •