WordPress.org

Ready to get started?Download WordPress

Forums

PHP: using SESSIONS inside of page template? (2 posts)

  1. sepp88
    Member
    Posted 3 years ago #

    hey guys,
    i really need your help. I'm currently trying to build a page_template which lists my FTP contents. So it shows a login first (only password) which if sent includes another file called ftp_include.php. The password gets deliverd straight into an ftp_connect without getting stored in a variable. however i'm reloading this include with ajax and i want to store the password in a session so the include can retrieve it again.

    However if i call a session_start() inside the include php tells me that: CANNOT SEND SESSION COOKIE - headers already sent by … wp-content/themes/mytheme/ftp_include.php on line 4.

    on line 4 i have session_start(). my ftp_include starts with the following lines:

    <div id="server_view">
    	<div id="inside">
    	<?php
    	session_start();

    any ideas?

  2. digitalmagicianz
    Member
    Posted 3 years ago #

    use session_start at the top of the page

    for example

    <?php
    session_start();
    /*
    Template Name: Page
    */
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.