ok, in your profile settings, you have a slot to put an url to your profile picture...
i kinda realised this is an open invite for hackers to link to a picture hosted on their own server and refer to the access logs to get a direct link to someone elses login, or session id with complete url to their profile as viewed with someone elses details...
so i set about to code this:
////////////////////////pictures
function get_size($path)
{
$count=0;
if(!is_dir($path)) return filesize($path);
if ($handle = opendir($path)) {
$size = 0;
while (false !== ($file = readdir($handle))) {
if($file!='.' && $file!='..' && $file!='index.php') {$count++;
$size = get_size($path.'/'.$file);
$sizekb = round(($size /1024),2);
$sizemb = ($size / 1024)/1024;
$sizemb = round($sizemb,2);
$sizegb = (($size / 1024)/1024)/1024;
$sizegb = round($sizegb,2);
$userpic2=explode(".", $file);
echo "<option value="$file">$file - $sizekb KB</a>";
}
}
closedir($handle);
return $size;
}
}
One problem, this lists all the pictures in the selected folder, (ie: male or female depending on sex)...
I'm having problems trying to get the next bit put together, but you'll see what i was trying to achieve... I hope:)
and here's the code to use the function...
else if($action=="picture")
{
echo "<head>
<title>Profile Pics</title>
<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">
</head>
<body>
";
echo "Pick your desired picture from the gallery below:
";
echo "<form action="index.php?action=updtpropic&sid=$sid" method="post">";
echo "
<select name="pic">";
$sexy=mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE id='".$uid."'"));
if($sexy[0]=='M')
{
get_size('../male');
}
if($sexy[0]=='F')
{
get_size('../female');
}
echo "</select>";
echo "<input type="Submit" name="submit" Value="Save"></form>";
echo "
</body>";
}
ok, here's what i planned, but never got to work... i wanna set it up so it only shows a users pics, not all the images in the folder...
////////////////////////pictures
function get_size($path)
{
$count=0;
if(!is_dir($path)) return filesize($path);
if ($handle = opendir($path)) {
$size = 0;
while (false !== ($file = readdir($handle))) {
if($file!='.' && $file!='..' && $file!='index.php') {$count++;
$size = get_size($path.'/'.$file); // Do not use $size +=...
$sizekb = round(($size /1024),2);
$sizemb = ($size / 1024)/1024;
$sizemb = round($sizemb,2);
$sizegb = (($size / 1024)/1024)/1024;
$sizegb = round($sizegb,2);
$userpic2=explode(".", $file);
//$userpic = $userpic2[0];
$nick = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
$desired1 = "".$nick[0]."(1)";
$desired2 = "$nick0";
$desired3 = "$nick0";
$desired4 = "$nick0";
$desired5 = "$nick0";
// if(("$userpic2[0]"=="".$nick."(1)")||("$userpic2[0]"=="".$nick."(2)"))
//if (($userpic==$nick))
if($userpic2[0]==$desired1)
{
echo "<option value="$file">$file - $sizekb KB</a>";
}
else
{}
}
}
closedir($handle);
return $size;
}
}
////////////////////////pictures
function get_size($path)
{
$count=0;
if(!is_dir($path)) return filesize($path);
if ($handle = opendir($path)) {
$size = 0;
while (false !== ($file = readdir($handle))) {
if($file!='.' && $file!='..' && $file!='index.php') {$count++;
$size = get_size($path.'/'.$file); // Do not use $size +=...
$sizekb = round(($size /1024),2);
$sizemb = ($size / 1024)/1024;
$sizemb = round($sizemb,2);
$sizegb = (($size / 1024)/1024)/1024;
$sizegb = round($sizegb,2);
$userpic2=explode(".", $file);
//$userpic = $userpic2[0];
$nick = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
$desired1 = "".$nick[0]."(1)";
$desired2 = "$nick0";
$desired3 = "$nick0";
$desired4 = "$nick0";
$desired5 = "$nick0";
// if(("$userpic2[0]"=="".$nick."(1)")||("$userpic2[0]"=="".$nick."(2)"))
//if (($userpic==$nick))
if($userpic2[0]==$desired1)
{
echo "<option value="$file">$file - $sizekb KB</a>";
}
else
{}
}
}
closedir($handle);
return $size;
}
}
And I know it's a mess, I was getting desparate towards the end... lol
and to set in db...
////////////////////////////propicset//////////////////////////////////
else if($action=="setavatar")
{
$pic = $_POST["gallerypic"];
$uid = getuid_sid($sid);
$exist = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE id='".$uid."'"));
if ($exist[0]>0)
{
$sexy=mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE id='".$uid."'"));
if($sexy[0]=='M')
{
$res = mysql_query("UPDATE ibwf_users SET avatar='../male/".$pic."' WHERE id='".$uid."'");
}
if($sexy[0]=='F')
{
$res = mysql_query("UPDATE ibwf_users SET avatar='../female/".$pic."' WHERE id='".$uid."'");
}
}else{
$sexy=mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE id='".$uid."'"));
if($sexy[0]=='M')
{
$res = mysql_query("UPDATE ibwf_users SET avatar='../male/".$pic."' WHERE id='".$uid."'");
}
if($sexy[0]=='F')
{
$res = mysql_query("UPDATE ibwf_users SET avatar='../female/".$pic."' WHERE id='".$uid."'");
}
}
echo "<meta http-equiv=Refresh content=0;url=main.php?action=main&sid=$sid>";
}
one last query, anyone know what i'm doing wrong here? cause it never seems to load the nick...
$userpic2=explode(".", $file);
//$userpic = $userpic2[0];
$nick = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
$desired1 = "".$nick[0]."(1)";
$desired2 = "$nick0";
$desired3 = "$nick0";
$desired4 = "$nick0";
$desired5 = "$nick0";
// if(("$userpic2[0]"=="".$nick."(1)")||("$userpic2[0]"=="".$nick."(2)"))
//if (($userpic==$nick))
if($userpic2[0]==$desired1)
sorry if my code is really messed up. this was my final try after six hours... i can't make it query the nick right...