The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Undefined index error
masonh928
post Nov 17 2015, 04:31 PM
Post #1


Serious Coder
*****

Group: Members
Posts: 253
Joined: 17-August 13
From: Indiana
Member No.: 19,570



$isFriend returns null, so there is no index for NULL value, so why is does it return NULL?

Profile:

CODE


<?php

session_start();

if(!$_SESSION['Logged_in']){

die("<b><u>You must be logged in to view this profile. Click <a href='/Login'>here</a> to Login, or  <a href='/Register'>here&nbsp;</a>to be registered for free!</u></b>");

};

require_once("./Scripts/PHP/Class/Profile.class.php");
require_once("./Scripts/PHP/Class/Board.class.php");
require_once("./Scripts/PHP/Library.php");
require_once("./Scripts/PHP/UserFunctions.php");

$ProfileID = $_GET['ID'];

$Profile = new Profile($ProfileID);

try{

$FullName = $Profile->getUserData("FullName");
$About = $Profile->getUserData("About");
$Age = $Profile->getUserData("Age");
$Religion = $Profile->getUserData("Religion");
$About = $FullName = $Profile->getUserData("About");
$SexualOrientation = $FullName = $Profile->getUserData("SexualOrientation");
$PoliticalParty = $FullName = $Profile->getUserData("PoliticalParty");
$PoliticalIdeology = $FullName = $Profile->getUserData("PoliticalIdeology");
$Phone = $FullName = $Profile->getUserData("Phone");
$Email = $FullName = $Profile->getUserData("Email");
$Fax = $FullName = $Profile->getUserData("Fax");
$Country = $FullName = $Profile->getUserData("Country");
$Education = $FullName = $Profile->getUserData("Education");
$Career = $FullName = $Profile->getUserData("Career");
$Ethnicity = $FullName = $Profile->getUserData("Ethnicity");
$Website = $FullName = $Profile->getUserData("Website");
$Personality = $FullName = $Profile->getUserData("Personality");
$Weight = $FullName = $Profile->getUserData("Weight");
$Height = $FullName = $Profile->getUserData("Height");
$Languages = $FullName = $Profile->getUserData("Languages");
$DateJoined = $FullName = AgeDate($Profile->getUserData("DateJoined"));
$ProfilePicture = $FullName = $Profile->getUserData("ProfilePicture");
$Status = $FullName = $Profile->getUserData("Status");
$Username = $FullName = $Profile->getUserData("Username");
$PID = $Profile->getUserData("PID");
$Filter = ($Profile->getUserData("CurseFilter") == 0) ? false : true;

}catch(exception $Error){

echo("<h1>"  . $Error->getMessage() . "</h1>");

}

$isOwner = (strcasecmp($_SESSION['Logged_in'], $Username) == 0) ? true : false;

try{

$IsFriend = isFriend($_SESSION['ID'], $ProfileID);

}catch(exception $E){

echo("Error: " . $E->getMessage());

$isFriend = 100;

}

global $isFriend;

$FriendAction = [
0 => "Add Friend",
1 => "Request Pending",
2 => "Friends <b>✔</b>",
100 => "Error: Contact Support"
];
?>

<div class="container">
<h1 class="Title"><?php echo($Profile->getUserData("FullName")); ?></h1>
<br>
<form enctype="multipart/form-data" method="post" action="/Upload">
<div class="img-upload">
<label for="file">
<img src="http://www.social-board.xyz/Community/Avatars/<?php echo($ProfilePicture) ?>" width="450px" height="500px" title="Update Profile Photo" style="margin-bottom: 20px;float:left;">
</label>
<input type="hidden" name="ID" value="<?php echo($_GET['ID']); ?>">
<input type="file" name="Avatar" id="file" onchange="this.form.submit()">
</div>
</form>

