1
robotgod2000
php help in a block?

Hi,

I had a non-xoops php programmer put some extra code in /footer.php that contains a link to another, non-xoops web program, passing username and pwd. The link works great -- except that it is in the footer of my website! I'd like to move it to a block that I can control, but am having problems cutting and pasting the code into a new .php block. This is what was added to footer.php that I would like to get into the block:

le="color: #000000"><?php // above this line is the standard XOOPS footer.php // below is the new function and link added function Encrypt($string, $key="xxxxxx") { $result = ''; for($i=1; $i<=strlen($string); $i++) { $char = substr($string, $i-1, 1); $keychar = substr($key, ($i % strlen($key))-1, 1); $char = chr(ord($char)+ord($keychar)); $result.=$char; } return $result; } echo "<a href='/wp2/timesheet/index_user.php?login=".Encrypt($xoopsUser->getVar('uname'))."&password=".Encrypt($xoopsUser->getVar('pass'))."&ref=".Encrypt($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'])."'>Click To Go To Timesheet</a>"; ?>


Can someone give me a pointer or two how to make this code work in a block?
Thx!

2
ackbarr
Re: php help in a block?

Go to System -> Blocks and place the following code in the "Create a New Block" form:
le="color: #000000"><?php [color=008000][b]global $xoopsUser;[/b][/color] // below is the new function and link added function Encrypt($string, $key="xxxxxx") { $result = ''; for($i=1; $i<=strlen($string); $i++) { $char = substr($string, $i-1, 1); $keychar = substr($key, ($i % strlen($key))-1, 1); $char = chr(ord($char)+ord($keychar)); $result.=$char; } return $result; } echo "<a href='/wp2/timesheet/index_user.php?login=".Encrypt($xoopsUser->getVar('uname'))."&password=".Encrypt($xoopsUser->getVar('pass'))."&ref=".Encrypt($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'])."'>Click To Go To Timesheet</a>";


Don't forget to set the Content Type to PHP, and you should be all set.

3
robotgod2000
Re: php help in a block?

Thanks, ackbarr.

Yes, I am now set!

Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits