Jump to content

I want to get the id_employee who is logged in


JoelWebsites

Recommended Posts

I have used the below code in cookie.php and it returns a blank page

please help!!!!!!!!!!!!!!

<?php
 
 
error_reporting(-1);
 
include_once(dirname(__FILE__).'/config/config.inc.php');
include_once(dirname(__FILE__).'/config/settings.inc.php');
include_once(dirname(__FILE__).'/classes/Cookie.php');
$cookie = new Cookie('psAdmin'); // Use "psAdmin" to read an employee's cookie.
 
$id123="hello world";
 
$this->context->cookie;
 
 
 
$id=$this->context->cookie->email;
 
 
 
echo $id;
 
 
 
 
 
?>
Link to comment
Share on other sites

<?php

error_reporting(-1);

 

global $cookie;

 

include_once(dirname(__FILE__).'/config/config.inc.php');

include_once(dirname(__FILE__).'/config/settings.inc.php');

include_once(dirname(__FILE__).'/classes/Cookie.php');

$cookie = new Cookie('psAdmin'); // Use "psAdmin" to read an employee's cookie.

 

 

 

class Cookie

{

 

function Displayemployeeid(){

 

 

 

$id123="hello world";

 

 

 

global $id;

 

$id = $this->context->cookie->id_employee;

 

 

 

echo $id;

echo $id123;

 

}

}

?>

 

 

<html>

<body>

<table width="200" border="1">

  <tr>

    <td> </td>

    <td> </td>

  </tr>

  <tr>

    <td> </td>

    <td><?php 

 

 

echo $id;hello

?></td>

  </tr>

</table>

 

 

 

 

 

 

</body>

 

</html>
Link to comment
Share on other sites

I am a very new prestashop developer and have basic php knowledge...so I dont know how to use auth controller...I wanted data about the employee.

 

 

As of now I am getting the below error

 PHP Fatal error:  Using $this when not in object context in /home/freeon/public_html/cookie.php on line 53

 

 

and below is line no 53

vvvvvvvvvvvvv

$id_employee = $this->context->employee->id;

Edited by joeljfernandes (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...