PHP Session et Cookies: encoder toutes les données d’une session dans une seule chaîne et retourne le résultat

 
<?php
   session_start();
   $_SESSION['username'] = "jason";
   $_SESSION['loggedon'] = date("M d Y H:i:s");
   
   $sessionVars = session_encode();
   echo $sessionVars;
?>
  
  

PHP Session et Cookies: Créer un Système de connexion à l’aide des Cookies

on_destroy ();
}
if (login ( "test", "test" )) {
  echo "Successfully logged in with user: " . $_SESSION ['user'] . " and pass: " . $_SESSION ['pass'];
} else 

PHP Session et Cookies: Démarrer une session

 
<?php  session_start(); ?>
<html>
 <head>
  <title>Session running</title>
  <style type="text/css">
    body { font-family:<?php echo $_SESSION['font']; ?> }
  </style>
 </head>
 <body>
 <h3>Preferred font family is 
 <?php echo $_SESSION['font']; ?></h3>
 <a href="prefs3.php?<?php echo( SID ); ?>">Next page</a>
 </body>
</html>
  
  

PHP: Trouver le nombre de ligne d’un fichier

 
<?php
$lines = 0;
if ($fh = fopen('data.txt','r')) {
  while (! feof($fh)) {
    if (fgets($fh)) {
      $lines++;
    }
  }
}
print $lines;
?>
  
  

PHP: Véfirier si élément est un fichier

<html>
<head>
<title>Is it a file: is_file()</title>
</head>
<body>
<?php
$file = "test.txt";
outputFileTestInfo( $file );
function outputFileTestInfo( $f ){
   if ( ! file_exists( $f ) ){
       print "$f does not exist<BR>";
      return;
   }
   print "$f is ".(is_file( $f )?"":"not ")."a file<br>";
}
?>
</body>
</html>
           
       

PHP: Vérifier si un fichier est exécutable

<html>
<head>
<title>Is the file executable: is_executable</title>
</head>
<body>
<?php
$file = "test.txt";
outputFileTestInfo( $file );
function outputFileTestInfo( $f ){
   if ( ! file_exists( $f ) ){
       print "$f does not exist<BR>";
      return;
   }
   print "$f is ".(is_executable( $f )?"":"not ")."executable<br>";
}
?>
</body>
</html>