Skip to main content
Fixed up the code blocks
Source Link
John Conde
  • 220.4k
  • 100
  • 464
  • 504

Hi, I am trying to return a $user_id variable from file to if(isset(...)) statement. I will perform a different if statement but just trying to echo out the $user_id variable to test that I am setting the page.

Hi, I am trying to return a $user_id variable from file to if(isset(...)) statement. I will perform a different if statement but just trying to echo out the $user_id variable to test that I am setting the page.

I am trying to return a $user_id variable from file to if(isset(...)) statement. I will perform a different if statement but just trying to echo out the $user_id variable to test that I am setting the page.

Hi, I am trying to return a $user_id$user_id variable from file to if(isset....)if(isset(...)) statement. I will perform a different if statement but just trying to echoecho out the $user_id$user_id variable to test that I am setting the page.

<?php 
include 'core/init.php';
include 'init.image.php';
protect_page();
include 'includes/overall/overall_header.php';

if(isset($_GET['username']) === true && empty($_GET['username']) === false){
$username       = $_GET['username'];


if(user_exists($username) === true){
$user_id        = user_id_from_username($username);
$profile_data   = user_data($user_id, 'first_name','last_name','email', 'username');
?>
    
    <h1><?php echo $profile_data['first_name']; ?>'s Yor Page</h1>
    
<div id="navWrapper">
    <ul>
        <li>
            <a href="#"><img src="uploads/profile/blank_profile.gif" width="150" height="150" id="blank_profile"></a>
        </li>
        
        <nav>
            <ul>
                <li>
                    <a href="<?php echo $profile_data['username'];?>?action=albums">Albums</a>
                </li>
                <li>
                    <a href="<?php echo $profile_data['username'];?>?action=music">Music</a>
                </li>
            </ul>
        </nav>
    </ul>
</div>

<?php
if(isset($_GET['action']) && $_GET['action']=='albums'){

$albums = get_profile_albums($user_id);

if(empty($albums)){
echo 'No Albums';
}else{

foreach($albums as $album){
if (empty($album['image'])) {
    $album['image'] = 'uploads/profile/blank_profile.gif';
}
?>
 <p><?php echo $album['name'],' (', $album['count'], ')'?> <br />
  <a href="<?php echo $profile_data['username'];?>?action=album_id=<?php echo $album['id'];?>">
    <img src="uploads/thumbs/<?php echo $album['id'];?>/<?php echo $album['image'];?>" />
  </a><br />
  <?php echo $album['description'];?>...<br />
</p>
<?php
}
}

}
if(isset($_GET['action']) && $_GET['action']=='album_id=$album['id']$_GET['action']=='album_id=$album['id']'){
echo $user_id;
}



if(isset($_GET['action']) && $_GET['action']=='music'){
echo'<h1>Music</h1>';
}

}else{
    echo 'Sorry, that user doesn\'t exist';
}
}else{
header('Location: index.php');
exit();
}

include 'includes/overall/overall_footer.php';
?>

Hi I am trying to return a $user_id variable from file to if(isset....) statement. I will perform a different if statement but just trying to echo out the $user_id variable to test that I am setting the page.

<?php 
include 'core/init.php';
include 'init.image.php';
protect_page();
include 'includes/overall/overall_header.php';

if(isset($_GET['username']) === true && empty($_GET['username']) === false){
$username       = $_GET['username'];


if(user_exists($username) === true){
$user_id        = user_id_from_username($username);
$profile_data   = user_data($user_id, 'first_name','last_name','email', 'username');
?>
    
    <h1><?php echo $profile_data['first_name']; ?>'s Yor Page</h1>
    
<div id="navWrapper">
    <ul>
        <li>
            <a href="#"><img src="uploads/profile/blank_profile.gif" width="150" height="150" id="blank_profile"></a>
        </li>
        
        <nav>
            <ul>
                <li>
                    <a href="<?php echo $profile_data['username'];?>?action=albums">Albums</a>
                </li>
                <li>
                    <a href="<?php echo $profile_data['username'];?>?action=music">Music</a>
                </li>
            </ul>
        </nav>
    </ul>
</div>

<?php
if(isset($_GET['action']) && $_GET['action']=='albums'){

$albums = get_profile_albums($user_id);

if(empty($albums)){
echo 'No Albums';
}else{

foreach($albums as $album){
if (empty($album['image'])) {
    $album['image'] = 'uploads/profile/blank_profile.gif';
}
?>
 <p><?php echo $album['name'],' (', $album['count'], ')'?> <br />
  <a href="<?php echo $profile_data['username'];?>?action=album_id=<?php echo $album['id'];?>">
    <img src="uploads/thumbs/<?php echo $album['id'];?>/<?php echo $album['image'];?>" />
  </a><br />
  <?php echo $album['description'];?>...<br />
</p>
<?php
}
}

}
if(isset($_GET['action']) && $_GET['action']=='album_id=$album['id']){
echo $user_id;
}



if(isset($_GET['action']) && $_GET['action']=='music'){
echo'<h1>Music</h1>';
}

}else{
    echo 'Sorry, that user doesn\'t exist';
}
}else{
header('Location: index.php');
exit();
}

