Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("models/config.php");
- /*
- DreamCMS Version 1.0
- Developed by: Andrei Mikalov (Zeus)
- Thanks to Adam Davis
- Also thanks to Mark Eriksson (m0nsta.) for coding snippets, and Jonas Laursen for extra help.
- */
- function clean($str){ //clean a string and return it
- return mysql_real_escape_string(strip_tags(stripslashes($str))); //return a much cleaner string.
- }
- function userExists($id){ //see if a user exists
- $id = clean($id); //remove any bad content
- $check = mysql_query("SELECT * FROM DreamCMS_Users WHERE `id` = '$id'"); //query to get all data from user
- if(mysql_num_rows($check) == 0){ //the user does not exist
- return false;
- }else{
- return true;
- }
- }
- function userRow($id, $row){ //return data from a user with their id
- $id = clean($id); //remove any bad content
- $check = mysql_query("SELECT * FROM DreamCMS_Users WHERE `id` = '$id'"); //query to get all data from user
- if(mysql_num_rows($check) == 0){ //the user does not exist
- return 'An error occurred!';
- }else{
- $r = mysql_fetch_array($check); //array to get all data
- return $r[$row]; //return '$row' from '$r'
- }
- }
- if(isset($_GET['id'])){ //a user id has been set in the url
- $id = $_GET['id']; //remove any bad content from the users id
- if(!userExists($id)){ //the user does not exist
- $title = 'User does not exist';
- }else{ //user exists
- $title = userRow($id, 'username'); //get their username
- }
- }else{
- $title = 'User does not exist';
- }
- ?>
- <?php
- if($in["username"]){ //check if logged in
- if(userExists($id)){ //the user exists
- echo '<h3>'.userRow($id, 'username').'\'s Profile</h3>';
- echo '<fieldset><legend><strong>User Details</strong></legend>
- <p>
- <label>Username</label><br>
- '.userRow($id, 'username').'
- </p>
- <p>
- <label>User ID</label><br>
- '.userRow($id, 'id').'
- </p>
- <p>
- <label>E-mail</label><br>
- '.userRow($id, 'email').'
- </p>
- <p>
- <label>Rank</label><br>
- '.userRow($id, 'rank').'
- </p>
- <p>
- <label>Join Date</label><br>
- '.userRow($id, 'joindate').'
- </p>
- </fieldset>';
- }else{ //user does not exist
- echo 'This user does not exist!<br><br>« <a href="index.php">Home</a>';
- }
- }else{ //they are not logged in
- echo 'You are not logged in! Therefore you can not view this profile.<br><br>« <a href="index.php">Home</a>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement