Beispiel #1
0
            }
        } else {
            if ($mode == 'login') {
                $rslt = login($email, $password);
                if ($rslt == 'email') {
                    $message = '<span class="error">No user with that email address.</span>';
                } else {
                    if ($rslt == 'password') {
                        $message = '<span class="error">Wrong password.</span>';
                    } else {
                        $userid = $rslt;
                    }
                }
            } else {
                if ($mode == 'forgot') {
                    if (!mailPassword($email)) {
                        $message = '<span class="error">No user with that email address.</span>';
                    } else {
                        $message = '<span class="ok">OK! Go check your email now.</span>';
                    }
                }
            }
        }
    }
}
if (($mode == 'create' || $mode == 'login') && !$message) {
    header('Location: .');
    exit;
}
?>
<a href="index.php?c=groothandel&p=add" class="button">Groothandel aanmaken</a><br />
<?php 
if (!defined('isIncluded') || $_SESSION['GroepID'] != 4) {
    header('location: index.php');
}
if (isset($_POST['submit'])) {
    if (!empty($_POST['iptGebEmail']) && !empty($_POST['iptGebStraat']) && !empty($_POST['iptGebHuisnummer']) && !empty($_POST['iptGebPostcode']) && !empty($_POST['iptGebWoonplaats']) && !empty($_POST['iptGebTelefoon']) && !empty($_POST['iptBedBedrijfsnaam']) && !empty($_POST['iptBedStraat']) && !empty($_POST['iptBedHuisnummer']) && !empty($_POST['iptBedPostcode']) && !empty($_POST['iptBedVestigingsplaats']) && !Gebruiker::emailAlreadyExists($_POST['iptGebEmail'])) {
        $properties_values = array('Bedrijfsnaam' => $_POST['iptBedBedrijfsnaam'], 'Straat' => $_POST['iptBedStraat'], 'Huisnummer' => $_POST['iptBedHuisnummer'], 'HuisnummerToevoeging' => $_POST['iptBedHuisnummerToevoeging'], 'Postcode' => $_POST['iptBedPostcode'], 'Vestigingsplaats' => $_POST['iptBedVestigingsplaats'], 'Email' => $_POST['iptBedEmail']);
        Bedrijf::create($properties_values);
        global $db;
        $stmt = $db->query("SELECT MAX(BedrijfID) FROM bedrijf");
        $stmt->execute();
        $res = $stmt->fetch(PDO::FETCH_ASSOC);
        $bedrijfId = $res['MAX(BedrijfID)'];
        $randPass = getUniqueCode(15);
        mailPassword($_POST['iptGebEmail'], $randPass);
        $properties_values = array('Email' => $_POST['iptGebEmail'], 'Wachtwoord' => encrypt($randPass), 'GroepID' => 3, 'BedrijfID' => $bedrijfId, 'Voornaam' => $_POST['iptGebVoornaam'], 'Tussenvoegsel' => $_POST['iptGebTussenvoegsel'], 'Achternaam' => $_POST['iptGebAchternaam'], 'Straat' => $_POST['iptGebStraat'], 'Huisnummer' => $_POST['iptGebHuisnummer'], 'HuisnummerToevoeging' => $_POST['iptGebHuisnummerToevoeging'], 'Postcode' => $_POST['iptGebPostcode'], 'Woonplaats' => $_POST['iptGebWoonplaats'], 'Telefoon' => $_POST['iptGebTelefoon'], 'Aanmaker' => $_SESSION['GebruikerID']);
        Gebruiker::create($properties_values);
        echo '<br /><div class="notification_ok">De groothandel is succesvol aangemaakt.</div>';
    } else {
        if (Gebruiker::emailAlreadyExists($_POST['iptGebEmail'])) {
            echo '<br /><div class="notification_error">Dit e-mailadres is al in gebruik.</div>';
        } else {
            echo '<br /><div class="notification_error">De groothandel kon niet worden aangemaakt.</div>';
        }
    }
} else {
    ?>
	<div id="form">
		<form name="groothandelAdd" method="post">
			<fieldset class="info_fieldset">
Beispiel #3
0
     $password = $row['password'];
 }
 //call a mail function that delivers the $password
 for ($x = 1; $x <= 10; $x++) {
     $generatedpasswd[] = rand(0, 5);
 }
 $generatedpasswd = "TSMS" . implode("", $generatedpasswd);
 $debugGenpassword = $generatedpasswd;
 //just for debugginh in localhost
 $generatedpasswd = md5($generatedpasswd);
 $sql = "UPDATE TRUNKregistration SET `password` = '{$generatedpasswd}' WHERE `TRUNKregistration`.`phoneNo` = '{$phoneNo}' ";
 $result = mysql_query($sql) or die("An unknown Error Occured while recovering your password");
 if (!$result) {
     die("We could not Recover your password");
 }
 if (mailPassword($email, $generatedpasswd)) {
     echo "<div id = \"success\">";
     echo "Your old password was destroyed and a new password has been sent to {$email}";
     echo "</div> <!-- end success -->";
     echo "<div  class = \"back\"><a style = \"text-decoration: none;\" href = \"./\">back</a></div>";
 } else {
     echo "<div class=\"ui-widget\">";
     echo "<div class=\"ui-state-error ui-corner-all\" style=\"padding: 0 .7em; margin-top: 20px; \">";
     echo "<p><span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: .3em;\"></span>";
     echo "<strong>Alert:</strong> Your Password Was Recovered But we Could not Mail your Password. This is probably due to Technial problem. We apologize for inconviniences. Please Contact Us.</p>";
     echo "<div  class = \"back\"><a style = \"text-decoration: none;\" href = \"./\">back</a></div>";
     echo "</div></div>";
     /*	
     echo "<div id = \"failure\">";
     echo "Your Password Was Recovered But we Could not Mail your Password. This is probably due to Technial problem. We apologize for inconviniences. Please Contact Us.";
     echo "</div> <!-- end failure -->";