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
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;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.