Jump to content

Profile tutorial


OriginalBoy

Recommended Posts

Some clarification...you have a user system where they can login?  So they have usernames and passwords, and you just want them to be able to add user information?  That is not too difficult...if I get a chance I will post some example code.  If that is not exactly what you are trying to do, just let me know.

Link to comment
https://forums.phpfreaks.com/topic/105614-profile-tutorial/#findComment-542826
Share on other sites

<?php

// Assuming user has been logged in, and the username has been passed to the URL
// E.G. www.somewhere.com/user.php?user=johndoe
// The login file needs to redirect to that (^) page
/*
Assuming you have a database named "user_info" with these columnames, in this order:
ID (serial)
username
password
email
name
personal description

*Note: this is just an example of columns you could have.
*/

if(isset($_GET['user'])) {
// Connect to the database
$user = $_GET['user'];
$query = "SELECT * from user_info where username = \"$user\"";
$user_info = mysqli_query($connection,$query);
while($row = mysqli_fetch_row($user_info)) {
$email = $row[3];
$name = $row[4];
$pers_descr = $row[5];
echo "<h3>$user</h3>\n<p>Email: $email</p>\n<p>$name: $name</p>\n<p>Personal Description:</p>\n";

}
// *Note: this will perform the query, no mattter if they are logged in or not
}

else { 
// User needs add a username to the URL
header("Location: index.php");
}

?>

 

*Note: this was not tested

Link to comment
https://forums.phpfreaks.com/topic/105614-profile-tutorial/#findComment-543053
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.