function user_add($BDID, $groupname, $full_name, $username, $email, $passwd)
{
$conn = db_connect();
if (!$conn)
return "Kan geen connectie krijgen met de database server
probeer het later nogmaals.";
//controleer unique
$result = mysql_query("select * from IQUsers where username='$username'");
if (!$result)
return "Kan query niet uitvoeren";
if (mysql_num_rows($result)>0)
return "Deze gebruikersnaam bestaat al
ga terug en kies een andere.";
//add record
$result = mysql_query("insert into IQUsers values ('$BDID','$groupname','$username', password('$passwd'), '$full_name', '$email')");
if(!$result)
return "Kon gebruiker niet toevoegen
probeer het later nogmaals.";
return true;
}
function user_login($username, $password)
{
$conn = db_connect();
if (!$conn)
return 0;
//controleer unique
$result = mysql_query("select * from IQUsers where username='$username'
and password = password('$password')");
if (!$result)
return 0;
if (mysql_num_rows($result)>0)
return 1;
else
return 0;
}
function user_check()
{
global $iquser;
if (session_is_registered("iquser"))
{
// logged in
return 0;
}
else
{
//not logged in
output_head("Niet ingelogd.");
output_middel();
display_login_form("U bent niet ingelogd.");
output_foot();
exit;
}
}
function user_changepass($username, $old_password, $new_password)
{
//controleer password
if (login($username, $old_password))
{
if (!($conn = db_connect()))
return false;
//update record
$result = mysql_query("update IQUsers
set password = password('$new_password')
where username = '$username'");
if (!$result)
return false; //niet gewijzigd
else
return true; //gewijzigd
}
else
return false; //oude password is niet goed
}
function user_resetpass($username)
//set password for username to random value
//return new password or false on falure
{
//get random dictionary word b/w 6 and 13 chars in length
$new_password = get_random_word(6, 13);
//add a number between 0 and 999 to it
//to make it better
srand ((double) microtime() * 1000000);
$rand_number = rand(0, 999);
$new_password .= $rand_number;
//set user's password to this in database or return false
if (!($conn = db_connect()))
return false;
$result = mysql_query("update IQUsers set password = password('$new_password') where username = '$username'");
if (!$result)
return false; //not changed
else
return $new_password; //changed
}
function get_random_word($min_length, $max_length)
//grap a random word and return it
{
//genarate random word
$word = "";
$dictionary = "/usr/dict/words"; //the ispell dictionary
$fp = fopen($dictionary, "r");
$size = filesize($dictionary);
//go to a random location in dictionary
srand ((double) microtime() * 1000000);
$rand_location = rand(0, $size);
fseek($fp, $rand_location);
//get tje next whole word of the right length in the file
while (strlen($word)< $min_length || strlen($word)>$max_length)
{
if (feof($fp))
fseek($fp, 0); //if at end go to start
$word = fgets($fp, 80); //skip first word as it could be partial
$word = fgets($fp, 80); //the potential password
};
$word=trim($word); //trim the trailing \n from fgets
return $word;
}
function user_emailpass($username, $password)
//notify the user the password hase changed
{
if (!($conn = db_connect()))
return false;
$result = mysql_query("select email from IQUsers where username='$username'");
if (!$result)
return false; //not changed
else if (mysql_num_rows($result)==0)
return false; //username not in db
else
{
$email = mysql_result($result, 0, "email");
$from = "support@iqpublisher.nl \r\n";
$mesg = "Uw wachtwoord is veranderd naar $password \r\n"
."Veranderd u dit wachtwoord de volgende keer dat u inlogd. \r\n";
if (mail($email, "Support login info", $mesg, $from))
return true;
else
return false;
}
}
?>
function db_connect()
{
$result = mysql_pconnect("localhost", "iqadmin", "xwup3");
if (!$result)
return false;
if (!mysql_select_db("iQPublisher_-_iqbase"))
return false;
return $result;
}
?>
function printuser()
{
global $iquser;
if (isset($iquser))
{
echo "
Logged in as: ".$iquser." |
"; if ($iquser == "admin") { ?> | newuser | Admin } ?> | Logout | |
![]() |
De slimme publishing postbus
|
|
} function output_foot() { //print an HTML footer tabel ?> |
![]() IQPublisher is een handelsmerk van iQBase Adobe, InDesign, Acrobat Photoshop, Illustrator, PostScript en Portable Document Format (pdf) zijn handelsmerken van Adobe Systems Inc. Apple, Mac OS, os x AppleScript, iMac, eMac en Macintosh zijn handelsmerken van Apple Computer Inc. FileMaker Pro is een handelsmerk van FileMaker Inc. Suitcase is een handelsmerk van Extensis Inc. |
Om gebruik te kunnen maken van de verschillende voorbeelden dient u in te loggen met uw gebruikersnaam en wachtwoord. Deze zijn beschikbaar voor geregistreerde klanten van iQBase. Indien u interesse heeft in een demo of meer wilt weten hoe u iQPublisher kunt inzetten binnen uw organisatie neemt u dan contact met ons op. Het iQPublisher team |
|
".$footer." |