Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

session_start();

Comments in 'Plugin Development' started by HotFireyDeath, Aug 9, 2015.

Thread Status:
Not open for further replies.
  1. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    Hi, I am trying to perform a session_start(); between two scripts:
    PHP:
    <php

    namespace Blah;

    use 
    pocketmine\plugin\PluginBase;

    class 
    Blah extends PluginBase{
        public function 
    onCommand(){
         
    // ignore the empty () in onCommand();
            
    session_start();
            include(
    'p.php');
            
    $_SESSION['vari'] = $sender;
                  
        }
    }
    And here is second script:
    PHP:
    <php 

    use pocketmine\plugin\PluginBase;

    session_start();
    $player $_SESSION['vari'];

    $player->sendMessage("phar");
    But for some reason, this occurs:
    Fatal error: Call to undefined function Plugin\session_start() in /Users/Hot/Desktop/Servers/Devel/plugins/Plugin/src/Plugin/Plugin.php on line 5

    And anyone help me with this issue, and perhaps a resolution? Thanks :)
  2. Artide
    Offline

    Artide Active Member

    Joined:
    Apr 20, 2015
    Posts:
    214
    Minecraft User:
    Artide5
    session_start(); goes at the top.
  3. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    @Artide I already tried that, right below namespace. Doesn't work.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    This is command line PHP... session_start is about webpage clients, so it won't work here.
  5. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
Thread Status:
Not open for further replies.

Share This Page

Advertisement