Jump to content

Function similar to eval() neded i think


ratcateme

Recommended Posts

Hi i have a file with html code in it like

<table width="200" border="0" class="a">
  <tr>
    <td colspan="2">Welcome $_SESSION['name']</td>
  </tr>
  <tr>
    <td colspan="2"><a href="?page=usercp">User panel </a> | <a href="javascript:void(0)" onclick="xajax_logout()">Logout</a></td>
  </tr>
  <tr>
    <td>Last login:</td>
<td>$last</td>
  </tr>
</table>

i have a function to open into php as one string and i want to use a function like eval that will get $_SESSION['name'] and $last i thought i could use

$str=importfile('pages/logedin.inc');
eval("\$str = \"$str\";");

now i know it is not my importfile script i can echo $str fine but it displays as $_SESSION['name'] not a user real name and i need a function to get the real name and lastlogin

 

can you please help

 

Thanks Scott.

 

Link to comment
https://forums.phpfreaks.com/topic/78596-function-similar-to-eval-neded-i-think/
Share on other sites

why don't you use INCLUDE?

Include will process vars.

you can always wrap the include in output buffering so that get the content into var for display later

 

ob_start();

include_once('pages/logedin.inc')

$out1 = ob_get_contents();

ob_end_clean();

 

echo $out1;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.