jamesxg1 Posted February 6, 2009 Share Posted February 6, 2009 i need some sort of code the will do the following... heres the sql dump -- -- Table structure for table `friend` -- CREATE TABLE IF NOT EXISTS `friend` ( `User_to` varchar(30) NOT NULL, `User_fr` varchar(30) NOT NULL, `Status` varchar(15) NOT NULL, `DateRequest` varchar(100) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `friend` -- INSERT INTO `friend` (`User_to`, `User_fr`, `Status`, `DateRequest`) VALUES ('test', 'jamesxg1', 'Pending', 'February 6, 2009'); ok so the status is pending. . . so i need a script that will go something like this if($_SESSION['username'] == 'Pending) { echo("You Are Still Peding To Be Friends"); but how do i make it so that the php script matches the $_SESSION['username'] with the User_to table and checks if it says Pending or OK so if it is pending it will display a friend pending request message and if it says OK then it will display there profile. James. Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/ Share on other sites More sharing options...
revraz Posted February 6, 2009 Share Posted February 6, 2009 First thing, do not store your date like that. Use an actual DATE field and store it correctly. Second, you will need to do a query to pull the data for that user, then store it in a session, and then you can compare it. Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-755929 Share on other sites More sharing options...
omfgthezerg Posted February 6, 2009 Share Posted February 6, 2009 Do a mysql query to pull the data. http://www.php.net/mysql Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-755931 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 First thing, do not store your date like that. Use an actual DATE field and store it correctly. Second, you will need to do a query to pull the data for that user, then store it in a session, and then you can compare it. ok will change to date field as we speak, and how is this done :S, could i just put the query in a external php file and require it on my profile.php page and what sort of query would i need :S would it be something like this "SELECT User_to, Status FROM friend WHERE $_SESSION['username'] = 'User_to'" ? Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-755934 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 or "SELECT * FROM friend WHERE $_SESSION['username'] = 'User_to'" Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-755941 Share on other sites More sharing options...
omfgthezerg Posted February 6, 2009 Share Posted February 6, 2009 SELECT `fields` FROM `table` WHERE `field` = 'Value' E.g. SELECT `one`, `two`, `three` FROM `numbers` WHERE `two` = 'Field' Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-755942 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 SELECT `fields` FROM `table` WHERE `field` = 'Value' E.g. SELECT `one`, `two`, `three` FROM `numbers` WHERE `two` = 'Field' sorry yes got the WHERE the wrong way round. ok so i can just require this from other php page ? Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-755944 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 ok here will this work ? <?php $sql = "SELECT * FROM `firend` WHERE User_to = '$_SESSION['username']'"; $query = mysql_query($sql); while ($row = mysql_fetch_assoc($query)) { $User_to = $row['User_to']; $User_fr = $row['User_fr']; $Status = $row['Status']; } ?> Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-755946 Share on other sites More sharing options...
revraz Posted February 6, 2009 Share Posted February 6, 2009 In order to use Sessions, you need to have session_start at the top of each page that you want to use it. <?php session_start(); $sql = "SELECT * FROM `firend` WHERE User_to = '{$_SESSION['username']}'"; $query = mysql_query($sql) or die (mysql_error()); Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-755962 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 In order to use Sessions, you need to have session_start at the top of each page that you want to use it. <?php session_start(); $sql = "SELECT * FROM `firend` WHERE User_to = '{$_SESSION['username']}'"; $query = mysql_query($sql) or die (mysql_error()); Ok, Heres the code so far <?php session_start(); $sql = "SELECT * FROM `firend` WHERE User_to = '{$_SESSION['username']}'"; $query = mysql_query($sql) or die (mysql_error()); while ($row = mysql_fetch_assoc($query)) { $User_to = $row['User_to']; $User_fr = $row['User_fr']; $Status = $row['Status']; } ?> so how do i match the session username to the status and display contant depending on what the status is ? Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-755979 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 <?php if($_SESSION['status'] == 'Pending') { echo("Sorry!, No can do you are still pending to be friends with $username"); } ?> Will this work ? Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-755989 Share on other sites More sharing options...
gevans Posted February 6, 2009 Share Posted February 6, 2009 Try it Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-755993 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 Try it not working , is there anyway i can modify the <?php session_start(); out of the query to make it so that it is recignised as $_SESSION['Status'] ? Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-755998 Share on other sites More sharing options...
gevans Posted February 6, 2009 Share Posted February 6, 2009 Post all the code you have so far Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-756001 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 Post all the code you have so far Friends.php <?php session_start(); $sql = "SELECT * FROM `friend` WHERE User_to = '{$_SESSION['username']}'"; $query = mysql_query($sql) or die (mysql_error()); while ($row = mysql_fetch_assoc($query)) { $User_to = $row['User_to']; $User_fr = $row['User_fr']; $Status = $row['Status']; } ?> This is what i have put in profile.php <?php require("../db/friends.php"); ?> <?php if($_SESSION['$Status'] == 'Pending') { print("Sorry!, No can do you are still pending to be friends with $username"); } ?> Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-756003 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 this is my whole profile.php code <?php session_start(); require("../db/db.php"); //include database file require("../db/config.php"); //include configuration file require("../db/util.php"); require("../db/settings.php"); require("../db/friends.php"); isloggedin(); accessneeded("C"); ?> <?php $id = mysql_real_escape_string($_GET['id']); $username = mysql_real_escape_string($_GET['username']); $sql = "SELECT * FROM `users` WHERE `id`='$id' OR `username`='$username' LIMIT 1"; $query = mysql_query($sql); if(mysql_num_rows($query) > 0){ //display content while ($row = mysql_fetch_assoc($query)) { $id = $row['id']; $photo = $row['photo']; $gender = $row['gender']; $email = $row['email']; $firstn = $row['firstname']; $lastn = $row['lastname']; $dobd = $row['dobDay']; $dobm = $row['dobMonth']; $doby = $row['dobYear']; $username = $row['username']; $music = $row['music']; $movies = $row ['movies']; $scaredof = $row['scaredof']; $field1 = $row['field1']; $field2 = $row['field2']; $field3 = $row['field3']; $field4 = $row['field4']; $field5 = $row['field5']; $fieldb1 = $row['fieldb1']; $fieldb2 = $row['fieldb2']; $tagline = $row['tagline']; } }else{ header('Location: ../main/profileerror.php'); } ?> <html> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php print $title ?> - <?php print $firstn ?> <?php print $lastn ?>'s Profile</title> <!-- Insert your commenting javascript code here --> </head> <script type="text/javascript" src="../main/inc/ajax_framework.js"></script> <link rel="stylesheet" type="text/css" href="../main/inc/jqueryslidemenu.css" /> <!--[if lte IE 7]> <style type="text/css"> html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/ </style> <![endif]--> <script type="text/javascript" src="../main/inc/jquery.min.js"></script> <script type="text/javascript" src="../main/inc/jqueryslidemenu.js"></script> <style type="text/css" media="all"> body { margin: 0px; font-family: tahoma, sans-serif; padding-bottom: 20px; background: #FFFFFF; font-size: 12px; color: #333333;} #Granny { width: 900px; font-size: 0.88em; } a { text-decoration: none; color: #0000FF; } a img { border-width: 0px; } #HeaderCont { clear: both; width: 100%; margin-top: 30px; background: #CCC; border: 1px solid #333; } #HeaderInn { margin-bottom: 4px; padding: 5px 0px; text-align: left; font-family: Tahoma, sans-serif, sans-serif; } #HeaderTitle { font-size: 3em; color: #000000; padding: 0px 40px; direction: ltr; text-align: left; } .TitleItemLink { color: #000000; } #MainAndSides { clear: both; width: 100%; margin-top: 15px; } #MainCol { width: 73%; background: #F6F6F6; float: right; } #MainColInner { padding: 10px 20px; border: 1px solid #000000; } .OnePost { border: 1px solid #000000; font-family: Tahoma, sans-serif, sans-serif; direction: ltr; background: #EEE; } .OnePost .TopPost { border-bottom: 1px solid #666; padding: 0px 20px 3px 20px; background: #CCC; } .OnePost .MidPost { padding: 15px 25px; } .OnePost .BotPost { border-top: 1px solid #666; padding: 3px 20px; background: #CCC; } .OnePost .FullWidth { width: 100%; } .DateHeaderPost { font-size: 1em; color: #000000; padding-top: 3px; text-align: right; width: 48%; float: right; } .TitleHeaderPost { font-size: 1em; font-weight: bold; color: #000000; padding-top: 3px; text-align: left; direction: ltr; width: 48%; float: left; } .TitleHeaderPost a { color: #000000; } .PostTextBody { font-size: 1em; color: #000000; text-align: left; line-height: 150%; } .CmntFooterPost { visibility: visible; font-size: 1em; color: #333; width: 48%; float: right; text-align: right; } .CmntFooterPost a { color: #333; } .PermFooterPost { font-size: 1em; font-style: italic; color: #333; width: 48%; float: left; text-align: left; } .PermFooterPost a { color: #333; } .Clearer { clear: both; width: 100%; font-size: 0px; height: 0px; } .PostSep { height: 20px; font-size: 1px } .PostSepS { height: 10px; margin-bottom: 10px; border-bottom: 1px solid #000000; font-size: 1px } .SideBar { background: #999; } .SideBarInner { padding: 15px 15px; border: 1px solid #000000; } .SideBarInner img { margin-top: 2px; } #SideLCol { width: 25%; float: left; margin-right: 1.5%; } #SideLCol .Box { background: #CCC; border: 1px solid #666; font-family: Tahoma, sans-serif, sans-serif; } #SideLCol .Sep { height: 30px; } #SideLCol .SepS { height: 14.5px; margin-bottom: 14.5px; border-bottom: 1px solid #000000; font-size: 1px } #SideLCol .Title { font-size: 1em; color: #000000; font-weight: bold; border-bottom: 1px solid #333; margin-bottom: 3px; } #SideLCol .Inner { text-align: center; font-size: 1em; color: #333; padding: 5px 15px 8px 15px; line-height: 150%; } #commentInline { margin: 10px 20px; text-align: left; } .commentHead { margin: 0px 10px 20px 10px; padding-top: 5px; color: #333; } .comments-block { line-height: 150%; padding: 0px 30px; } .comment-poster { padding-bottom: 10px; } .comment-body { margin: 0px; padding-bottom: 10px; padding-left: 20px; } .innerCmntBody { margin: 5px 0px; } .comment-timestamp { margin: 5px 0px; padding: 0px 0px 8px 20px; color: #999; } .comment-timestamp a { color: #666; } .deleted-comment { font-style: italic; color: gray; } #ColClose { clear: both; width: 100%; font-size: 1px; height: 1px; margin-bottom: 20px; } #CopyRight { width: 60%; border-top: 1px solid gray; padding-top: 10px; line-height: 150%; } /* This template generated by PsycHo [http://psyc.horm.org] on 1/26/2009. */ </style> <div id="myslidemenu" class="jqueryslidemenu"> <!-- CSS --> <link rel="stylesheet" href="../template/lightbox.css" media="screen,projection" type="text/css" /> <!-- JavaScript --> <script type="text/javascript" src="../inc/gen/prototype.js"></script> <script type="text/javascript" src="../inc/gen/lightbox.js"></script> </head> <ul> <li><a href="../main/index.php">Home</a></li> <li><a href="../messages/inbox.php">Mail <?php $sql = mysql_query ("SELECT pm_count FROM users WHERE username = '{$_SESSION['username']}'"); $row = mysql_fetch_array ($sql); $pm_count = $row['pm_count']; ?>(<?php print "$pm_count" ?>)</a></li> <li><a href="#">Profile</a> <ul> <li><a href="">View Profile</a></li> <li><a href="../main/editprofile.php">Edit Profile</a></li> <li><a href="../main/profilephotoupload.php">Profile Photo</a></li> <li><a href="#">Privacy Settings</a></li> </ul> </li> <li><a href="#">Items</a></li> <li><a href="../friends/friends.php">Friends</a> <ul> <li><a href="#">Friend Requests</a></li> <li><a href="#">Invitation</a> </li> <li><a href="#">Invite Friends</a></li> </ul> </li> <li><a href="../login/logout.php">Sign Out</a></li> <li><?php print ("<img src='../main/images/$photo' width='28' height='30'>"); ?></li> </ul> <br style="clear: left" /> </div> <body><center> <div id="Granny"> <div id="HeaderCont"><div id="HeaderInn"> <div class="Clearer"></div> <div id="HeaderTitle"> <center><?php print $tagline ?><center> </div> <div class="Clearer"></div> </div></div> <div id="MainAndSides"> <!-- ==================== Main Column ==================== --> <div id="MainCol"> <div id="MainColInner"> <Blogger> <div class="OnePost"> <a name=""></a> <div class="TopPost"><div class="FullWidth"> <div class="DateHeaderPost"> </div> <div class="TitleHeaderPost"> Information: </div> <div class="Clearer"></div> </div></div> <div class="MidPost"><div class="FullWidth"> <div class="PostTextBody"> <?php print("<P ALIGN=CENTER><strong>$field1</strong><br>$music<br><strong>$field2</strong><br>$movies<br><strong>$field3</strong><br>$scaredof<br><strong>$field4</strong><br>$fieldb1<br><strong>$field5</strong><br>$fieldb2</p>"); ?> <?php if($_SESSION['$Status'] == 'Pending') { print("Sorry!, No can do you are still pending to be friends with $username"); } ?> </div> </div></div> <div class="BotPost"><div class="FullWidth"> <div class="PermFooterPost"> <strong>Profile Comments:</strong> </div> <div class="CmntFooterPost"> <!-- Insert your external commenting service scripts here and remove the line below --> </div> <div class="Clearer"></div> </div></div> </div> <ItemPage> <div id="commentInline"> <div class="commentHead"></div> </span> <div id="insert_response" align=center></div> <P ALIGN=CENTER> <form action="javascript:insert()" method="post"> <input type="hidden" name="comto" value="<? echo $username ?>" id="comto"> <input type="hidden" name="comfrom" value="<? echo($_SESSION['username']); ?>" id="$comfrom"> Comment: <br><textarea name="commen" cols="45" rows="5" wrap="VIRTUAL" id="$commen"></textarea> <br> <input type="submit" name="submit" value="Send"> </form></P> <?php $sql = "SELECT * FROM `comments` WHERE comto = '$username'"; $query = mysql_query($sql); while ($row = mysql_fetch_assoc($query)) { $from = $row['comfrom']; $message = $row['commen']; $too = $row['comto']; $comid = $row['id']; echo "<br/>\n"; print("<P ALIGN=CENTER><strong>$from</strong><br>$message</P>"); if($_SESSION['username'] == $too) { print("<br><P ALIGN=RIGHT><a href='../main/DeleteComment.php?id=$comid'>Delete Comment</a></P>"); } } ?> <br> </div> </ItemPage> <div class="PostSep"><div class="PostSepS"></div></div> </div> </div> <!-- =================== Side L Column =================== --> <div id="SideLCol" class="SideBar"> <div class="SideBarInner"> <div class="Box"> <div class="Inner"> <div class="Title">Profile Image</div> <?php print ("<img src='../main/images/$photo' width='150'>"); ?> <br /> </div> <a href='../main/editprofile.php'>Edit Profile</a> | <a href='../main/profilephotoupload.php' class='lbOn'>Profile Photo</a> </div> <div class="Clearer"></div> </div> <div class="Clearer"></div> <div class="Clearer"></div> <div class="SideBarInner"> <div class="Box"> <div class="Inner"> <div class="Title">Contact <?php print $firstn ?></div> <a href="../messages/compose.php?username=<?php print $username ?>" class="lbOn">Send Message</a> || <a href="../friends/add.php?username=<?php print $username ?>">Add As Firend</a><br> <a href="../main/blockfriend.php?username=<?php print $username ?>">Block User</a> || <a href="../main/reportuser.php?username=<?php print $username ?>" class="lbOn">Report User</a> <br /> </div> </div> </div> </div> </div> <div id="ColClose"></div> <div id="CopyRight"> <br /> <br /> </div> </div> </center></body> </html> Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-756005 Share on other sites More sharing options...
omfgthezerg Posted February 6, 2009 Share Posted February 6, 2009 You need session_start first before using any $_SESSION functions. session_start must also be used before any output to the browser window. Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-756007 Share on other sites More sharing options...
gevans Posted February 6, 2009 Share Posted February 6, 2009 this is my whole profile.php code <?php session_start(); require("../db/db.php"); //include database file require("../db/config.php"); //include configuration file require("../db/util.php"); require("../db/settings.php"); require("../db/friends.php"); isloggedin(); accessneeded("C"); ?> <?php $id = mysql_real_escape_string($_GET['id']); $username = mysql_real_escape_string($_GET['username']); $sql = "SELECT * FROM `users` WHERE `id`='$id' OR `username`='$username' LIMIT 1"; $query = mysql_query($sql); if(mysql_num_rows($query) > 0){ //display content while ($row = mysql_fetch_assoc($query)) { $id = $row['id']; $photo = $row['photo']; $gender = $row['gender']; $email = $row['email']; $firstn = $row['firstname']; $lastn = $row['lastname']; $dobd = $row['dobDay']; $dobm = $row['dobMonth']; $doby = $row['dobYear']; $username = $row['username']; $music = $row['music']; $movies = $row ['movies']; $scaredof = $row['scaredof']; $field1 = $row['field1']; $field2 = $row['field2']; $field3 = $row['field3']; $field4 = $row['field4']; $field5 = $row['field5']; $fieldb1 = $row['fieldb1']; $fieldb2 = $row['fieldb2']; $tagline = $row['tagline']; } }else{ header('Location: ../main/profileerror.php'); } ?> <html> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php print $title ?> - <?php print $firstn ?> <?php print $lastn ?>'s Profile</title> <!-- Insert your commenting javascript code here --> </head> <script type="text/javascript" src="../main/inc/ajax_framework.js"></script> <link rel="stylesheet" type="text/css" href="../main/inc/jqueryslidemenu.css" /> <!--[if lte IE 7]> <style type="text/css"> html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/ </style> <![endif]--> <script type="text/javascript" src="../main/inc/jquery.min.js"></script> <script type="text/javascript" src="../main/inc/jqueryslidemenu.js"></script> <style type="text/css" media="all"> body { margin: 0px; font-family: tahoma, sans-serif; padding-bottom: 20px; background: #FFFFFF; font-size: 12px; color: #333333;} #Granny { width: 900px; font-size: 0.88em; } a { text-decoration: none; color: #0000FF; } a img { border-width: 0px; } #HeaderCont { clear: both; width: 100%; margin-top: 30px; background: #CCC; border: 1px solid #333; } #HeaderInn { margin-bottom: 4px; padding: 5px 0px; text-align: left; font-family: Tahoma, sans-serif, sans-serif; } #HeaderTitle { font-size: 3em; color: #000000; padding: 0px 40px; direction: ltr; text-align: left; } .TitleItemLink { color: #000000; } #MainAndSides { clear: both; width: 100%; margin-top: 15px; } #MainCol { width: 73%; background: #F6F6F6; float: right; } #MainColInner { padding: 10px 20px; border: 1px solid #000000; } .OnePost { border: 1px solid #000000; font-family: Tahoma, sans-serif, sans-serif; direction: ltr; background: #EEE; } .OnePost .TopPost { border-bottom: 1px solid #666; padding: 0px 20px 3px 20px; background: #CCC; } .OnePost .MidPost { padding: 15px 25px; } .OnePost .BotPost { border-top: 1px solid #666; padding: 3px 20px; background: #CCC; } .OnePost .FullWidth { width: 100%; } .DateHeaderPost { font-size: 1em; color: #000000; padding-top: 3px; text-align: right; width: 48%; float: right; } .TitleHeaderPost { font-size: 1em; font-weight: bold; color: #000000; padding-top: 3px; text-align: left; direction: ltr; width: 48%; float: left; } .TitleHeaderPost a { color: #000000; } .PostTextBody { font-size: 1em; color: #000000; text-align: left; line-height: 150%; } .CmntFooterPost { visibility: visible; font-size: 1em; color: #333; width: 48%; float: right; text-align: right; } .CmntFooterPost a { color: #333; } .PermFooterPost { font-size: 1em; font-style: italic; color: #333; width: 48%; float: left; text-align: left; } .PermFooterPost a { color: #333; } .Clearer { clear: both; width: 100%; font-size: 0px; height: 0px; } .PostSep { height: 20px; font-size: 1px } .PostSepS { height: 10px; margin-bottom: 10px; border-bottom: 1px solid #000000; font-size: 1px } .SideBar { background: #999; } .SideBarInner { padding: 15px 15px; border: 1px solid #000000; } .SideBarInner img { margin-top: 2px; } #SideLCol { width: 25%; float: left; margin-right: 1.5%; } #SideLCol .Box { background: #CCC; border: 1px solid #666; font-family: Tahoma, sans-serif, sans-serif; } #SideLCol .Sep { height: 30px; } #SideLCol .SepS { height: 14.5px; margin-bottom: 14.5px; border-bottom: 1px solid #000000; font-size: 1px } #SideLCol .Title { font-size: 1em; color: #000000; font-weight: bold; border-bottom: 1px solid #333; margin-bottom: 3px; } #SideLCol .Inner { text-align: center; font-size: 1em; color: #333; padding: 5px 15px 8px 15px; line-height: 150%; } #commentInline { margin: 10px 20px; text-align: left; } .commentHead { margin: 0px 10px 20px 10px; padding-top: 5px; color: #333; } .comments-block { line-height: 150%; padding: 0px 30px; } .comment-poster { padding-bottom: 10px; } .comment-body { margin: 0px; padding-bottom: 10px; padding-left: 20px; } .innerCmntBody { margin: 5px 0px; } .comment-timestamp { margin: 5px 0px; padding: 0px 0px 8px 20px; color: #999; } .comment-timestamp a { color: #666; } .deleted-comment { font-style: italic; color: gray; } #ColClose { clear: both; width: 100%; font-size: 1px; height: 1px; margin-bottom: 20px; } #CopyRight { width: 60%; border-top: 1px solid gray; padding-top: 10px; line-height: 150%; } /* This template generated by PsycHo [http://psyc.horm.org] on 1/26/2009. */ </style> <div id="myslidemenu" class="jqueryslidemenu"> <!-- CSS --> <link rel="stylesheet" href="../template/lightbox.css" media="screen,projection" type="text/css" /> <!-- JavaScript --> <script type="text/javascript" src="../inc/gen/prototype.js"></script> <script type="text/javascript" src="../inc/gen/lightbox.js"></script> </head> <ul> <li><a href="../main/index.php">Home</a></li> <li><a href="../messages/inbox.php">Mail <?php $sql = mysql_query ("SELECT pm_count FROM users WHERE username = '{$_SESSION['username']}'"); $row = mysql_fetch_array ($sql); $pm_count = $row['pm_count']; ?>(<?php print "$pm_count" ?>)</a></li> <li><a href="#">Profile</a> <ul> <li><a href="">View Profile</a></li> <li><a href="../main/editprofile.php">Edit Profile</a></li> <li><a href="../main/profilephotoupload.php">Profile Photo</a></li> <li><a href="#">Privacy Settings</a></li> </ul> </li> <li><a href="#">Items</a></li> <li><a href="../friends/friends.php">Friends</a> <ul> <li><a href="#">Friend Requests</a></li> <li><a href="#">Invitation</a> </li> <li><a href="#">Invite Friends</a></li> </ul> </li> <li><a href="../login/logout.php">Sign Out</a></li> <li><?php print ("<img src='../main/images/$photo' width='28' height='30'>"); ?></li> </ul> <br style="clear: left" /> </div> <body><center> <div id="Granny"> <div id="HeaderCont"><div id="HeaderInn"> <div class="Clearer"></div> <div id="HeaderTitle"> <center><?php print $tagline ?><center> </div> <div class="Clearer"></div> </div></div> <div id="MainAndSides"> <!-- ==================== Main Column ==================== --> <div id="MainCol"> <div id="MainColInner"> <Blogger> <div class="OnePost"> <a name=""></a> <div class="TopPost"><div class="FullWidth"> <div class="DateHeaderPost"> </div> <div class="TitleHeaderPost"> Information: </div> <div class="Clearer"></div> </div></div> <div class="MidPost"><div class="FullWidth"> <div class="PostTextBody"> <?php print("<P ALIGN=CENTER><strong>$field1</strong><br>$music<br><strong>$field2</strong><br>$movies<br><strong>$field3</strong><br>$scaredof<br><strong>$field4</strong><br>$fieldb1<br><strong>$field5</strong><br>$fieldb2</p>"); ?> <?php if($_SESSION['$Status'] == 'Pending') { print("Sorry!, No can do you are still pending to be friends with $username"); } ?> </div> </div></div> <div class="BotPost"><div class="FullWidth"> <div class="PermFooterPost"> <strong>Profile Comments:</strong> </div> <div class="CmntFooterPost"> <!-- Insert your external commenting service scripts here and remove the line below --> </div> <div class="Clearer"></div> </div></div> </div> <ItemPage> <div id="commentInline"> <div class="commentHead"></div> </span> <div id="insert_response" align=center></div> <P ALIGN=CENTER> <form action="javascript:insert()" method="post"> <input type="hidden" name="comto" value="<? echo $username ?>" id="comto"> <input type="hidden" name="comfrom" value="<? echo($_SESSION['username']); ?>" id="$comfrom"> Comment: <br><textarea name="commen" cols="45" rows="5" wrap="VIRTUAL" id="$commen"></textarea> <br> <input type="submit" name="submit" value="Send"> </form></P> <?php $sql = "SELECT * FROM `comments` WHERE comto = '$username'"; $query = mysql_query($sql); while ($row = mysql_fetch_assoc($query)) { $from = $row['comfrom']; $message = $row['commen']; $too = $row['comto']; $comid = $row['id']; echo "<br/>\n"; print("<P ALIGN=CENTER><strong>$from</strong><br>$message</P>"); if($_SESSION['username'] == $too) { print("<br><P ALIGN=RIGHT><a href='../main/DeleteComment.php?id=$comid'>Delete Comment</a></P>"); } } ?> <br> </div> </ItemPage> <div class="PostSep"><div class="PostSepS"></div></div> </div> </div> <!-- =================== Side L Column =================== --> <div id="SideLCol" class="SideBar"> <div class="SideBarInner"> <div class="Box"> <div class="Inner"> <div class="Title">Profile Image</div> <?php print ("<img src='../main/images/$photo' width='150'>"); ?> <br /> </div> <a href='../main/editprofile.php'>Edit Profile</a> | <a href='../main/profilephotoupload.php' class='lbOn'>Profile Photo</a> </div> <div class="Clearer"></div> </div> <div class="Clearer"></div> <div class="Clearer"></div> <div class="SideBarInner"> <div class="Box"> <div class="Inner"> <div class="Title">Contact <?php print $firstn ?></div> <a href="../messages/compose.php?username=<?php print $username ?>" class="lbOn">Send Message</a> || <a href="../friends/add.php?username=<?php print $username ?>">Add As Firend</a><br> <a href="../main/blockfriend.php?username=<?php print $username ?>">Block User</a> || <a href="../main/reportuser.php?username=<?php print $username ?>" class="lbOn">Report User</a> <br /> </div> </div> </div> </div> </div> <div id="ColClose"></div> <div id="CopyRight"> <br /> <br /> </div> </div> </center></body> </html> Where's <?php require("../db/friends.php"); ?> ?? Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-756011 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 You need session_start first before using any $_SESSION functions. session_start must also be used before any output to the browser window. i think there's a session_start in the profile.php whole code ^^ yea there is lol at the top of the page Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-756012 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 this is my whole profile.php code <?php session_start(); require("../db/db.php"); //include database file require("../db/config.php"); //include configuration file require("../db/util.php"); require("../db/settings.php"); require("../db/friends.php"); isloggedin(); accessneeded("C"); ?> <?php $id = mysql_real_escape_string($_GET['id']); $username = mysql_real_escape_string($_GET['username']); $sql = "SELECT * FROM `users` WHERE `id`='$id' OR `username`='$username' LIMIT 1"; $query = mysql_query($sql); if(mysql_num_rows($query) > 0){ //display content while ($row = mysql_fetch_assoc($query)) { $id = $row['id']; $photo = $row['photo']; $gender = $row['gender']; $email = $row['email']; $firstn = $row['firstname']; $lastn = $row['lastname']; $dobd = $row['dobDay']; $dobm = $row['dobMonth']; $doby = $row['dobYear']; $username = $row['username']; $music = $row['music']; $movies = $row ['movies']; $scaredof = $row['scaredof']; $field1 = $row['field1']; $field2 = $row['field2']; $field3 = $row['field3']; $field4 = $row['field4']; $field5 = $row['field5']; $fieldb1 = $row['fieldb1']; $fieldb2 = $row['fieldb2']; $tagline = $row['tagline']; } }else{ header('Location: ../main/profileerror.php'); } ?> <html> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php print $title ?> - <?php print $firstn ?> <?php print $lastn ?>'s Profile</title> <!-- Insert your commenting javascript code here --> </head> <script type="text/javascript" src="../main/inc/ajax_framework.js"></script> <link rel="stylesheet" type="text/css" href="../main/inc/jqueryslidemenu.css" /> <!--[if lte IE 7]> <style type="text/css"> html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/ </style> <![endif]--> <script type="text/javascript" src="../main/inc/jquery.min.js"></script> <script type="text/javascript" src="../main/inc/jqueryslidemenu.js"></script> <style type="text/css" media="all"> body { margin: 0px; font-family: tahoma, sans-serif; padding-bottom: 20px; background: #FFFFFF; font-size: 12px; color: #333333;} #Granny { width: 900px; font-size: 0.88em; } a { text-decoration: none; color: #0000FF; } a img { border-width: 0px; } #HeaderCont { clear: both; width: 100%; margin-top: 30px; background: #CCC; border: 1px solid #333; } #HeaderInn { margin-bottom: 4px; padding: 5px 0px; text-align: left; font-family: Tahoma, sans-serif, sans-serif; } #HeaderTitle { font-size: 3em; color: #000000; padding: 0px 40px; direction: ltr; text-align: left; } .TitleItemLink { color: #000000; } #MainAndSides { clear: both; width: 100%; margin-top: 15px; } #MainCol { width: 73%; background: #F6F6F6; float: right; } #MainColInner { padding: 10px 20px; border: 1px solid #000000; } .OnePost { border: 1px solid #000000; font-family: Tahoma, sans-serif, sans-serif; direction: ltr; background: #EEE; } .OnePost .TopPost { border-bottom: 1px solid #666; padding: 0px 20px 3px 20px; background: #CCC; } .OnePost .MidPost { padding: 15px 25px; } .OnePost .BotPost { border-top: 1px solid #666; padding: 3px 20px; background: #CCC; } .OnePost .FullWidth { width: 100%; } .DateHeaderPost { font-size: 1em; color: #000000; padding-top: 3px; text-align: right; width: 48%; float: right; } .TitleHeaderPost { font-size: 1em; font-weight: bold; color: #000000; padding-top: 3px; text-align: left; direction: ltr; width: 48%; float: left; } .TitleHeaderPost a { color: #000000; } .PostTextBody { font-size: 1em; color: #000000; text-align: left; line-height: 150%; } .CmntFooterPost { visibility: visible; font-size: 1em; color: #333; width: 48%; float: right; text-align: right; } .CmntFooterPost a { color: #333; } .PermFooterPost { font-size: 1em; font-style: italic; color: #333; width: 48%; float: left; text-align: left; } .PermFooterPost a { color: #333; } .Clearer { clear: both; width: 100%; font-size: 0px; height: 0px; } .PostSep { height: 20px; font-size: 1px } .PostSepS { height: 10px; margin-bottom: 10px; border-bottom: 1px solid #000000; font-size: 1px } .SideBar { background: #999; } .SideBarInner { padding: 15px 15px; border: 1px solid #000000; } .SideBarInner img { margin-top: 2px; } #SideLCol { width: 25%; float: left; margin-right: 1.5%; } #SideLCol .Box { background: #CCC; border: 1px solid #666; font-family: Tahoma, sans-serif, sans-serif; } #SideLCol .Sep { height: 30px; } #SideLCol .SepS { height: 14.5px; margin-bottom: 14.5px; border-bottom: 1px solid #000000; font-size: 1px } #SideLCol .Title { font-size: 1em; color: #000000; font-weight: bold; border-bottom: 1px solid #333; margin-bottom: 3px; } #SideLCol .Inner { text-align: center; font-size: 1em; color: #333; padding: 5px 15px 8px 15px; line-height: 150%; } #commentInline { margin: 10px 20px; text-align: left; } .commentHead { margin: 0px 10px 20px 10px; padding-top: 5px; color: #333; } .comments-block { line-height: 150%; padding: 0px 30px; } .comment-poster { padding-bottom: 10px; } .comment-body { margin: 0px; padding-bottom: 10px; padding-left: 20px; } .innerCmntBody { margin: 5px 0px; } .comment-timestamp { margin: 5px 0px; padding: 0px 0px 8px 20px; color: #999; } .comment-timestamp a { color: #666; } .deleted-comment { font-style: italic; color: gray; } #ColClose { clear: both; width: 100%; font-size: 1px; height: 1px; margin-bottom: 20px; } #CopyRight { width: 60%; border-top: 1px solid gray; padding-top: 10px; line-height: 150%; } /* This template generated by PsycHo [http://psyc.horm.org] on 1/26/2009. */ </style> <div id="myslidemenu" class="jqueryslidemenu"> <!-- CSS --> <link rel="stylesheet" href="../template/lightbox.css" media="screen,projection" type="text/css" /> <!-- JavaScript --> <script type="text/javascript" src="../inc/gen/prototype.js"></script> <script type="text/javascript" src="../inc/gen/lightbox.js"></script> </head> <ul> <li><a href="../main/index.php">Home</a></li> <li><a href="../messages/inbox.php">Mail <?php $sql = mysql_query ("SELECT pm_count FROM users WHERE username = '{$_SESSION['username']}'"); $row = mysql_fetch_array ($sql); $pm_count = $row['pm_count']; ?>(<?php print "$pm_count" ?>)</a></li> <li><a href="#">Profile</a> <ul> <li><a href="">View Profile</a></li> <li><a href="../main/editprofile.php">Edit Profile</a></li> <li><a href="../main/profilephotoupload.php">Profile Photo</a></li> <li><a href="#">Privacy Settings</a></li> </ul> </li> <li><a href="#">Items</a></li> <li><a href="../friends/friends.php">Friends</a> <ul> <li><a href="#">Friend Requests</a></li> <li><a href="#">Invitation</a> </li> <li><a href="#">Invite Friends</a></li> </ul> </li> <li><a href="../login/logout.php">Sign Out</a></li> <li><?php print ("<img src='../main/images/$photo' width='28' height='30'>"); ?></li> </ul> <br style="clear: left" /> </div> <body><center> <div id="Granny"> <div id="HeaderCont"><div id="HeaderInn"> <div class="Clearer"></div> <div id="HeaderTitle"> <center><?php print $tagline ?><center> </div> <div class="Clearer"></div> </div></div> <div id="MainAndSides"> <!-- ==================== Main Column ==================== --> <div id="MainCol"> <div id="MainColInner"> <Blogger> <div class="OnePost"> <a name=""></a> <div class="TopPost"><div class="FullWidth"> <div class="DateHeaderPost"> </div> <div class="TitleHeaderPost"> Information: </div> <div class="Clearer"></div> </div></div> <div class="MidPost"><div class="FullWidth"> <div class="PostTextBody"> <?php print("<P ALIGN=CENTER><strong>$field1</strong><br>$music<br><strong>$field2</strong><br>$movies<br><strong>$field3</strong><br>$scaredof<br><strong>$field4</strong><br>$fieldb1<br><strong>$field5</strong><br>$fieldb2</p>"); ?> <?php if($_SESSION['$Status'] == 'Pending') { print("Sorry!, No can do you are still pending to be friends with $username"); } ?> </div> </div></div> <div class="BotPost"><div class="FullWidth"> <div class="PermFooterPost"> <strong>Profile Comments:</strong> </div> <div class="CmntFooterPost"> <!-- Insert your external commenting service scripts here and remove the line below --> </div> <div class="Clearer"></div> </div></div> </div> <ItemPage> <div id="commentInline"> <div class="commentHead"></div> </span> <div id="insert_response" align=center></div> <P ALIGN=CENTER> <form action="javascript:insert()" method="post"> <input type="hidden" name="comto" value="<? echo $username ?>" id="comto"> <input type="hidden" name="comfrom" value="<? echo($_SESSION['username']); ?>" id="$comfrom"> Comment: <br><textarea name="commen" cols="45" rows="5" wrap="VIRTUAL" id="$commen"></textarea> <br> <input type="submit" name="submit" value="Send"> </form></P> <?php $sql = "SELECT * FROM `comments` WHERE comto = '$username'"; $query = mysql_query($sql); while ($row = mysql_fetch_assoc($query)) { $from = $row['comfrom']; $message = $row['commen']; $too = $row['comto']; $comid = $row['id']; echo "<br/>\n"; print("<P ALIGN=CENTER><strong>$from</strong><br>$message</P>"); if($_SESSION['username'] == $too) { print("<br><P ALIGN=RIGHT><a href='../main/DeleteComment.php?id=$comid'>Delete Comment</a></P>"); } } ?> <br> </div> </ItemPage> <div class="PostSep"><div class="PostSepS"></div></div> </div> </div> <!-- =================== Side L Column =================== --> <div id="SideLCol" class="SideBar"> <div class="SideBarInner"> <div class="Box"> <div class="Inner"> <div class="Title">Profile Image</div> <?php print ("<img src='../main/images/$photo' width='150'>"); ?> <br /> </div> <a href='../main/editprofile.php'>Edit Profile</a> | <a href='../main/profilephotoupload.php' class='lbOn'>Profile Photo</a> </div> <div class="Clearer"></div> </div> <div class="Clearer"></div> <div class="Clearer"></div> <div class="SideBarInner"> <div class="Box"> <div class="Inner"> <div class="Title">Contact <?php print $firstn ?></div> <a href="../messages/compose.php?username=<?php print $username ?>" class="lbOn">Send Message</a> || <a href="../friends/add.php?username=<?php print $username ?>">Add As Firend</a><br> <a href="../main/blockfriend.php?username=<?php print $username ?>">Block User</a> || <a href="../main/reportuser.php?username=<?php print $username ?>" class="lbOn">Report User</a> <br /> </div> </div> </div> </div> </div> <div id="ColClose"></div> <div id="CopyRight"> <br /> <br /> </div> </div> </center></body> </html> Where's <?php require("../db/friends.php"); ?> ?? <?php session_start(); require("../db/db.php"); //include database file require("../db/config.php"); //include configuration file require("../db/util.php"); require("../db/settings.php"); require("../db/friends.php"); isloggedin(); accessneeded("C"); ?> Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-756014 Share on other sites More sharing options...
gevans Posted February 6, 2009 Share Posted February 6, 2009 Haha, my bad... bare with me Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-756017 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 Haha, my bad... bare with me Lmao!, No probs mate your the one helping me lol Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-756020 Share on other sites More sharing options...
gevans Posted February 6, 2009 Share Posted February 6, 2009 Firstly, I know people have been pushing session_start() in your face, and it is important but you only need it one... <?php session_start(); require("../db/db.php"); //include database file require("../db/config.php"); //include configuration file require("../db/util.php"); require("../db/settings.php"); Is fine, you don't need to call it again in the uncluded files. Also this line... if($_SESSION['$Status'] == 'Pending') { Should be; if($_SESSION[$Status] == 'Pending') { Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-756026 Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Author Share Posted February 6, 2009 Firstly, I know people have been pushing session_start() in your face, and it is important but you only need it one... <?php session_start(); require("../db/db.php"); //include database file require("../db/config.php"); //include configuration file require("../db/util.php"); require("../db/settings.php"); Is fine, you don't need to call it again in the uncluded files. Also this line... if($_SESSION['$Status'] == 'Pending') { Should be; if($_SESSION[$Status] == 'Pending') { Ok, done!, still not doing nothing thoe <?php session_start(); require("../db/db.php"); //include database file require("../db/config.php"); //include configuration file require("../db/util.php"); require("../db/settings.php"); require("../db/friends.php"); isloggedin(); accessneeded("C"); ?> <?php $id = mysql_real_escape_string($_GET['id']); $username = mysql_real_escape_string($_GET['username']); $sql = "SELECT * FROM `users` WHERE `id`='$id' OR `username`='$username' LIMIT 1"; $query = mysql_query($sql); if(mysql_num_rows($query) > 0){ //display content while ($row = mysql_fetch_assoc($query)) { $id = $row['id']; $photo = $row['photo']; $gender = $row['gender']; $email = $row['email']; $firstn = $row['firstname']; $lastn = $row['lastname']; $dobd = $row['dobDay']; $dobm = $row['dobMonth']; $doby = $row['dobYear']; $username = $row['username']; $music = $row['music']; $movies = $row ['movies']; $scaredof = $row['scaredof']; $field1 = $row['field1']; $field2 = $row['field2']; $field3 = $row['field3']; $field4 = $row['field4']; $field5 = $row['field5']; $fieldb1 = $row['fieldb1']; $fieldb2 = $row['fieldb2']; $tagline = $row['tagline']; } }else{ header('Location: ../main/profileerror.php'); } ?> <html> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php print $title ?> - <?php print $firstn ?> <?php print $lastn ?>'s Profile</title> <!-- Insert your commenting javascript code here --> </head> <script type="text/javascript" src="../main/inc/ajax_framework.js"></script> <link rel="stylesheet" type="text/css" href="../main/inc/jqueryslidemenu.css" /> <!--[if lte IE 7]> <style type="text/css"> html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/ </style> <![endif]--> <script type="text/javascript" src="../main/inc/jquery.min.js"></script> <script type="text/javascript" src="../main/inc/jqueryslidemenu.js"></script> <style type="text/css" media="all"> body { margin: 0px; font-family: tahoma, sans-serif; padding-bottom: 20px; background: #FFFFFF; font-size: 12px; color: #333333;} #Granny { width: 900px; font-size: 0.88em; } a { text-decoration: none; color: #0000FF; } a img { border-width: 0px; } #HeaderCont { clear: both; width: 100%; margin-top: 30px; background: #CCC; border: 1px solid #333; } #HeaderInn { margin-bottom: 4px; padding: 5px 0px; text-align: left; font-family: Tahoma, sans-serif, sans-serif; } #HeaderTitle { font-size: 3em; color: #000000; padding: 0px 40px; direction: ltr; text-align: left; } .TitleItemLink { color: #000000; } #MainAndSides { clear: both; width: 100%; margin-top: 15px; } #MainCol { width: 73%; background: #F6F6F6; float: right; } #MainColInner { padding: 10px 20px; border: 1px solid #000000; } .OnePost { border: 1px solid #000000; font-family: Tahoma, sans-serif, sans-serif; direction: ltr; background: #EEE; } .OnePost .TopPost { border-bottom: 1px solid #666; padding: 0px 20px 3px 20px; background: #CCC; } .OnePost .MidPost { padding: 15px 25px; } .OnePost .BotPost { border-top: 1px solid #666; padding: 3px 20px; background: #CCC; } .OnePost .FullWidth { width: 100%; } .DateHeaderPost { font-size: 1em; color: #000000; padding-top: 3px; text-align: right; width: 48%; float: right; } .TitleHeaderPost { font-size: 1em; font-weight: bold; color: #000000; padding-top: 3px; text-align: left; direction: ltr; width: 48%; float: left; } .TitleHeaderPost a { color: #000000; } .PostTextBody { font-size: 1em; color: #000000; text-align: left; line-height: 150%; } .CmntFooterPost { visibility: visible; font-size: 1em; color: #333; width: 48%; float: right; text-align: right; } .CmntFooterPost a { color: #333; } .PermFooterPost { font-size: 1em; font-style: italic; color: #333; width: 48%; float: left; text-align: left; } .PermFooterPost a { color: #333; } .Clearer { clear: both; width: 100%; font-size: 0px; height: 0px; } .PostSep { height: 20px; font-size: 1px } .PostSepS { height: 10px; margin-bottom: 10px; border-bottom: 1px solid #000000; font-size: 1px } .SideBar { background: #999; } .SideBarInner { padding: 15px 15px; border: 1px solid #000000; } .SideBarInner img { margin-top: 2px; } #SideLCol { width: 25%; float: left; margin-right: 1.5%; } #SideLCol .Box { background: #CCC; border: 1px solid #666; font-family: Tahoma, sans-serif, sans-serif; } #SideLCol .Sep { height: 30px; } #SideLCol .SepS { height: 14.5px; margin-bottom: 14.5px; border-bottom: 1px solid #000000; font-size: 1px } #SideLCol .Title { font-size: 1em; color: #000000; font-weight: bold; border-bottom: 1px solid #333; margin-bottom: 3px; } #SideLCol .Inner { text-align: center; font-size: 1em; color: #333; padding: 5px 15px 8px 15px; line-height: 150%; } #commentInline { margin: 10px 20px; text-align: left; } .commentHead { margin: 0px 10px 20px 10px; padding-top: 5px; color: #333; } .comments-block { line-height: 150%; padding: 0px 30px; } .comment-poster { padding-bottom: 10px; } .comment-body { margin: 0px; padding-bottom: 10px; padding-left: 20px; } .innerCmntBody { margin: 5px 0px; } .comment-timestamp { margin: 5px 0px; padding: 0px 0px 8px 20px; color: #999; } .comment-timestamp a { color: #666; } .deleted-comment { font-style: italic; color: gray; } #ColClose { clear: both; width: 100%; font-size: 1px; height: 1px; margin-bottom: 20px; } #CopyRight { width: 60%; border-top: 1px solid gray; padding-top: 10px; line-height: 150%; } /* This template generated by PsycHo [http://psyc.horm.org] on 1/26/2009. */ </style> <div id="myslidemenu" class="jqueryslidemenu"> <!-- CSS --> <link rel="stylesheet" href="../template/lightbox.css" media="screen,projection" type="text/css" /> <!-- JavaScript --> <script type="text/javascript" src="../inc/gen/prototype.js"></script> <script type="text/javascript" src="../inc/gen/lightbox.js"></script> </head> <ul> <li><a href="../main/index.php">Home</a></li> <li><a href="../messages/inbox.php">Mail <?php $sql = mysql_query ("SELECT pm_count FROM users WHERE username = '{$_SESSION['username']}'"); $row = mysql_fetch_array ($sql); $pm_count = $row['pm_count']; ?>(<?php print "$pm_count" ?>)</a></li> <li><a href="#">Profile</a> <ul> <li><a href="">View Profile</a></li> <li><a href="../main/editprofile.php">Edit Profile</a></li> <li><a href="../main/profilephotoupload.php">Profile Photo</a></li> <li><a href="#">Privacy Settings</a></li> </ul> </li> <li><a href="#">Items</a></li> <li><a href="../friends/friends.php">Friends</a> <ul> <li><a href="#">Friend Requests</a></li> <li><a href="#">Invitation</a> </li> <li><a href="#">Invite Friends</a></li> </ul> </li> <li><a href="../login/logout.php">Sign Out</a></li> <li><?php print ("<img src='../main/images/$photo' width='28' height='30'>"); ?></li> </ul> <br style="clear: left" /> </div> <body><center> <div id="Granny"> <div id="HeaderCont"><div id="HeaderInn"> <div class="Clearer"></div> <div id="HeaderTitle"> <center><?php print $tagline ?><center> </div> <div class="Clearer"></div> </div></div> <div id="MainAndSides"> <!-- ==================== Main Column ==================== --> <div id="MainCol"> <div id="MainColInner"> <Blogger> <div class="OnePost"> <a name=""></a> <div class="TopPost"><div class="FullWidth"> <div class="DateHeaderPost"> </div> <div class="TitleHeaderPost"> Information: </div> <div class="Clearer"></div> </div></div> <div class="MidPost"><div class="FullWidth"> <div class="PostTextBody"> <?php print("<P ALIGN=CENTER><strong>$field1</strong><br>$music<br><strong>$field2</strong><br>$movies<br><strong>$field3</strong><br>$scaredof<br><strong>$field4</strong><br>$fieldb1<br><strong>$field5</strong><br>$fieldb2</p>"); ?> <?php if($_SESSION[$Status] == 'Pending') { print("Sorry!, No can do you are still pending to be friends with $username"); } ?> </div> </div></div> <div class="BotPost"><div class="FullWidth"> <div class="PermFooterPost"> <strong>Profile Comments:</strong> </div> <div class="CmntFooterPost"> <!-- Insert your external commenting service scripts here and remove the line below --> </div> <div class="Clearer"></div> </div></div> </div> <ItemPage> <div id="commentInline"> <div class="commentHead"></div> </span> <div id="insert_response" align=center></div> <P ALIGN=CENTER> <form action="javascript:insert()" method="post"> <input type="hidden" name="comto" value="<? echo $username ?>" id="comto"> <input type="hidden" name="comfrom" value="<? echo($_SESSION['username']); ?>" id="$comfrom"> Comment: <br><textarea name="commen" cols="45" rows="5" wrap="VIRTUAL" id="$commen"></textarea> <br> <input type="submit" name="submit" value="Send"> </form></P> <?php $sql = "SELECT * FROM `comments` WHERE comto = '$username'"; $query = mysql_query($sql); while ($row = mysql_fetch_assoc($query)) { $from = $row['comfrom']; $message = $row['commen']; $too = $row['comto']; $comid = $row['id']; echo "<br/>\n"; print("<P ALIGN=CENTER><strong>$from</strong><br>$message</P>"); if($_SESSION['username'] == $too) { print("<br><P ALIGN=RIGHT><a href='../main/DeleteComment.php?id=$comid'>Delete Comment</a></P>"); } } ?> <br> </div> </ItemPage> <div class="PostSep"><div class="PostSepS"></div></div> </div> </div> <!-- =================== Side L Column =================== --> <div id="SideLCol" class="SideBar"> <div class="SideBarInner"> <div class="Box"> <div class="Inner"> <div class="Title">Profile Image</div> <?php print ("<img src='../main/images/$photo' width='150'>"); ?> <br /> </div> <a href='../main/editprofile.php'>Edit Profile</a> | <a href='../main/profilephotoupload.php' class='lbOn'>Profile Photo</a> </div> <div class="Clearer"></div> </div> <div class="Clearer"></div> <div class="Clearer"></div> <div class="SideBarInner"> <div class="Box"> <div class="Inner"> <div class="Title">Contact <?php print $firstn ?></div> <a href="../messages/compose.php?username=<?php print $username ?>" class="lbOn">Send Message</a> || <a href="../friends/add.php?username=<?php print $username ?>">Add As Firend</a><br> <a href="../main/blockfriend.php?username=<?php print $username ?>">Block User</a> || <a href="../main/reportuser.php?username=<?php print $username ?>" class="lbOn">Report User</a> <br /> </div> </div> </div> </div> </div> <div id="ColClose"></div> <div id="CopyRight"> <br /> <br /> </div> </div> </center></body> </html> Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-756029 Share on other sites More sharing options...
gevans Posted February 6, 2009 Share Posted February 6, 2009 OK, lets see what you're actually getting; change friends.php to this; <?php $sql = "SELECT * FROM `friend` WHERE User_to = '{$_SESSION['username']}'"; $query = mysql_query($sql) or die (mysql_error()); while ($row = mysql_fetch_assoc($query)) { $User_to = $row['User_to']; $User_fr = $row['User_fr']; $Status = $row['Status']; } echo "SQL: $sql<br />"; echo "To: $User_to<br />"; echo "From: $User_fr<br />"; echo "Status: $Status<br />"; exit; ?> Link to comment https://forums.phpfreaks.com/topic/144071-solved-please-help-very-complicated-to-me/#findComment-756036 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.