All pastes #992856 Raw Edit

Miscellany

public text v1 · immutable
#992856 ·published 2008-04-22 04:57 UTC
rendered paste body
<?
session_start() ;
include"inc/config.php" ;

       switch($_GET['act']){
                case 'home':
                        home();
                        break;
                case 'edit':
                        edit();
                        break;
                case 'do_edit':
                        do_edit();
                        break;
                default:

                        home();

        }

	          function home(){
			  if (!isset($_SESSION['loggedin'])) die('<meta http-equiv="refresh" content="0;URL=account.php?act=do_login">');
				include"template.header.php" ; 
				?>
<style type="text/css">
<!--
.style2 {font-size: 24px}
-->
</style>

	<?
	$query = "SELECT * FROM `users` WHERE `email` = '".$_SESSION['loggedinuser']."' ";
	$result=mysql_query($query) or die(mysql_error());
	$num=mysql_numrows($result);
	$i=0;
	while ($i < $num) {
	$email = htmlentities(mysql_result($result,$i,"email"));
	$first_name = htmlentities(mysql_result($result,$i,"first_name"));
	$last_name = htmlentities(mysql_result($result,$i,"last_name"));
	$country = htmlentities(mysql_result($result,$i,"country"));
	$zip_code = htmlentities(mysql_result($result,$i,"zip_code"));
	$dob = htmlentities(mysql_result($result,$i,"dob"));
	$gender = htmlentities(mysql_result($result,$i,"gender"));
	$reg_date = htmlentities(mysql_result($result,$i,"reg_date"));
	$profileurl = htmlentities(mysql_result($result,$i,"profileurl"));
	$last_activity = htmlentities(mysql_result($result,$i,"last_activity"));
	$nickname = htmlentities(mysql_result($result,$i,"nickname"));
	$avatar = htmlentities(mysql_result($result,$i,"avatar"));
		$year_now = date('Y');
		$age = $year_now - $dob ;
	$i++; 
	}
	?>

<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td colspan="2" background="img/index_cap_bg1.jpg"><strong>&nbsp;Profile Control Panel  </strong></td>
  </tr>
  <tr>
    <td colspan="2" align="left" valign="top" bgcolor="#666666"><p class="style2"><strong>Hello,</strong> 
      <?=$nickname?></p>
      <p><strong>My URL:</strong> <a href="http://www.thesocialplanet.com/<?=$profileurl?>">thesocialplanet.com/<?=$profileurl?>
      </p>    </td>
  </tr>
  <tr>
    <td width="26%" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">

	  <tr>
        <td align="center" valign="middle" bgcolor="#666666"><img src="<?=$avatar?>" width="159" height="135" /></td>
      </tr>
      <tr>
        <td align="center" bgcolor="#666666">
<strong>Profile Views: </strong>
	<?
	include"inc/config.php";
	$query = "SELECT * FROM `users` WHERE `email` = '".$_SESSION['loggedinuser']."' ";
	$result=mysql_query($query) or die(mysql_error());
	$num=mysql_numrows($result);
	$i=0;
	while ($i < $num) {
	$page_views = htmlentities(mysql_result($result,$i,"page_views"));
	$i++; 
	}
	$new_page_views = $page_views + '1' ;
	echo ($new_page_views);
	mysql_query("UPDATE `users` SET `page_views` = $new_page_views WHERE `email` = '$email' ");
	?>		
	</td>
      </tr>
    </table>
    <br />
    <br />
    <table width="100%" border="0" cellspacing="0" cellpadding="2">
      <tr>
        <td align="center" valign="middle" background="img/index_cap_bg1.jpg" bgcolor="#666666"><div align="left"><strong>&nbsp;Edit Profile Sections </strong></div></td>
      </tr>
      <tr>
        <td bgcolor="#666666"><strong>Photos [ </strong><a href="photos.php?act=edit_photos">Edit</a> <strong>/</strong> <a href="photos.php?act=upload_photos">Upload</a> <strong>]</strong>  <br />
            <strong>Videos [ </strong><a href="videos.php?act=edit_videos">Edit</a> <strong>/</strong> <a href="videos.php?act=upload_video">Upload</a> <strong>]</strong><br />
          <strong>About Me [</strong> <a href="profile.php?act=edit">Edit</a> <strong>]</strong></td>
      </tr>
    </table></td>
    <td width="74%" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
      <tr>
        <td align="center" valign="top" bgcolor="#999999"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td background="img/index_cap_bg1.jpg"><strong>
 My Friends               </strong><strong></strong> </td>
            </tr>
          </table>
          <table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="#666666">
            <tr>
              <td width="78%" align="center" valign="top"><table>
	<?
	$query = "SELECT * FROM `user_friends` WHERE `email` = '$email'";
	$result=mysql_query($query) or die(mysql_error());
	$num=mysql_numrows($result);
	$i=0;
	while ($i < $num) {
	$friend = htmlentities(mysql_result($result,$i,"friend"));
				$query78 ="SELECT nickname, avatar, profileurl FROM `users` WHERE `email` = '$friend' ORDER BY nickname";
				$result78 = mysql_query($query78) OR die("ERROR: " . mysql_error());
				if (mysql_num_rows($result78) > 0) {
						$count = 0;
						while ($row = mysql_fetch_assoc($result78)) {
								$count++;
								echo    ($count == 1) ? '<tr>' : '';
								echo ('<td width="25%" align="center" valign="top"><a href="http://thesocialplanet.com/'.$row[profileurl].'"><strong>'.$row[nickname].'</strong></a><br><img src="'.$row[avatar].'" width="75" height="75"><br><br></td>');            
								if ($count == 4) { echo '</tr>'; $count = 0; }
						}
				}
				mysql_free_result($result78);
     
	$i++; 
	}
	?>
			</table>
          </table></td>
      </tr>
            </table>
				
				</td>
              </tr>
          </table></td>
      </tr>
    </table></td>
  </tr>
</table>

				<? include"template.footer.php" ;

			  
?>