Fork me on GitHub

Need help with Module broken by 75  Bottom

  • I really want to update my intranet site to 75 and have everything moved but this one little module won't work in 75.
    The module was borged from a weather module, and all it does is pass the username and a password to another proxied server to call up an ASP app in new window. The ASP app accepts a generic password and takes the username to open up a time and expense reporting tool.

    I'm not a genius at coding but it is clear that something has changed in the PN code to no longer accept the code I was using.
    So here is what I had in my index.php of my module called portal:

    Code

    $module_name = "portal";
    if (!eregi("modules.php", $PHP_SELF))
    {
        die ("You can't access this file directly...");
    }
    if(!isset($pnwconfig)) { include("modules/$module_name/config.php"); }
    if(!isset($pnwfunctions)) { include("modules/$module_name/functions.php"); }
    $index = 0;

    function PortalIndex($wusedefault = false)
    {
        global $user, $cookie, $module_name, $gifdir;
        include("header.php");
        cookiedecode($user);
        $username = $cookie[1];
        if (isset($username))  
            {
        $ip_address = "10.0.0.16";
        $ip_port = 80;
        $passcode = "password";
        OpenTable();   
            $fa = fsockopen($ip_address, $ip_port, $num_error, $str_error, 30);
        if(!$fa)    {
            echo "<h4><b>$module_name</b></h4>\n"
            ._UNAVAIL.": $str_error ($num_error)\n";
        }  else    {
            fputs($fa,"GET /timeexpense/first.cfm?username=$username&id=$passcode HTTP/1.0\n\n");
            $answer=fgets($fa,128);
            $buffer = "";
            $grabline = "";
            while (!feof($fa))
          {
            $grabline = fgets($fa, 4096);
                $buffer = $buffer . $grabline;
          }
            fclose($fa);
            echo stristr ($buffer,"<script");   
            }
        }
        CloseTable();
        include ("footer.php");
    }
    switch($func) {

        case "usedefault":
        PortalIndex(true);
        break;

        default:


    I'm not sure I even know what all that does but it did work. I've tried reading the documentation for building modules but I need human intervention.
    Can any of you coders take a look and tell me what I need to change to fix this little guy?
  • Thanks in advance for any help!

This list is based on users active over the last 60 minutes.