Login   Register  
PHP Classes
elePHPant
Icontem

File: shadow_test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Oliver Schlag  >  shadow.class  >  shadow_test.php  >  Download  
File: shadow_test.php
Role: ???
Content type: text/plain
Description: Some simple Function Calls to understand the class
Class: shadow.class
Manage user accounts on shadow based Unix systems
Author: By
Last change:
Date: 12 years ago
Size: 1,745 bytes
 

Contents

Class file image Download
<?php

include("shadow.class.php");

$user = new shadow("/etc/passwd","/etc/shadow","/etc/group","/etc/gshadow",0);

echo "Free User ID : ".$user->get_next_uid()."\n";
echo "Free Group ID : ".$user->get_next_gid()."\n";
echo "oschlag Uid : ".$user->user_to_uid("oschlag")."\n";
echo "oschlag Name : ".$user->uid_to_user($user->user_to_uid("oschlag"))."\n";
echo "Perl_User GID : ".$user->group_to_gid("Perl_User")."\n";
echo "Add user ostest\n";
if (!$user->user_add("ostest",$user->get_next_uid(),"Perl_User","Olivers Tester","/bin/bash","/home/sites/site3/users/ostst","hubba"))
{
  echo $user->ERROR_MSG."\n";
}
echo "Free User ID : ".$user->get_next_uid()."\n";
echo "ostest Name : ".$user->uid_to_user("101")."\n";
echo "ostest Uid : ".$user->user_to_uid("ostest")."\n";
echo "Add user ostest to group wheel\n";
if (!$user->add_to_group("wheel","ostest"))
{
  echo $user->ERROR_MSG."\n";
}
echo "Delete user ostest\n";
if (!$user->user_del("ostest"))
{
  echo $user->ERROR_MSG."\n";
}
echo "Free User ID : ".$user->get_next_uid()."\n";
echo "ostest Name : ".$user->uid_to_user("101")."\n";
echo "ostest Uid : ".$user->user_to_uid("ostest")."\n";
echo "Add group ostest\n";
if (!$user->group_add("ostest"))
{
  echo $user->ERROR_MSG."\n";
}
echo "Free Group ID : ".$user->get_next_gid()."\n";
echo "ostest Name : ".$user->gid_to_group("103")."\n";
echo "ostest GID : ".$user->group_to_gid("ostest")."\n";
echo "Delete group ostest\n";
if (!$user->group_del("ostest"))
{
  echo $user->ERROR_MSG."\n";
}
echo "Free Group ID : ".$user->get_next_gid()."\n";
echo "ostest Name : ".$user->gid_to_group("103")."\n";
echo "ostest GID : ".$user->group_to_gid("ostest")."\n";
$user->stop_shadow();

?>