Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Include the needed file(s)
- require_once("config.php");
- if($isLogged == false) {
- // Not logged in, redirect them I say!
- core::redir("login.php", "You must be logged in to view this page.", "4", "error");
- }
- else {
- $userID = $userInfo['userid'];
- // Check to see if the form has been posted, if not display in php
- if(!$_POST['settings']) {
- ?>
- <p>Any fields that are cleared will revert to their previous data. Leave password blank to avoid changing.</p>
- <form method="post">
- <p>Username<br/><input type="text" name="username" value="<?php echo $userInfo['username'] ?>"/></p>
- <p>Password<br/><input type="password" name="password"/></p>
- <p>First Name<br/><input type="text" name="fname" value="<?php echo $userInfo['fname'] ?>"/></p>
- <p>Last Name<br/><input type="text" name="lname" value="<?php echo $userInfo['lname'] ?>"/></p>
- <p>Website<br/><input type="text" name="website" value="<?php echo $userInfo['website'] ?>"/></p>
- <p>Email<br/><input type="text" name="email" value="<?php echo $userInfo['email'] ?>"/></p>
- <p>Bio<br/><textarea name="bio"><?php echo $userInfo['bio'] ?></textarea></p>
- <p><input type="submit" name="settings" value="Update"/></p>
- </form>
- <?
- }
- else {
- // Only insert stuff that's changed, no point commenting PHP cause if you don't know it well enough to read code it'll be difficult to comprehend
- foreach($_POST as $key => $value){
- if($key != "settings" && $value != ""){
- $key = core::cleanString($value);
- if($key == "password") { $key = md5($value); }
- db::update("users", "$key = '$value'", "userid = '$userID'");
- }
- }
- echo "Success updating your settings.";
- }
- }
- ?>
Add Comment
Please, Sign In to add comment