Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6797015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:33:25+00:00 2026-05-26T18:33:25+00:00

I am having some issues with my code, and keep getting the same error,

  • 0

I am having some issues with my code, and keep getting the same error, i have checked to make sure i have no open brackets or not forgotten to close a line.

The code below is only part of my whole code, this is lines 79-191 error is on line 109.

if(isset($id) && isset($_SESSION['user_current'])){

    switch($option) {               
        case 1:
            $query = mysql_query("SELECT * FROM `ebcs_albums` WHERE `id` = '{$_SESSION[user_current][2]}'");
            $result = mysql_fetch_assoc($query);
            $img_ext = array('.jpeg','.jpg','.png','.gif'); 
            function getImages($dir) {
                global $img_path, $img_ext;
                $d = dir($img_path.$dir);  
                while (false !== ($file = $d->read())) {
                    $file_basename = substr($file, 0, strripos($file, '.'));
                    $file_basename = rename($file_basename,strtolower(preg_replace('/[^A-Za-z0-9_-]+/', '-', $file_basename)));
                    $file_ext = substr($file, strripos($file, '.'));
                    $file_ext = rename(strtolower($file_ext));
                    $file = $file_basename.$file_ext;
                    if(in_array($file_ext,$img_ext)) {
                        $images[] = array('file' => $file,'size' => getimagesize($file));
                    }
                }
                $d->close();
                asort($images);         
                return $images;
            }

            $array = getImages($result['Albums_Folder']);
            foreach ($array as $img) {
                mysql_query("INSERT INTO `ebcs_albums_temp` (`id`,`User`,`Image_Name`,`Image_Width`,`Image_Height`) 
                VALUES ('','$user','{$img[file]}','{$img[size][0]}','{$img[size][1]}')");
            }
            goto case 3;
            break;

        case 2:     
            $query = mysql_query("SELECT * FROM `ebcs_albums_temp` WHERE `User` = '{$_SESSION[user_current][0]}'");
            $array = mysql_fetch_array($query);
            foreach ($array as $remove) {
                mysql_query("DELETE FROM `ebcs_albums_temp` WHERE `id` = '{$remove[id]}'");
            }       
            mysql_query("DELETE FROM `ebcs_albums_users` WHERE `IP` = '{$_SESSION[user_current][0]}'");
            $id = $_SESSION['user_current'][2];
            unset($_SESSION['user_current']);   

            $query = mysql_query("SELECT * FROM `ebcs_albums_users` WHERE `Time` > '$inactive'");
            $array = mysql_fetch_array($query);
            foreach ($array as $remove) {
                $last = next($array)===false;
                mysql_query("DELETE FROM `ebcs_albums_users` WHERE `id` = '{$remove[id]}'");
                if(!$last){
                mysql_query("DELETE FROM `ebcs_albums_temp` WHERE `User` = '{$remove[IP]}'");
                }
            }               
            $_SESSION['error'] = 'You have be logged out.';
            echo '<meta http-equiv="refresh" content="0;URL=album.php?id=$id">';
            break;

        case 3:     
            $query = mysql_query("SELECT DISTINCT User FROM `ebcs_albums_temp`");
            $array = mysql_fetch_array($query);
            if(in_array($_SESSION['user_current'][0],$array)) {

                    $query = mysql_query("SELECT Time FROM `ebcs_albums_users` WHERE `User` = '{$_SESSION[user_current][0]}'"); 
                    $mysql_time = mysql_fetch_assoc($query);    

                    $session_life = time() - $_SESSION['user_current'][1];
                    $mysql_life = time() - $mysql_time['Time'];

                    if(($session_life > $inactive) || ($mysql_life > $inactive)){
                        goto case 2;    
                        break;
                    }

                    SmartyPaginate::connect();
                    SmartyPaginate::setLimit(24);
                    $query = sprintf("SELECT SQL_CALC_FOUND_ROWS * FROM `ebcs_albums_temp` WHERE `User` = '$user' ORDER BY `id` LIMIT %d,%d", SmartyPaginate::getCurrentIndex(), SmartyPaginate::getLimit());
                    $results = mysql_query($query);                         
                        while($x = mysql_fetch_assoc($results)) {
                            $images[] = array('file' => $x['Image_Name'],'width' => $x['Image_Width'],'height' => $x['Image_Height']);
                        }
                    $query = "SELECT FOUND_ROWS() as total";
                    $_results = mysql_query($query);
                    $_row = mysql_fetch_assoc($_results);   
                    SmartyPaginate::setTotal($_row['total']);

                    SmartyPaginate::assign($smarty);    

                    $albums = mysql_query("SELECT * FROM `ebcs_albums` WHERE `id` = '{$_SESSION[user_current][2]}'");
                    $albums_arr = array();
                        while($x = mysql_fetch_assoc($albums)) {
                            $albums_arr[] = $x;
                        }

                    $smarty->assign('id',$id);
                    $smarty->assign('images',$images);
                    $smarty->assign('albums_arr',$albums_arr);

                    include ("_header.php");    
                    $smarty->display('album_images.tpl');
                    include ("_footer.php");                
                    break;

            } else {
                goto case 1;    
                break;
            }
        default:    
            break;
    }
} else {                        
    $_SESSION['error'] = 'You are not logged in.';
    echo '<meta http-equiv="refresh" content="0;URL=album.php?id=$id">';
}   

Line 109 = goto case 3;
Line 110 = break;

Thanks for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:33:25+00:00Added an answer on May 26, 2026 at 6:33 pm

    Goto is used within loops, not within cases/switches. You should use functions for this.

    case 3:
       do_function_3();
       break;
    
    function do_function_3(){
        // put the code here
    }
    

    Goto docs: http://www.php.net/manual/en/control-structures.goto.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some issues with my code. This is probably due to some design
I'm having some issues with some jQuery code, and I'm hoping and thinking that
I am having some issues with logging. After reviewing JBoss Seam source code, I
I'm having an issue getting some code to work. Is there a way to
Having some issues getting my head around the differences between UTF-8, UTF-16, ASCII and
I have been having some issues with LINQ-To-SQL around memory usage. I'm using it
I keep on having these same two problems. I have been trying to use
LIVE CODE: http://jsfiddle.net/vy4nY/ I'm following this challenge , but I'm having some issues. I'm
I'm having some issues right now with some weird behaviour of my code and
ok, im having some syntax issues that keep evading me. :( one is at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.