Hide Email.

Started on the old forum in March 2009 · view the original in the archive · old links redirect here

7 replies · 461 views · started 17 years ago · 1 min read

2 participants
infested13 Junior · 19 posts #1

i want admin's email to be inputted as HIDDEN if someone view admin's profile. how can i add it to this code?

<?
include("include/session.php");
include("include/protect.php");
?>

<?
$req_user = trim($_GET['user']);
if(!$req_user || strlen($req_user) == 0 ||
   !eregi("^([0-9a-z])+$", $req_user) ||
   !$database->usernameTaken($req_user)){
   die("Username not registered");
}

if(strcmp($session->username,$req_user) == 0){
   echo "<b>My Account</b>";
}

else{
   echo "<b>User Info</b>";
}

$req_user_info = $database->getUserInfo($req_user);

echo "<br><br><b>Username:</b> ".$req_user_info['username']."<br>";

echo "<b>Email:</b> ".$req_user_info['email']."<br>";

if(strcmp($session->username,$req_user) == 0){
   echo "<br><a href=\"useredit.php\">Edit Account</a><br>";
}

echo "<br>[<a href=\"home.php\">Main Menu</a>]<br>";

?>

and i got only username and email in profile.php. how can i add other features like birthday.

GumSlone Administrator Principal · 1,690 posts #2

infested13 wrote: i want admin's email to be inputted as HIDDEN if someone view admin's profile. how can i add it to this code?

and i got only username and email in profile.php. how can i add other features like birthday.

post the mysql tables sructure

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

infested13 Junior · 19 posts #3

GumSlone wrote: post the mysql tables sructure

here's the code sir.

DROP TABLE IF EXISTS users;

CREATE TABLE users (
 username varchar(30) primary key,
 password varchar(32),
 userid varchar(32),
 userlevel tinyint(1) unsigned not null,
 email varchar(50),
 timestamp int(11) unsigned not null
);

DROP TABLE IF EXISTS active_users;

CREATE TABLE active_users (
 username varchar(30) primary key,
 timestamp int(11) unsigned not null
);

DROP TABLE IF EXISTS active_guests;

CREATE TABLE active_guests (
 ip varchar(15) primary key,
 timestamp int(11) unsigned not null
);

DROP TABLE IF EXISTS banned_users;

CREATE TABLE banned_users (
 username varchar(30) primary key,
 timestamp int(11) unsigned not null
);
GumSlone Administrator Principal · 1,690 posts #4

you need to add additional rows in to the mysql table if you want to show more user info in his profile the maximum you can add with the mysql tables posted above is:

echo "<br><br><b>User ID:</b> ".$req_user_info['userid']."<br>"; 

echo "<b>Level:</b> ".$req_user_info['userlevel']."<br>";

and if you want to hide email just remove or comment the line:

echo "<b>Email:</b> ".$req_user_info['email']."<br>";

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

infested13 Junior · 19 posts #5

GumSlone wrote: you need to add additional rows in to the mysql table if you want to show more user info in his profile the maximum you can add with the mysql tables posted above is:

echo "<br><br><b>User ID:</b> ".$req_user_info['userid']."<br>"; 

echo "<b>Level:</b> ".$req_user_info['userlevel']."<br>";

and if you want to hide email just remove or comment the line:

echo "<b>Email:</b> ".$req_user_info['email']."<br>";

ok thanks. about hide email. i dont want to remove it from the other user. just for the admin that will be displayed as HIDDEN. sorry for this noobie question. im just new in PHP and JAVASCRIPT. all i know is html. i think that can be done using if else statement.

GumSlone Administrator Principal · 1,690 posts #6

infested13 wrote: ok thanks. about hide email. i dont want to remove it from the other user. just for the admin that will be displayed as HIDDEN. sorry for this noobie question. im just new in PHP and JAVASCRIPT. all i know is html. i think that can be done using if else statement.

no problem but i cant find in the script which you have posted a function which checks if user is admin, also in the mysql tables is nothing.

but normally it would be something like

if(!$admin)echo "<b>Email:</b> ".$req_user_info['email']."<br>"; 

im not sure what for the field userlevel is? if you give a different levels for users, eg, Admin = level 5 moderator = level 4 user = level 1

then the hide admin email will look like this

if($req_user_info['userlevel']!=5)echo "<b>Email:</b> ".$req_user_info['email']."<br>";

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

infested13 Junior · 19 posts #7

GumSlone wrote: no problem but i cant find in the script which you have posted a function which checks if user is admin, also in the mysql tables is nothing.

but normally it would be something like

if(!$admin)echo "<b>Email:</b> ".$req_user_info['email']."<br>"; 

im not sure what for the field userlevel is? if you give a different levels for users, eg, Admin = level 5 moderator = level 4 user = level 1

then the hide admin email will look like this

if($req_user_info['userlevel']!=5)echo "<b>Email:</b> ".$req_user_info['email']."<br>";

admin is 9. thanks for this. i got it working! two thumbsup.;)

infested13 Junior · 19 posts #8

thanks sir. i made it like this.

if($req_user_info['userlevel']==9) {
echo "<b>Email:</b> [HIDDEN]<br>";
}
else{
echo "<b>Email:</b> ".$req_user_info['email']."<br>";
}

i dont have any idea of this until u post that code. thanks thanks.;)

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close