include 'includes/overall/overall_footer.php';
?>

Hi, I am trying to return a $user_id variable from file to if(isset(...)) statement. I will perform a different if statement but just trying to echo out the $user_id variable to test that I am setting the page.

<?php 
include 'core/init.php';
include 'init.image.php';
protect_page();
include 'includes/overall/overall_header.php';

if(isset($_GET['username']) === true && empty($_GET['username']) === false){
$username       = $_GET['username'];


if(user_exists($username) === true){
$user_id        = user_id_from_username($username);
$profile_data   = user_data($user_id, 'first_name','last_name','email', 'username');
?>
    
    <h1><?php echo $profile_data['first_name']; ?>'s Yor Page</h1>
    
<div id="navWrapper">
    <ul>
        <li>
            <a href="#"><img src="uploads/profile/blank_profile.gif" width="150" height="150" id="blank_profile"></a>
        </li>
        
        <nav>
            <ul>
                <li>
                    <a href="<?php echo $profile_data['username'];?>?action=albums">Albums</a>
                </li>
                <li>
                    <a href="<?php echo $profile_data['username'];?>?action=music">Music</a>
                </li>
            </ul>
        </nav>
    </ul>
</div>

<?php
if(isset($_GET['action']) && $_GET['action']=='albums'){

$albums = get_profile_albums($user_id);

if(empty($albums)){
echo 'No Albums';
}else{

foreach($albums as $album){
if (empty($album['image'])) {
    $album['image'] = 'uploads/profile/blank_profile.gif';
}
?>
 <p><?php echo $album['name'],' (', $album['count'], ')'?> <br />
  <a href="<?php echo $profile_data['username'];?>?action=album_id=<?php echo $album['id'];?>">
    <img src="uploads/thumbs/<?php echo $album['id'];?>/<?php echo $album['image'];?>" />
  </a><br />
  <?php echo $album['description'];?>...<br />
</p>
<?php
}
}

}
if(isset($_GET['action']) && $_GET['action']=='album_id=$album['id']'){
echo $user_id;
}



if(isset($_GET['action']) && $_GET['action']=='music'){
echo'<h1>Music</h1>';
}

}else{
    echo 'Sorry, that user doesn\'t exist';
}
}else{
header('Location: index.php');
exit();
}

include 'includes/overall/overall_footer.php';
?>
added 2 characters in body
Source Link
Aaron Warnke
  • 313
  • 1
  • 8
  • 14
<?php 
include 'core/init.php';
include 'init.image.php';
protect_page();
include 'includes/overall/overall_header.php';

if(isset($_GET['username']) === true && empty($_GET['username']) === false){
$username       = $_GET['username'];


if(user_exists($username) === true){
$user_id        = user_id_from_username($username);
$profile_data   = user_data($user_id, 'first_name','last_name','email', 'username');
?>
    
    <h1><?php echo $profile_data['first_name']; ?>'s Yor Page</h1>
    
<div id="navWrapper">
    <ul>
        <li>
            <a href="#"><img src="uploads/profile/blank_profile.gif" width="150" height="150" id="blank_profile"></a>
        </li>
        
        <nav>
            <ul>
                <li>
                    <a href="<?php echo $profile_data['username'];?>?action=albums">Albums</a>
                </li>
                <li>
                    <a href="<?php echo $profile_data['username'];?>?action=music">Music</a>
                </li>
            </ul>
        </nav>
    </ul>
</div>

<?php
if(isset($_GET['action']) && $_GET['action']=='albums'){

$albums = get_profile_albums($user_id);

if(empty($albums)){
echo 'No Albums';
}else{

foreach($albums as $album){
if (empty($album['image'])) {
    $album['image'] = 'uploads/profile/blank_profile.gif';
}
?>
 <p><?php echo $album['name'],' (', $album['count'], ')'?> <br />
  <a href="<?php echo $profile_data['username'];?>?action=album_id=<?php echo $album['id'];?>">
    <img src="uploads/thumbs/<?php echo $album['id'];?>/<?php echo $album['image'];?>" />
  </a><br />
  <?php echo $album['description'];?>...<br />
</p>
<?php
}
}

}
if(isset($_GET['action']) && $_GET['action']=='album_id=$album_id'$_GET['action']=='album_id=$album['id']){
echo $user_id;
}



if(isset($_GET['action']) && $_GET['action']=='music'){
echo'<h1>Music</h1>';
}

}else{
    echo 'Sorry, that user doesn\'t exist';
}
}else{
header('Location: index.php');
exit();
}

