Help with a custom module for phpnuke

Status
Not open for further replies.

kacete

New Member
Messages
5
Reaction score
0
Points
0
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.

PHP:
    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");
    }

Thank you ;)
 

xmakina

New Member
Messages
264
Reaction score
0
Points
0
Er... you remembered to check for the OP value and then call the SaveEditSpecial function, right?
 

kacete

New Member
Messages
5
Reaction score
0
Points
0
Yes, at the end of the file:

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

And again in the case.php file:

PHP:
switch($op) {

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

}

:dunno:
Edit:
Just to say that the problem was solved :biggrin:
 
Last edited:

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
Thread Moved to Scripts & 3rd Party Apps
Since it seems your problem has been fixed, I am closing the thread. :)
Thread Closed
 
Status
Not open for further replies.
Top