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

  • SEARCH
  • Home
  • 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 948231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:12:37+00:00 2026-05-15T23:12:37+00:00

i’m having a little problem. I’m working on a wordpress template which lists all

  • 0

i’m having a little problem.
I’m working on a wordpress template which lists all files on my ftp.
Therefore i ask for the the password and pass it straight along to the ftp_connect.

So the structure looks like this. I’m asking for the password, and if entered (and send) i’ll include a file called ftp_include.php which lists all my files. That’s working fine so far.

The only problem I have is that I reload/refresh this inlcude with Ajax (jQuery). However only the include. And everyime i refresh this include has to connect to the server again (with the password entered at the beginning).

A few guys already told me here that I need to work with SESSIONS in PHP, which store my password and inside my include i’m retrieving it again.

Somehow i can’t figure out why my SESSION cookie wont work.
I guess it’s getting stored properly with this:

session_start();

                session_start();
                if(!isset($_SESSION['ftp-password']) ) {
                    $_SESSION['ftp-password'] = $_POST['password'];
                }
                var_dump(ini_get_all('session')); //shows both times 
                //this result:http://cl.ly/1hzA -> 
                //so it seems it doesn't get stored properly, does it? 

i think so because i’m retrieving the password inside the include with this lines:

if(isset($_SESSION['ftp-password']) ) {
    $ftp_user_pass = $_SESSION['ftp-password'];
    echo "Password: " . $ftp_user_pass;
} else {
    print "can't find cookie!";
}

and it even CONNECTS to the server for the first time. However as soon as i refresh the include with Ajax somehoe it always says “can’t find cookie”. Any idea why that happens.
I even tried with set_cookie() but the same result.

thank you for your tips

  • 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-15T23:12:37+00:00Added an answer on May 15, 2026 at 11:12 pm

    It looks like WP does strange things with the sessions. Like it unsets them and/or overwrites them. Here is a page with some discussion on it, such as putting session_start() before get_header() (which was probably causing your headers already sent error).

    Why don’t you just store the password in a variable in php and pass that to jquery? E.g:

    <?php
       $ftp_pass = $_GET['ftp_pass'];//or however you get the password
    ?>
    
    <script>
    window.setInterval('yourfunction()', 1000);
    
    function yourfunction() { 
        alert('<?=$ftp_pass?>');//replace with your jQuery refresh code
    }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 476k
  • Answers 476k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Take a look at this post from Sacha Barber's website:… May 16, 2026 at 4:50 am
  • Editorial Team
    Editorial Team added an answer That architecture is fine, in fact it is the architecture… May 16, 2026 at 4:50 am
  • Editorial Team
    Editorial Team added an answer Change background color, and use opacity slider to make it… May 16, 2026 at 4:50 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.