<p><u><b>Status:</b></u><?php echo(convertHashtags($Status)); ?> <br>
<?php
if(!$isOwner){

if($IsFriend == 0){

echo("<button class='btn btn-success'><a href='Action?do=Friend&ID=" . $_GET['ID'] ."'><u>{$FriendAction[$isFriend]}</u></a></button>");

}else {

echo("<button class='btn btn-success'><a><u>{$FriendAction[$isFriend]}</u></a></button>");

}

$Update = "";

}else{

$Update = <<<Btn
<button id="Update" class="btn btn-success">Update Profile</button>
Btn;

//die(var_dump($isOwner));

}
?>
</p>
<section id="Information">
<h2 class="Title2">Basic Info</h2>
<p><u><b>Age: </b></u><?php echo($Age); ?></p>
<p><u><b>Country: </b></u><?php echo($Country); ?></p>
<p><u><b>Language(s): </b></u><?php echo($Languages); ?></p>
<p><u><b>Education: </b></u><?php echo($Education); ?></p>
<p><u><b>Date Joined: </b></u><?php echo($DateJoined); ?></p>
<p><u><b>About: </b></u><br><?php echo(convertHashtags($About)); ?></p>
<?php
if(empty($_GET['Page'])){
echo <<<this
      <div id="slideshow">
            <div class="slides">
                <ul>
                    <li id="Personal">
                        <h2 class="Title2">Personal Information</h2>
                         <ol id="Number">
            <li><u><b>Personality Type:</b></u> {$Personality} </li>
            <li><u><b>Religion: </b></u>{$Religion}</li>
            <li><u><b>Politcal Ideology: </b></u>{$PoliticalIdeology}</li>
            <li><u><b>Political Party: </b></u>{$PoliticalParty}</li>
            <li><u><b>Ethnicity: </b></u>{$Ethnicity}</li>
                        </ol>
                    </li>
                    <li id="Contact">
                        <h2 class="Title2">Contact Information</h2>
                        <ol id="Number">
            <li><u><b>Phone: </b></u>{$Phone}</li>
            <li><u><b>Email: </b></u>{$Email}</li>
            <li><u><b>Fax: </b></u>{$Fax}</li>
            <li><u><b>Address: </b></u></li>
            <li><u><b>ZIP: </b></u></li>
                        </ol>
                    </li>  
                    <li id="Physical">
                        <h2 class="Title2">Physical Description</h2>
                            <ol id="Number">
            <li><u><b>Height: </b></u>{$Height}</li>
            <li><u><b>Weight: </b></u>{$Weight}</li>
            <li><u><b>Ethnicity: </b></u>{$Ethnicity}</li>
            <li><u><b>Hair Color: </b></u></li>
            <li><u><b>Shoe Size: </b></u></li>
                        </ol>
                    </li>                
                </ul>
            </div>
            <ul class="slides-nav">
                <li><a href="#Personal">Personal</a></li>
                <li><a href="#Contact">Contact</a></li>
                <li><a href="#Physical">Physical</a></li>
                <li><a href="#Update">{$Update}</a></li>
        <li><a href="Profile?ID={$ProfileID}&Page=Photo&PID={$PID}#Photos">Photos/Files</a></li>
            </ul>
       </div>
this;
}else{

if($_SESSION['ID'] == $ProfileID){
echo <<<This
<script>
$("#file").change(function(){

$("#FileForm").submit();

});
</script>
<form enctype="multipart/form-data" method="post" action="/FUpload?ID={$_GET['ID']}" id="FileForm">
<div class="img-upload">
<label for="file">
<img src="https://d2gg9evh47fn9z.cloudfront.net/thumb_COLOURBOX10413282.jpg" width="50" height="50">
</label>
<input type="hidden" name="PID" value="{$_GET['PID']}">
<input type="file" name="FileUP" id="file">
</div>
</form>
This;
}

echo "<a id='#Photos'></a>";
include("SlideShow/PhotoDisplay.php");
}
?>
      <hr>
</section>
<section id="Board">
<h2 class="Title"><?php echo $FullName; ?>'s Board of Posts</h3><br>
<form action="/Action?do=Post&ID=<?php echo($_GET['ID']); ?>" method="Post">
<textarea cols="100" rows="10" class="Post" name="Post"></textarea>
<input type="hidden" name="Username" value="<?php echo($Username); ?>">
<input type="file">
<br>
<input type="Submit" value="Post to Board &gg;" class="btn btn-success">
</form>
<?php
$Board = new Board(htmlentities($_GET['ID']), $Filter);
$Board->DisplayPosts($_GET['ID']);
?>
</section>
      <footer>
       <?php include("./INC/footer.php"); ?>
      </footer>
    </div> <!-- /container -->


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="../../dist/js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>    



UserFunctions.php

CODE


<?php

error_reporting(E_ALL | E_STRICT);

require_once($_SERVER['DOCUMENT_ROOT'] . "/Scripts/PHP/DB.inc.php");

$Connect = ConnectDB();

function isFriend($User1, $User2){

//0 = Not Friends
//1 = Pending
//2 = Friends

$ReturnVal = 0; // Default is Not Friends

$Query = $GLOBALS['Connect']->prepare("SELECT * FROM Friends WHERE Friend1 = :F1 AND Friend2 = :F2 OR Friend1 = :F1 AND Friend2 = :F2");
$Query->bindValue(":F1", $User1);
$Query->bindValue(":F2", $User2);

if(!$Query->execute()){

$ReturnVal = 0;

}

$Rows = $Query->fetchAll();

foreach($Rows as $Results){

if($Results['Accepted'] == 0){

$ReturnVal = 1;

}elseif($Results['Accepted'] == 1){

$ReturnVal = 2;

}else{

throw new exception("NOT Friend, Not Pending");
exit();
}

}

return $ReturnVal;
}



Please Help thanks!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
masonh928
post Nov 17 2015, 04:32 PM
Post #2


Serious Coder
*****

Group: Members
Posts: 253
Joined: 17-August 13
From: Indiana
Member No.: 19,570



I think I know capital 'I'! lol
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
masonh928
post Nov 17 2015, 04:50 PM
Post #3


Serious Coder
*****

Group: Members
Posts: 253
Joined: 17-August 13
From: Indiana
Member No.: 19,570



nvm
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 20th January 2020 - 10:51 PM