Page 271 - Computer Software Application TP - Volume 1
P. 271

COMPUTER SOFTWARE APPLICATION - CITS




                         echo “Cookie set successfully!”;
                           ?>
                                 </body>
                                 </html>
               3  Save the program in C:\Apache24\htdocs in a folder with .php extension

               4  Run the Apache services from windows services
               5  Open the browser and type the following address
                 http://localhost/foldername/
               6  Click the php file to run  and verify the output













           TASK 3: Deleting a cookie
                  I   Deleting with unset()
                 1  Open the text editor

                 2  Write the following codes
                              <html>
                              <body>
                               <?php
                          if (isset($_COOKIE[“username”]))

                                 {
                                              unset($_COOKIE[“username “]);
                                              echo “Cookie removed from script execution!”;
                                  }
                                 else

                                 {
                                              echo “Cookie not found.”;
                                 }
                        ?>

                              </body>
                              </html>
              3  Save the program in C:\Apache24\htdocs in a folder with .php extension
              4  Run the Apache services from windows services
              5  Open the browser and type the following address

                                     http://localhost/foldername/






                                                           256
                               CITS : IT & ITES - Computer Software Application - Exercise 54
   266   267   268   269   270   271   272   273   274   275   276