Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/divers/disconnectuser.php
<?php

  $res = $oreon->database->database->query("DELETE FROM radacct WHERE username='$pullUser' AND acctstoptime = 0 ;");
  if ($usedisconnect)
    {    
     $tmp_file = tempnam("/tmp/",'DA');
     
     if ($general_ld_library_path != '')
       putenv("LD_LIBRARY_PATH=$general_ld_library_path");
     $comm="echo \"User-Name =".$pullUser."\" | radclient $radius_server:3799 40 $radiussecret". ' >' . $tmp_file." 2>&1";
     //$comm = "radclient" . " $radius_server:3799" . ' 40 ' . $radiussecret. ' >' . $tmp_file;
     $fp = popen($comm,"w");
     if ($fp)
       {	  
	 fwrite($fp, "User-Name = $pullUser\n");
	 pclose($fp);
	 
	 $reply = file($tmp_file);
	 unlink($tmp_file);

	 if (ereg('code 41', $reply[0]))
	 echo "<b><small>Successful Response from Chillispot user disconnect !!!<br>";
	 else
	 echo "<b><small>Unable to disconnect user from chillispot !!!<br>";
	 array_shift($reply);
	 
	 if (count($reply))
	   {
	     $msg .= "<br><b>Server response:</b><br>\n";
	     foreach ($reply as $val)
	       {
		 $msg .= "<i>$val</i><br>\n";
	       }
	   }
       }
        
    }
  if ($res)
    echo "<b>Successful deleted open sessions from accounting </b><br>\n";
  else
    echo "<b>Error deleting open sessions for user" .die("Query database error !"). "</b><br>\n";
?>
Return current item: phpMyPrepaid