Jump to content

[SOLVED] Help with a custom module for phpnuke


brianmay

Recommended Posts

Hello guys, I could use another eyes on this code, i'm trying to make an admin for a custom module. The module and everything works except the admin part to edit an already existing article. It does get the values from the database and displays them on the boxes, but after modifying and clicking Edit to submit the form it doesn't make any changes.

 

    function EditSpecial($sid) {
        global $prefix, $db, $admin_file;
        include("header.php");
        GraphicAdmin();
        title(""._SPECIALSMANAGER."");
        OpenTable();
        $sid = intval($sid);
        $result = $db->sql_query("SELECT * FROM ".$prefix."_specials WHERE sid='$sid'");
        $ency = $db->sql_fetchrow($result);
        $ency['stitle'] = filter($ency['stitle'], "nohtml");
        $ency['simg'] = filter($ency['simg'], "nohtml");
        $ency['sband'] = filter($ency['sband']);
        $ency['stxt'] = filter($ency['stxt']);
        echo "<center><b>"._SPECIALSEDIT."</b></center><br><br>"
        ."<form action=\"".$admin_file.".php\" method=\"post\">"
        ."<b>"._SPECIALSTITLE.":</b><br>"
        ."<input type=\"text\" name=\"stitle\" size=\"50\" maxlength=\"255\" value=\"$ency[stitle]\"><br><br>"
        ."<b>"._SPECIALSIMAGE.":</b><br>Located in images/specials/.<br>"
        ."<input type=\"text\" name=\"simg\" size=\"50\" maxlength=\"255\" value=\"$ency[simg]\"><br><br>"
        ."<b>"._SPECIALSBANDS.":</b><br>"
        ."<textarea name=\"sband\" cols=\"100\" rows=\"10\">$ency[sband]</textarea><br><br>"
        ."<b>"._SPECIALSTEXT.":</b><br>"
        ."<textarea name=\"stxt\" cols=\"100\" rows=\"20\">$ency[stxt]</textarea><br><br>"
        ."<input type=\"hidden\" name=\"op\" value=\"SaveEditSpecial\">"
        ."<input type=\"hidden\" name=\"sid\" value=\"$sid\">"
        ."<input type=\"submit\" value=\""._EDIT."\">"
        ."</form>";
        CloseTable();
        include("footer.php");
    }

    function SaveEditSpecial($sid, $stitle, $simg, $sband, $stxt) {
        global $prefix, $db, $admin_file;
        $sid = intval($sid);
        $db->sql_query("UPDATE ".$prefix."_specials SET stitle='$stitle' simg='$simg' sband='$sband' stxt='$stxt' WHERE sid='$sid'");
        Header("Location: ".$admin_file.".php?op=SpecialsList");
    }

 

At the end of the file:

 

    switch($op) {
               
        case "EditSpecial":
        EditSpecial($sid);
        break;
               
        case "SaveEditSpecial":
        SaveEditSpecial($sid, $stitle, $simg, $sband, $stxt);
        break;
        
    }

 

And again in the case.php file:

 

switch($op) {

    case "EditSpecial":
    case "SaveEditSpecial";
        
    include("modules/$module_name/admin/index.php");
    break;

}

 

Thank you ???

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.