hey friends i code a private profile script, members have to send a request to view his/her profile, i m releasing to all ma friends
PHP Code:
add this to index main page
//////////////////
$reqs1 = getnreqsh($uid);
if($reqs1>0)
{
$request1 = "! <a href=\"lists.php?action=reqs1&sid=$sid\"> $reqs1 Notification</a>";
}
/////////////////////////////
add this to index.php view Profile Where u want to hide
///////////////////////////
if (shad0w($uid, $who))
{
//////////////////
your code in here
////////////////
}else{
echo "<b><b>Privacy Profile !!!</ b> <br/>This profile can only see members with a list of friends and members of the Administration</ b> <br/><br/> ";
echo "<a href=\"genproc.php?action=req&who=$who&sid=$sid&todo=add\">Send Request</a><br/>";
}
////////////////////////////
add this to settingz page
$viewpro = mysql_fetch_array(mysql_query("SELECT viewpro FROM ibwf_users WHERE id = '".$uid."'"));
if($viewpro[0]=="1")
{
echo "<a href=\"genproc.php?action=viewproh&sid=$sid\">Make Profile Public</a><br/>";
}else{
echo "<a href=\"genproc.php?action=viewpron&sid=$sid\">Make Profile Private</a><br/>";
}
//////////////////////////////////////Add this to genproc.php
else if($action=="req")
{
$todo = $_GET["todo"];
$who = $_GET["who"];
addonline(getuid_sid($sid),"Adding/Removing ","");
echo "<head>";
echo "<title>$sitename</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
//$uid = getuid_sid($sid);
$unick = getnick_uid($uid);
$tnick = getnick_uid($who);
if(isignored($uid, $who))
{
echo "<img src=\"../images/notok.gif\" alt=\"X\"/><br/>";
echo "Cannot buddy $tnick they have ignored you...<br/><br/>";
echo "<b>9 </b><a accesskey=\"9\" href=\"lists.php?action=buds&sid=$sid\">Buddylist</a><br/>";
echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p></body></html>";
exit();
}
if($todo=="add")
{
if(hbudres($uid,$who)!=3){
if(areunhi($uid,$who))
{
echo "<img src=\"../images/notok.gif\" alt=\"x\"/>$tnick is already in your list<br/>";
}else if(hbudres($uid, $who)==0)
{
$res = mysql_query("INSERT INTO ibwf_hide SET uid='".$uid."', tid='".$who."', reqdt='".time()."'");
if($res)
{
echo "<img src=\"../images/ok.gif\" alt=\"o\"/>A request has been sent to $tnick<br/>";
$id[0] = 1 ;
$pmtext = "Allow $unick to view your private profile. [br/][br/][small][i]p.s: this is an automated pm[/i][/small]";
$tm = time();
$res = mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$id."', touid='".$who."', timesent='".$tm."'");
}else{
echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You can't add $tnick <br/>";
}
}
else if(hbudres($uid, $who)==1)
{
$res = mysql_query("UPDATE ibwf_hide SET agreed='1' WHERE uid='".$who."' AND tid='".$uid."'");
if($res)
{
echo "<img src=\"../images/ok.gif\" alt=\"o\"/>$tnick Added successfully<br/>";
$id[0] = 1 ;
$pmtext = "Your Request Have been Accepted [br/][br/][small][i]p.s: this is an automated pm[/i][/small]";
$tm = time();
$res = mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$id."', touid='".$who."', timesent='".$tm."'");
}else{
echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You can't add $tnick <br/>";
}
}
else{
echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You can't add $tnick <br/>";
}
}else{
echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You can't add $tnick <br/>";
}
}else if($todo="del")
{
$res= mysql_query("DELETE FROM ibwf_hide WHERE (uid='".$uid."' AND tid='".$who."') OR (uid='".$who."' AND tid='".$uid."')");
if($res)
{
echo "<img src=\"../images/ok.gif\" alt=\"o\"/>$tnick removed from your list<br/>";
$id[0] = 1 ;
$pmtext = "Your Request Have been Deny! [br/][br/][small][i]p.s: this is an automated pm[/i][/small]";
$tm = time();
$res = mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$id."', touid='".$who."', timesent='".$tm."'");
}else{
echo "<img src=\"../images/notok.gif\" alt=\"x\"/>can't remove $tnick from your list<br/>";
}
}
echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p></body>";
}
else if($action=="viewproh")
{
echo "<head>";
echo "<title></title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
$ncl = mysql_query("UPDATE ibwf_users SET automsgs='1' WHERE id='".$uid."'");
echo "Profile changed!.<br/>";
echo "</p>";
echo "<p align=\"center\">";
echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</body>";
}
else if($action=="viewprohn")
{
echo "<head>";
echo "<title></title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
$ncl = mysql_query("UPDATE ibwf_users SET automsgs='0' WHERE id='".$uid."'");
echo "Profile changed!.<br/>";
echo "</p>";
echo "<p align=\"center\">";
echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</body>";
}
///////////////////////Add this to core.php
///////
function shad0w($uid, $who)
{
$pm = mysql_fetch_array(mysql_query("SELECT viewpro FROM ibwf_users WHERE id='".$who."'"));
if($pm[0]=='2')
{
if (ismod($uid))
{
return true;
}else{
return false;
}
return false;
}else if($pm[0]=='1')
{
if($uid==$who||arebuds($uid,$who)||ismod($uid))
{
return true;
}else{
return false;
}
}else if($pm[0]=='0')
{
return true;
}
}
/////////////////////////////////////////////Are
function areunhi($uid, $tid)
{
$res = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_hide WHERE ((uid='".$uid."' AND tid='".$tid."') OR (uid='".$tid."' AND tid='".$uid."')) AND agreed='1'"));
if($res[0]>0)
{
return true;
}
return false;
}
/////////////////////////////////////////////can acc
function hbudres($uid, $tid)
{
//3 = can't
//2 = already
//1 = request pended
//0 = can
if($uid==$tid)
{
return 3;
}
if (areunhi($uid, $tid))
{
return 2;
}
$req = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_hide WHERE ((uid='".$uid."' AND tid='".$tid."') OR (uid='".$tid."' AND tid='".$uid."')) AND agreed='0'"));
if($req[0]>0)
{
return 1;
}
$notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_hide WHERE (uid='".$tid."' OR tid='".$tid."') AND agreed='1'"));
global $max_buds;
if($notb[0]>=$max_buds)
{
return 3;
}
$notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_hide WHERE (uid='".$uid."' OR tid='".$uid."') AND agreed='1'"));
global $max_buds;
if($notb[0]>=$max_buds)
{
return 3;
}
return 0;
}
/////////////////////////////get no. of requists
function getnreqsh($uid)
{
$notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_hide WHERE tid='".$uid."' AND agreed='0'"));
return $notb[0];
}
///////////////////////////////SQL//////////
--
-- Table structure for table `ibwf_hide`
--
CREATE TABLE IF NOT EXISTS `ibwf_hide` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`uid` int(100) NOT NULL DEFAULT '0',
`tid` int(100) NOT NULL DEFAULT '0',
`agreed` char(1) NOT NULL DEFAULT '0',
`reqdt` int(100) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3868 ;
--
-- Dumping data for table `ibwf_hide`
--
And add this to ibwf_users
`viewpro` int(1) NOT NULL DEFAULT '0',
////////////////////////////////////
//Coded by Crash 2010///////////////
//mail - admin@slhitz.com///////////
////////////////////////////////////
Comment