PDA

View Full Version : Can someone tell me how come this dosent work?



XjSv
12-10-2009, 06:32 PM
/* To-Do-List plugin */
$r = sed_import('r','G','ALP');
$g = array ('a');
foreach($g as $x) $$x = $HTTP_GET_VARS[$x];

if ($a=="addlist")

{
sed_shield_protect();
$g = array ('nnotebook_id','nnotebook_userid', 'nnotebook_message');
foreach($g as $x) $$x = $HTTP_POST_VARS[$x];
$sql = sed_sql_query("INSERT INTO ".$cfg['plugin']['options']['dbprefix']."_notebook (notebook_id, notebook_userid, notebook_message) VALUES ('$nnotebook_id', '".$usr['id']."', '$nnotebook_message') ");
header("Location: plug.php?e=options");
}

if ($a=="deletelist")
{
$sql = sed_sql_query("DELETE FROM ".$cfg['plugin']['options']['dbprefix']."_notebook WHERE notebook_userid = '".$usr['id']."' AND notebook_id = '$id' ");
header("Location: plug.php?e=options");
}

if ($a=="updatelist")
{
$sql = sed_sql_query("DELETE FROM ".$cfg['plugin']['options']['dbprefix']."_notebook WHERE notebook_userid = '".$usr['id']."' AND notebook_id = '$id' ");
$g = array ('nnotebook_id','nnotebook_userid', 'nnotebook_message');
foreach($g as $x) $$x = $HTTP_POST_VARS[$x];
$sql = sed_sql_query("INSERT INTO ".$cfg['plugin']['options']['dbprefix']."_notebook (notebook_id, notebook_userid, notebook_message) VALUES ('$nnotebook_id', '".$usr['id']."', '$nnotebook_message') ");
header("Location: plug.php?e=options");
}

$notes .= "<p> ".$L['currenttodo']." <ul>";

$query= sed_sql_query("SELECT * FROM ".$cfg['plugin']['options']['dbprefix']."_notebook WHERE notebook_userid = '".$usr['id']."' ORDER by notebook_id DESC");
$notenum = sed_sql_numrows($query);
if ($notenum==0)
{
$notes .="".$L['nonotes']."";
}
while ($sql = sed_sql_fetcharray($query))
{
$notes .= "<li>" .sed_parse(sed_cc($sql['notebook_message']));

$notes .= " <a href=plug.php?e=options&a=deletelist&id=".$sql['notebook_id'];
$notes .= ">[".$L['xdelete']."]</a> ";
$notes .= " <a href=plug.php?e=options&r=updatelist&id=".$sql['notebook_id'];
$notes .= ">[".$L['edit']."]</a></li>";
}

$notes .= "</ul>";

$query = sed_sql_query("SELECT notebook_message FROM ".$cfg['plugin']['options']['dbprefix']."_notebook WHERE notebook_userid = '".$usr['id']."' AND notebook_id = '$id'");
$sql = sed_sql_fetcharray($query);

if ($r=="updatelist")
{
$notes .= "<p>".$L['updatetodo']."";
$notes .= "<form name=\"addentry\" action=\"plug.php?e=options&a=updatelist&id=$id\" method=\"post\">";
$notes .= "<br /><textarea name=\"nnotebook_message\" rows=\"2\" cols=\"30\">".$sql['notebook_message'];
$notes .= "</textarea><br />" .sed_build_bbcodes("addentry","nnotebook_message",$L['BBcodes']);
$notes .= " ".$cfg['separator']." <a href=\"plug.php?e=options\">Add New Note</a><br /><br /><input type=\"submit\" value=\"".$L['updatetodo']."\"></form></p>";
}

else
{
$notes .= "<p>".$L['addtodo']."";
$notes .= "<form name=\"addentry\" action=\"plug.php?e=options&a=addlist\" method=\"post\">";
$notes .= "<br /><textarea name=\"nnotebook_message\" rows=\"2\" cols=\"30\"></textarea>";
$notes .= "<br />" .sed_build_bbcodes("addentry","nnotebook_message",$L['BBcodes']);
$notes .= "<br /><br /><input type=\"submit\" value=\"".$L['addtodo']."\"></form></p>";
}

angst
12-10-2009, 06:47 PM
what doesn't work? are you getting an error?

djm0219
12-10-2009, 06:47 PM
What doesn't it do? What do you expect it to do? What, if any, errors are shown?

XjSv
12-10-2009, 07:07 PM
its a simple to do list its suppose to update the db or insert or display in the page

angst
12-10-2009, 07:09 PM
and are you getting an error? what happens when you run it? have you setup the data base and configured the connection script('s) for it?

XjSv
12-10-2009, 07:10 PM
when i use the script the page loads blank then when i go bak nothing has happened

oracleguy
12-10-2009, 07:43 PM
Try this: http://www.codingforums.com/showthread.php?p=617060#post617060

And make sure to try looking in the page source in the browser for any error messages, some times they don't render depending on their placement in the HTML.