include 'includes/overall/overall_footer.php';
?>
<?php 
include 'core/init.php';
include 'init.image.php';
protect_page();
include 'includes/overall/overall_header.php';

if(isset($_GET['username']) === true && empty($_GET['username']) === false){
$username       = $_GET['username'];


if(user_exists($username) === true){
$user_id        = user_id_from_username($username);
$profile_data   = user_data($user_id, 'first_name','last_name','email', 'username');
?>
    
    <h1><?php echo $profile_data['first_name']; ?>'s Yor Page</h1>
    
<div id="navWrapper">
    <ul>
        <li>
            <a href="#"><img src="uploads/profile/blank_profile.gif" width="150" height="150" id="blank_profile"></a>
        </li>
        
        <nav>
            <ul>
                <li>
                    <a href="<?php echo $profile_data['username'];?>?action=albums">Albums</a>
                </li>
                <li>
                    <a href="<?php echo $profile_data['username'];?>?action=music">Music</a>
                </li>
            </ul>
        </nav>
    </ul>
</div>

<?php
if(isset($_GET['action']) && $_GET['action']=='albums'){

$albums = get_profile_albums($user_id);

if(empty($albums)){
echo 'No Albums';
}else{

foreach($albums as $album){
if (empty($album['image'])) {
    $album['image'] = 'uploads/profile/blank_profile.gif';
}
?>
 <p><?php echo $album['name'],' (', $album['count'], ')'?> <br />
  <a href="<?php echo $profile_data['username'];?>?action=album_id=<?php echo $album['id'];?>">
    <img src="uploads/thumbs/<?php echo $album['id'];?>/<?php echo $album['image'];?>" />
  </a><br />
  <?php echo $album['description'];?>...<br />
</p>
<?php
}
}

}
if(isset($_GET['action']) && $_GET['action']=='album_id=$album_id'){
echo $user_id;
}



if(isset($_GET['action']) && $_GET['action']=='music'){
echo'<h1>Music</h1>';
}

}else{
    echo 'Sorry, that user doesn\'t exist';
}
}else{
header('Location: index.php');
exit();
}

include 'includes/overall/overall_footer.php';
?>
<?php 
include 'core/init.php';
include 'init.image.php';
protect_page();
include 'includes/overall/overall_header.php';

if(isset($_GET['username']) === true && empty($_GET['username']) === false){
$username       = $_GET['username'];


if(user_exists($username) === true){
$user_id        = user_id_from_username($username);
$profile_data   = user_data($user_id, 'first_name','last_name','email', 'username');
?>
    
    <h1><?php echo $profile_data['first_name']; ?>'s Yor Page</h1>
    
<div id="navWrapper">
    <ul>
        <li>
            <a href="#"><img src="uploads/profile/blank_profile.gif" width="150" height="150" id="blank_profile"></a>
        </li>
        
        <nav>
            <ul>
                <li>
                    <a href="<?php echo $profile_data['username'];?>?action=albums">Albums</a>
                </li>
                <li>
                    <a href="<?php echo $profile_data['username'];?>?action=music">Music</a>
                </li>
            </ul>
        </nav>
    </ul>
</div>

<?php
if(isset($_GET['action']) && $_GET['action']=='albums'){

$albums = get_profile_albums($user_id);

if(empty($albums)){
echo 'No Albums';
}else{

foreach($albums as $album){
if (empty($album['image'])) {
    $album['image'] = 'uploads/profile/blank_profile.gif';
}
?>
 <p><?php echo $album['name'],' (', $album['count'], ')'?> <br />
  <a href="<?php echo $profile_data['username'];?>?action=album_id=<?php echo $album['id'];?>">
    <img src="uploads/thumbs/<?php echo $album['id'];?>/<?php echo $album['image'];?>" />
  </a><br />
  <?php echo $album['description'];?>...<br />
</p>
<?php
}
}

}
if(isset($_GET['action']) && $_GET['action']=='album_id=$album['id']){
echo $user_id;
}



if(isset($_GET['action']) && $_GET['action']=='music'){
echo'<h1>Music</h1>';
}

}else{
    echo 'Sorry, that user doesn\'t exist';
}
}else{
header('Location: index.php');
exit();
}

include 'includes/overall/overall_footer.php';
?>
Source Link
Aaron Warnke
  • 313
  • 1
  • 8
  • 14
Loading