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:

// 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-11);
        
$keychar substr($key, ($i strlen($key))-11);
        
$char chr(ord($char)+ord($keychar));
        
$result.=$char;
    }
    return 
$result;
}
echo 
".Encrypt($xoopsUser->getVar('uname'))."&password=".Encrypt($xoopsUser->getVar('pass'))."&ref=".Encrypt($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'])."'>Click To Go To Timesheet";
?>


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:
[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-11);
        
$keychar substr($key, ($i strlen($key))-11);
        
$char chr(ord($char)+ord($keychar));
        
$result.=$char;
    }
    return 
$result;
}
echo 
".Encrypt($xoopsUser->getVar('uname'))."&password=".Encrypt($xoopsUser->getVar('pass'))."&ref=".Encrypt($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'])."'>Click To Go To Timesheet";


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

Who's Online

370 user(s) are online (324 user(s) are browsing Support Forums)


Members: 0


Guests: 370


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits