function showHtml() { $errMsgs = []; $html = "\n <head><title>Big Yaad Tree</title><meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'><script src=\"../../js/go.js\"></script><script id='code' src='../../js/tree.js'></script>" . "<link rel=\"stylesheet\" href=\"../../css/reset.css\"><link rel=\"shortcut icon\" href=\"../../img/favicon.ico\" type=\"image/x-icon\">" . "<link rel=\"icon\" href=\"../../img/favicon.ico\" type=\"image/x-icon\"><script src='../../js/sweetalert.min.js'></script><script src='../../js/jquery-2.1.4.min.js'></script><script src='../../js/index.js'></script>" . "<link rel='stylesheet prefetch' href='../../css/font-awesome.min.css'><link rel='stylesheet' href='../../css/sweetalert.css'><link rel=\"stylesheet\" href=\"../../css/style.css\"><link rel=\"stylesheet\" href=\"../../css/animate.css\"></head>\n <div class=\"animated slideInDown\">\n <div class=\"nav\">\n <ul>\n <li class=\"logo\"><img class='animated infinite pulse' src=\"../../img/logo.png\"></li>\n <li class=\"home\"><a href=\"super.php\">REMOVE USER</a></li>\n <li class=\"searchMenu\"><a href=\"removeRelation.php\">REMOVE RELATIONSHIP</a></li>\n <li class=\"childMenu\"><a class=\"active\" href=\"changePassword.php\">CHANGE PASSWORD</a></li>\n <li class=\"logout\"><a href=\"../../index.php\">LOGOUT</a></li>\n </ul>\n </div></div>" . "<body><div class=\"panel\" style='max-width: 580px;'>"; if (!isset($_GET) || strtoupper($_GET['by']) !== "FNAME" && strtoupper($_GET['by']) !== 'LNAME') { $_GET['by'] = 'FNAME'; $nextSortBy = 'FNAME'; } else { if (strtoupper($_GET['by']) === "LNAME") { $nextSortBy = "LNAME"; } else { $nextSortBy = "FNAME"; } } if (!isset($_GET) || strtoupper($_GET['sort']) !== "ASC" && strtoupper($_GET['sort']) !== 'DESC') { $_GET['sort'] = 'DESC'; $nextSort = "ASC"; } else { if (strtoupper($_GET['sort']) === "ASC") { $nextSort = "DESC"; } else { $nextSort = "ASC"; } } $html .= createUserTable(getAllUsers($_GET['sort'], $_GET['by']), $errMsgs, $nextSort, $nextSortBy) . "</div></body>"; echo $html; }
function addRowToUserTable($array) { print_r($array); global $varNames, $servname, $user, $mdp, $dbname, $tablename; foreach ($varNames as $name) { $array[$name] = htmlentities($array[$name]); } createUserTable(); $mysqli = new mysqli($servname, $user, $mdp, $dbname); if ($mysqli->connect_errno > 0) { die('Unable to connect to database [' . $mysqli->connect_error . ']'); } $query = "INSERT INTO " . $tablename . "(mail,mdp,nom,prenom,sexe,naissance,adresse,codepostal,ville)" . "VALUES ('" . $array["mail"] . "','" . customHash($array["mdp"]) . "','" . $array["nom"] . "','" . $array["prenom"] . "','" . $array["sexe"] . "','" . $array["naissance"] . "','" . $array["adresse"] . "','" . $array["codepostal"] . "','" . $array["ville"] . "')"; //echo "addRowToUserTable got </br>".$array["mdp"]." and set </br>\n".customHash($array["mdp"])." in the database.</br>\n"; $result = $mysqli->query($query); if ($result === false) { echo "Unable to add user tu user table.</br>\n"; //echo "query: ".$query; //print_r($mysqli->error_list); } login($array["mail"], $array["mdp"]); }
<?php $utilisateurtablename = "utilisateur"; $PSEUDO_MAX_CHAR = 20; $PSEUDO_MIN_CHAR = 3; $MDP_MAX_CHAR = 48; $MDP_MIN_CHAR = 8; include_once 'loginconfig.php'; include_once 'session.php'; include_once 'loginsql.php'; createUserTable(); // Première chose à faire: // Démarrer la session. // L'utilisateur pourras utiliser les services sans avoir besoin de compte' startSession(); // Sert à remplir un champ dans "form login.php" et "form register.php" function PostToField($varname) { if (isset($_POST[$varname])) { echo '"' . $_POST[$varname] . '"'; } else { echo '""'; } } // permet de traiter les inputs foreach ($_POST as $input) { $input = trim($input); } // Affiche le formulaire de login function print_login_form() {
function showHtml() { $errMsgs = []; $html = "\n <head><title>Big Yaad Tree</title><meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'><script src=\"../../js/go.js\"></script><script id='code' src='../../js/tree.js'></script>" . "<link rel=\"stylesheet\" href=\"../../css/reset.css\"><link rel=\"shortcut icon\" href=\"../../img/favicon.ico\" type=\"image/x-icon\">" . "<link rel=\"icon\" href=\"../../img/favicon.ico\" type=\"image/x-icon\"><script src='../../js/sweetalert.min.js'></script><script src='../../js/jquery-2.1.4.min.js'></script><script src='../../js/index.js'></script>" . "<link rel='stylesheet prefetch' href='../../css/font-awesome.min.css'><link rel='stylesheet' href='../../css/sweetalert.css'><link rel=\"stylesheet\" href=\"../../css/style.css\"><link rel=\"stylesheet\" href=\"../../css/animate.css\"></head>\n <div class=\"animated slideInDown\">\n <div class=\"nav\">\n <ul>\n <li class=\"logo\"><img class='animated infinite pulse' src=\"../../img/logo.png\"></li>\n <li class=\"home\"><a href=\"super.php\">REMOVE USER</a></li>\n <li class=\"searchMenu\"><a class=\"active\" href=\"#\">REMOVE RELATIONSHIP</a></li>\n <li class=\"childMenu\"><a href=\"changePassword.php\">CHANGE PASSWORD</a></li>\n <li class=\"logout\"><a href=\"../../index.php\">LOGOUT</a></li>\n </ul>\n </div></div>" . "<body><div class=\"panel\" style='max-width: 550px;'>" . createUserTable(getAllRelations(), $errMsgs) . "</div></body>"; echo $html; }
<?php require_once 'database.php'; try { $pdo = new PDO($DB_DSN, $DB_USER, $DB_PASSWORD); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); createBdd($pdo); createUserTable($pdo); createImageTable($pdo); } catch (Exception $e) { echo $e->getMessage(); } function createBdd($pdo) { if (isset($pdo)) { $pdo->exec("CREATE DATABASE IF NOT EXISTS 42_camagru;"); $pdo->exec("use 42_camagru;"); } } function createUserTable($pdo) { if (isset($pdo)) { $pdo->exec("CREATE TABLE IF NOT EXISTS users (id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, first_name VARCHAR(25), last_name VARCHAR(50), date_naissance DATETIME, email VARCHAR(255) NOT NULL UNIQUE, username VARCHAR(25) NOT NULL UNIQUE, password VARCHAR(255) NOT NULL, confirmation_token VARCHAR(60), confirmation_at DATETIME, reset_token VARCHAR(60), reset_at DATETIME);"); } } function createImageTable($pdo) { if (isset($pdo)) { $pdo->exec("CREATE TABLE IF NOT EXISTS images (id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,\n\t\t\t\tuser_id INT UNSIGNED NOT NULL, link TEXT NOT NULL,\n\t\t\t\tCONSTRAINT fk_image_user FOREIGN KEY (user_id) REFERENCES users(id))"); }
function createSignUpForm($userid = false) { global $wpdb; createUserTable(); if (isset($_REQUEST['btnUpdate']) && ($_REQUEST['btnUpdate'] = "Update" && isset($_REQUEST['user_signup-form_nonce']) && wp_verify_nonce($_REQUEST['user_signup-form_nonce'], 'user_signup-form'))) { $qryuserDetailUpdate = "UPDATE " . $wpdb->prefix . "UserMaster SET\n\t\t\t\t\t\t\tEmail='" . $_REQUEST['txtEmail'] . "',\n\t\t\t\t\t\t\tPassword='******'txtPassword'] . "',\n\t\t\t\t\t\t\tFirstName='" . $_REQUEST['txtFirstName'] . "',\n\t\t\t\t\t\t\tLastName='" . $_REQUEST['txtLastName'] . "',\n\t\t\t\t\t\t\tAgency='" . $_REQUEST['txtAgency'] . "',\n\t\t\t\t\t\t\tAgencyAddress='" . $_REQUEST['txtAgencyAddress'] . "',\n\t\t\t\t\t\t\tCity='" . $_REQUEST['txtCity'] . "',\n\t\t\t\t\t\t\tState='" . $_REQUEST['drpState'] . "',\n\t\t\t\t\t\t\tZipcode='" . $_REQUEST['txtZipcode'] . "',\n\t\t\t\t\t\t\tOfficePhone='" . $_REQUEST['txtOfficeNo'] . "',\n\t\t\t\t\t\t\tCellPhone='" . $_REQUEST['txtCellNo'] . "',\n\t\t\t\t\t\t\tfax='" . $_REQUEST['txtFaxNo'] . "'\n\t\t\t\t\t\tWHERE UserId=" . $userid . ""; //echo $qryuserDetailUpdate."<br>"; if ($wpdb->query($qryuserDetailUpdate)) { echo '<script> alert("Profile Has Been Updated") </script>'; } else { echo '<script> alert("Profile Can Not Be Updated") </script>'; } } //User Detail Update Over; echo '<div id="signup" class="form " >'; if ($userid) { $qryGetUserDetail = "SELECT * FROM " . $wpdb->prefix . "UserMaster WHERE UserId=" . $userid . ""; $Result = $wpdb->get_results($qryGetUserDetail); //print_r($Result[0]); $UserDetail = $Result[0]; } else { echo '<a href="javascript:" for="login" onClick="manageForm(this)">Login </a>'; } echo '<form name="frmSignup" method="post" enctype="multipart/form-data">'; wp_nonce_field('user_signup-form', 'user_signup-form_nonce', true, true); ?> <script type="text/javascript"> function validatePassword (p1, p2 ){ if (p1.value != p2.value || p1.value == '' || p2.value == '') { p2.setCustomValidity('Password incorrect'); } else { p2.setCustomValidity(''); } } </script> <table style="width:auto;"> <tr> <td><label for="txtFirstName">First Name</label></td> <td><input type="text" id="txtFirstName" name="txtFirstName" value="<?php echo $userid ? $UserDetail->FirstName : ''; ?> " title="First Name" placeholder="Enter First Name" required></td> </tr> <tr> <td><label for="txtLastName">Last Name</label></td> <td><input type="text" id="txtLastName" name="txtLastName" title="Last Name" value="<?php echo $userid ? $UserDetail->LastName : ''; ?> " placeholder="Enter Last Name" required></td> </tr> <tr> <td><label for="txtEmail">Email </label></td> <td><input type="email" id="txtEmail" name="txtEmail" title="Email Address" value="<?php echo $userid ? $UserDetail->Email : ''; ?> " placeholder="Enter Email Address" required></td> </tr> <tr> <td><label for="txtPassword">Password</label></td> <td><input type="password" id="txtPassword" name="txtPassword" title="Password" value="<?php echo $userid ? $UserDetail->Password : ''; ?> " placeholder="Enter Password" required></td> </tr> <tr> <td><label for="txtRePassword">Re-Enter Password</label></td> <td><input type="password" id="txtRePassword" name="txtRePassword" onBlur="validatePassword(document.getElementById('txtPassword'),this)" title="Re Type Password" placeholder="Re Enter Password" required></td> </tr> <tr> <td><label for="txtAgency">Agency </label></td> <td><input type="text" id="txtAgency" name="txtAgency" title="Agency Name" value="<?php echo $userid ? $UserDetail->Agency : ''; ?> " placeholder="Enter Agency Name" required></td> </tr> <tr> <td><label for="txtAgencyAddress">Agency Address</label></td> <td><textarea id="txtAgencyAddress" name="txtAgencyAddress" title="Agency Address" placeholder="Enter Agency Address" style="resize:horizontal;" rows="7" ><?php echo $userid ? $UserDetail->AgencyAddress : ''; ?> </textarea></td> </tr> <tr> <td><label for="txtCity">City</label></td> <td><input type="text" id="txtCity" name="txtCity" title="City" value="<?php echo $userid ? $UserDetail->City : ''; ?> " placeholder="Enter City"></td> </tr> <tr> <td><label for="drpState">State</label></td> <td> <?php if (!$userid) { ?> <select name="drpState" id="drpState"> <optgroup label="U.S.A."> <option value="AL">AL</option> <option value="AK">AK</option> <option value="AR">AR</option> <option value="AZ">AZ</option> <option value="CA">CA</option> </optgroup> <optgroup label="CANADA"> <option value="BC">BC</option> <option value="MB">MB</option> <option value="NB">NB</option> <option value="NF">NF</option> <option value="NT">NT</option> <option value="NS">NS</option> <option value="NU">NU</option> </optgroup> </select> <?php } else { ?> <input type="text" id="drpState" name="drpState" title="State" value="<?php echo $userid ? $UserDetail->State : ''; ?> " readonly placeholder="Enter State"> <?php } ?> </td> </tr> <tr> <td><label for="txtZipcode">Zip Code</label></td> <td><input type="text" id="txtZipcode" name="txtZipcode" title="Zipcode" maxlength="6" value="<?php echo $userid ? $UserDetail->Zipcode : ''; ?> " placeholder="Enter Zipcode"></td> </tr> <tr> <td><label for="txtOfficeNo">Office Phone</label></td> <td><input type="tel" id="txtOfficeNo" name="txtOfficeNo" title="Office Phone" value="<?php echo $userid ? $UserDetail->OfficePhone : ''; ?> " placeholder="Enter Office Phone"></td> </tr> <tr> <td><label for="txtCellNo">cell Phone</label></td> <td><input type="tel" id="txtCellNo" name="txtCellNo" title="Cell Phone" value="<?php echo $userid ? $UserDetail->CellPhone : ''; ?> " placeholder="Enter Cell Phone"></td> </tr> <tr> <td><label for="txtFaxNo">Fax No.</label></td> <td><input type="tel" id="txtFaxNo" name="txtFaxNo" title="Fax No" value="<?php echo $userid ? $UserDetail->fax : ''; ?> " placeholder="Enter Fax No"></td> </tr> <tr> <td/> <td> <?php if (!$userid) { ?> <input type="submit" name="btnSubmit" value="SignUp"> <?php } else { ?> <input type="submit" name="btnUpdate" value="Update"> <?php } ?> <input type="reset"> </td> </tr> </table> <?php echo '</form>'; echo '</div>'; if (isset($_REQUEST['btnSubmit']) && $_REQUEST['btnSubmit'] == 'SignUp' && isset($_REQUEST['user_signup-form_nonce']) && wp_verify_nonce($_REQUEST['user_signup-form_nonce'], 'user_signup-form')) { $qryInsertUser = "******" . $wpdb->prefix . "UserMaster VALUES\n\t\t\t\t\t(\n\t\t\t\t\t\tdefault,\n\t\t\t\t\t\t'" . $_REQUEST['txtEmail'] . "',\n\t\t\t\t\t\t'" . $_REQUEST['txtPassword'] . "',\n\t\t\t\t\t\t'" . $_REQUEST['txtFirstName'] . "',\n\t\t\t\t\t\t'" . $_REQUEST['txtLastName'] . "',\n\t\t\t\t\t\t'" . $_REQUEST['txtAgency'] . "',\n\t\t\t\t\t\t'" . $_REQUEST['txtAgencyAddress'] . "',\n\t\t\t\t\t\t'" . $_REQUEST['txtCity'] . "',\n\t\t\t\t\t\t'" . $_REQUEST['drpState'] . "',\n\t\t\t\t\t\t'" . $_REQUEST['txtZipcode'] . "',\n\t\t\t\t\t\t'" . $_REQUEST['txtOfficeNo'] . "',\n\t\t\t\t\t\t'" . $_REQUEST['txtCellNo'] . "',\n\t\t\t\t\t\t'" . $_REQUEST['txtFaxNo'] . "'\n\t\t\t\t\t)"; //echo $qryInsertUser."<br>"; if ($wpdb->query($qryInsertUser)) { $to = "*****@*****.**"; $subject = "User Sign UP"; $txt = "\n\t\t\t<html>\n\t\t\t<body>\n\t\t\t\t<div style=\"width:100%;border:1px solid #222;border-radius:5px;\">\n\t\t\t\t\t<div style=\"background-color:#222222;padding:10px;display: inline-flex;width: 100%;\"><a href=\"http://www.whiteorangesoftware.com/niwot/\"><img style=\"margin-bottom:-2px;\" src=\"http://www.whiteorangesoftware.com/niwot/wp-content/themes/niwot/img/logo.png\"></a>\n\t\t\t\t\t\n\t\t\t\t<h1 style=\"color: #fff;padding-left:60px;\"> Sign UP Request From " . $_REQUEST['txtFirstName'] . $_REQUEST['txtLastName'] . "</h1>\t\t\t\t\t\n\t\t\t\t\t</div>\n\t\t\t\t\t<div style=\"padding:24px;min-height:100px;background:#ddd;color: #6e321f;font-size: 20px;\">\n\t\t\t\t\t<div style=\"margin:5px 0px\"><label style=\"min-width:100px;display:inline-block;\">First Name : " . $_REQUEST['txtFirstName'] . " </label></div>\n\t\t\t\t\t<div style=\"margin:5px 0px\"><label style=\"min-width:100px;display:inline-block;\">Last Name : " . $_REQUEST['txtLastName'] . "</label></div>\n\t\t\t\t\t<div style=\"margin:5px 0px\"><label style=\"min-width:100px;display:inline-block;\">Email : " . $_REQUEST['txtEmail'] . "</label></div>\t\t\t\t\t\n\t\t\t\t\t<div style=\"margin:5px 0px\"><label style=\"min-width:100px;display:inline-block;\">Agency Name : " . $_REQUEST['txtAgency'] . "</label></div>\n\t\t\t\t\t<div style=\"margin:5px 0px\"><label style=\"min-width:100px;display:inline-block;\">Agency Address : " . $_REQUEST['txtAgencyAddress'] . "</label></div>\n\t\t\t\t\t<div style=\"margin:5px 0px\"><label style=\"min-width:100px;display:inline-block;\">City : " . $_REQUEST['txtCity'] . "</label></div>\n\t\t\t\t\t<div style=\"margin:5px 0px\"><label style=\"min-width:100px;display:inline-block;\">State : " . $_REQUEST['drpState'] . "</label></div>\n\t\t\t\t\t<div style=\"margin:5px 0px\"><label style=\"min-width:100px;display:inline-block;\">ZipCode : " . $_REQUEST['txtZipcode'] . "</label></div>\n\t\t\t\t\t<div style=\"margin:5px 0px\"><label style=\"min-width:100px;display:inline-block;\">Office Number : " . $_REQUEST['txtOfficeNo'] . "</label></div>\n\t\t\t\t\t<div style=\"margin:5px 0px\"><label style=\"min-width:100px;display:inline-block;\">Cell Number : " . $_REQUEST['txtCellNo'] . "</label></div>\n\t\t\t\t\t<div style=\"margin:5px 0px\"><label style=\"min-width:100px;display:inline-block;\">Fax Number : " . $_REQUEST['txtFaxNo'] . "</label></div>\t\t\t\t\t\n\t\t\t</div>\n\t\t\t\t\t<div style=\"background-color:#222222;padding:10px;\">\n\t\t\t\t\t\t<p style=\"margin:0px;font-size:16px;color:#fff;text-align:right;\">This e-mail was sent from <a href=\"http://www.whiteorangesoftware.com/niwot/\" style=\"color:#2BACE2;text-decoration:none;\">Niwot</a></p>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t</body>\n\t\t\t</html>\n\t\t\n\t\t\n\t\t"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= "From: " . $_REQUEST['txtFirstName'] . "\r\n"; mail($to, $subject, $txt, $headers); echo '<script> alert("You have Success fully Sign id"); </script>'; } else { echo '<script> alert("Please Enter Proper Information"); </script>'; } } //Insert Is Over }
switch ($_POST['optionsRadios2']) { case 'option1': $member_lookingfor = 'friends'; break; case 'option2': $member_lookingfor = 'longterm'; break; case 'option3': $member_lookingfor = 'marriage'; break; case 'option4': $member_lookingfor = 'fwb'; break; } } $member_password_secured = md5($member_password); $sql = "INSERT INTO members (member_id, member_username, member_password, member_email, member_gender, member_location, member_lookingfor) VALUES (NULL, '{$member_username}', '{$member_password_secured}', '{$member_email}', '{$member_gender}', '{$member_location}', '{$member_lookingfor}')"; if (mysqli_query($handle, $sql)) { if (createUserTable($member_username)) { if (initilizeMemberTable($member_username, $member_gender, $member_location, $member_lookingfor)) { header("Location: ../login.html"); } else { header("Location: ../index.html"); } } else { header("Location: ../index.html"); } } else { header("Location: ../index.html"); } mysqli_close($handle);