Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
sgtbookie
Hangin' Around



Joined: May 08, 2004
Posts: 29
Location: Atlanta, GA

PostPosted: Mon Jun 14, 2004 8:34 pm Reply with quote

Hello all. I am trying to get a version of phpComics by Ryan Phillips to run properly on my site. After scrounging the old abandoned CSV at sourceforge, I was able to come up with all the files I need for it to run, and it works pretty good. However, in order to setup the individual comics you use an admin module, but if I have this module in my html/admin/modules folder, it is the only module that works (I click Sentinel, it brings up the Comics module, etc). So I make changes then rename it. If someone can tell me if a part of this code is the cause, I'd be really happy. Thanks:

Quote:
<?php
/*
phpComic - Created By: Ryan Phillips, et al. - An opensourced PHP Comic Strip Parser
Copyright (C) 2000-2001 Ryan Phillips

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

Please see the LICENSE file for more licensing information.
*/

/*
* Set to true for use within phpNuke
*/
$phpnuke = true;
// only needed for stand-alone settings
$mysql_user = '';
$mysql_pass = '';
$mysql_host = '';
$mysql_data = '';

if($phpnuke) {
if(!eregi('admin.php', $PHP_SELF)) { die ('Access Denied'); }
$hlpfile = 'manual/comics.html';
$result = mysql_query("select radminarticle, radminsuper from cpgnuke_authors where aid='$aid'");
list($radminarticle, $radminsuper) = mysql_fetch_row($result);
if(($radminsuper == 1) OR ($radminarticle == 1)) {
switch($op) {
case 'ComicDel' :
ComicDel($comic, $ok);
break;
case 'ComicAdd' :
ComicAdd($xid, $xname, $xurl, $xmethod, $xarg, $xarg2, $xarg3, $xarg4, $xactive);
break;
case 'ComicSave' :
ComicSave($xid, $xname, $xurl, $xmethod, $xarg, $xarg2, $xarg3, $xarg4, $xactive);
break;
case 'ComicEdit' :
ComicEdit($comic);
break;
case 'ComicActive' :
ComicActive($comic, $active);
break;
case 'ComicMySQL' :
ComicMySQL($sql);
break;
case 'ComicsAdmin' :
default :
ComicsAdmin();
break;
}
}
else {
print 'Access Denied';
}
}
else { // stand alone
mysql_connect($mysql_host, $mysql_user, $mysql_pass);
mysql_select_db($mysql_data);
switch($op) {
case 'ComicDel' :
ComicDel($comic, $ok);
break;
case 'ComicAdd' :
ComicAdd($xid, $xname, $xurl, $xmethod, $xarg, $xarg2, $xarg3, $xarg4, $xactive);
break;
case 'ComicSave' :
ComicSave($xid, $xname, $xurl, $xmethod, $xarg, $xarg2, $xarg3, $xarg4, $xactive);
break;
case 'ComicEdit' :
print '<HTML><HEAD><TITLE>phpComic Admin: Edit</TITLE></HEAD><BODY>';
ComicEdit($comic);
print '</BODY></HTML>';
break;
case 'ComicActive' :
ComicActive($comic, $active);
break;
case 'ComicMySQL' :
ComicMySQL($sql);
break;
case 'ComicsAdmin' :
default :
print '<HTML><HEAD><TITLE>phpComic Admin</TITLE></HEAD><BODY>';
ComicsAdmin();
print '</BODY></HTML>';
break;
}
}

function ComicsAdmin() {
global
$hlpfile,
$admin,
$phpnuke,
$filter,
$order,
$PHP_SELF
;
if($phpnuke) {
include 'header.php';
GraphicAdmin($hlpfile);
OpenTable();
}
if(!$filter) {
$filter = 'all';
}
if(!$order) {
$order = 'name';
}
$output = array();
$output[] = '<CENTER><FONT SIZE="+1"><B>phpComics</B></FONT></CENTER>';
$output[] = '<CENTER><TABLE BORDER="1" WIDTH="90%"><TR>';
$output[] = '<TH BGCOLOR="0000ba"><A HREF="' . $PHP_SELF . '?op=ComicsAdmin&filter=' . $filter . '&order=id"><FONT SIZE="-1" COLOR="white">ID</FONT></A></TD>';
$output[] = '<TH BGCOLOR="0000ba"><A HREF="' . $PHP_SELF . '?op=ComicsAdmin&filter=' . $filter . '&order=name"><FONT SIZE="-1" COLOR="white">Name</FONT></A></TD>';
$output[] = '<TH BGCOLOR="0000ba"><A HREF="' . $PHP_SELF . '?op=ComicsAdmin&filter=' . $filter . '&order=method"><FONT SIZE="-1" COLOR="white">Method</FONT></A></TD>';
$output[] = '<TH BGCOLOR="0000ba"><A HREF="' . $PHP_SELF . '?op=ComicsAdmin&filter=' . $filter . '&order=active"><FONT SIZE="-1" COLOR="white">Active</FONT></A></TD>';
$output[] = '<TH BGCOLOR="0000ba"><FONT SIZE="-1" COLOR="white">Functions</TD>';
$output[] = '</TR>';
$result = mysql_query('SELECT * FROM cpgnuke_comic ORDER BY ' . $order . ' ASC');
while($row = mysql_fetch_array($result)) {
if($filter == 'all' || ($filter == 'active' && $row['active']) || ($filter == 'inactive' && !$row['active'])) {
$output[] = '<TR>';
$output[] = '<TD BGCOLOR="009999" ALIGN="center"><FONT SIZE="-1" COLOR="white">' . $row['id'] . '</FONT></TD>';
$output[] = '<TD BGCOLOR="009999" ALIGN="center"><FONT SIZE="-1" COLOR="white">' . $row['name'] . '</FONT></TD>';
$output[] = '<TD BGCOLOR="009999" ALIGN="center"><FONT SIZE="-1" COLOR="white">' . $row['method'] . '</FONT></TD>';
$output[] = '<TD BGCOLOR="009999" ALIGN="center"><FONT SIZE="-1" COLOR="white">';
if(!$row['active']) {
$output[] = '<A HREF="' . $PHP_SELF . '?op=ComicActive&comic=' . $row['id'] . '&filter=' . $filter . '&order=' . $order . '&active=1"><FONT COLOR="red">Inactive</FONT></A>';
}
else {
$output[] = '<A HREF="' . $PHP_SELF . '?op=ComicActive&comic=' . $row['id'] . '&filter=' . $filter . '&order=' . $order . '&active=0"><FONT COLOR="green">Active</FONT></A>';
}
$output[] = '</FONT></TD>';
$output[] = '<TD BGCOLOR="009999" ALIGN="center"><FONT SIZE="-1" COLOR="white"><A HREF="' . $PHP_SELF . '?op=ComicEdit&comic=' . $row['id'] . '&filter=' . $filter . '&order=' . $order . '">Edit</AspacerA HREF="' . $PHP_SELF . '?op=ComicDelete&comic=' . $row['id'] . '&filter=' . $filter . '&order=' . $order . '&ok=0">Delete</A></FONT></TD>';
$output[] = '</TR>';
}
}
$output[] = '</TABLE></CENTER>';
// filter
$output[] = '<FORM ACTION="' . $PHP_SELF . '" METHOD="post">';
$output[] = '<INPUT TYPE="hidden" NAME="op" VALUE="ComicsAdmin">';
$output[] = '<INPUT TYPE="hidden" NAME="order" VALUE="' . $order . '">';
$output[] = '<CENTER><TABLE BORDER="1" WIDTH="90%">';
$output[] = '<TR>';
$output[] = '<TD BGCOLOR="0000ba" ALIGN="center"><FONT SIZE="-1" COLOR="white">';
$fo = array();
$fo[$filter] = ' SELECTED';
$output[] = '<SELECT NAME="filter" SIZE="1" onChange="this.form.submit()">';
$output[] = '<OPTION VALUE="all"' . $fo['all'] . '>Display All Comics</OPTION>';
$output[] = '<OPTION VALUE="inactive"' . $fo['inactive'] . '>Display Inactive Comics</OPTION>';
$output[] = '<OPTION VALUE="active"' . $fo['active'] . '>Display Active Comics</OPTION>';
$output[] = '</SELECT>';
$output[] = '</FONT></TD>';
$output[] = '</TABLE></CENTER>';
$output[] = '</FORM>';
// add comic
$output[] = '<CENTER><FONT SIZE="+1"><B>Add Comic</B></FONT></CENTER>';
$output[] = '<FORM ACTION="' . $PHP_SELF . '" METHOD="post">';
$output[] = '<INPUT TYPE="hidden" NAME="op" VALUE="ComicAdd">';
$output[] = '<INPUT TYPE="hidden" NAME="filter" VALUE="' . $filter . '">';
$output[] = '<INPUT TYPE="hidden" NAME="order" VALUE="' . $order . '">';
$output[] = '<TABLE BORDER="0" WIDTH="100%">';
$output[] = '<TR><TD ALIGN="right">ID:</TD><TD><INPUT TYPE="text" NAME="xid" SIZE="30" MAXLENGTH="255"></TD></TR>';
$output[] = '<TR><TD ALIGN="right">Name:</TD><TD><INPUT TYPE="text" NAME="xname" SIZE="30" MAXLENGTH="255"></TD></TR>';
$output[] = '<TR><TD ALIGN="right">URL:</TD><TD><INPUT TYPE="text" NAME="xurl" SIZE="30" MAXLENGTH="255"></TD></TR>';
$output[] = '<TR><TD ALIGN="right">Method:</TD><TD><INPUT TYPE="text" NAME="xmethod" SIZE="30" MAXLENGTH="255"></TD></TR>';
$output[] = '<TR><TD ALIGN="right">Argument:</TD><TD><INPUT TYPE="text" NAME="xarg" SIZE="30" MAXLENGTH="255"></TD></TR>';
$output[] = '<TR><TD ALIGN="right">Argument 2:</TD><TD><INPUT TYPE="text" NAME="xarg2" SIZE="30" MAXLENGTH="255"></TD></TR>';
$output[] = '<TR><TD ALIGN="right">Argument 3:</TD><TD><INPUT TYPE="text" NAME="xarg3" SIZE="30" MAXLENGTH="255"></TD></TR>';
$output[] = '<TR><TD ALIGN="right">Argument 4:</TD><TD><INPUT TYPE="text" NAME="xarg4" SIZE="30" MAXLENGTH="255"></TD></TR>';
$output[] = '<TR><TD ALIGN="right">Active:</TD><TD><SELECT NAME="xactive" SIZE="1">';
$output[] = '<OPTION VALUE="1" SELECTED>Active</OPTION>';
$output[] = '<OPTION VALUE="0">Inactive</OPTION>';
$output[] = '</SELECT></TD></TR>';
$output[] = '</TABLE>';
$output[] = '<INPUT TYPE="submit" VALUE="Save Changes">';
$output[] = '</FORM>';
// mysql comic code
$output[] = '<CENTER><FONT SIZE="+1"><B>MySQL Comic Edit</B></FONT></CENTER>';
$output[] = '<FORM ACTION="' . $PHP_SELF . '" METHOD="post">';
$output[] = '<INPUT TYPE="hidden" NAME="op" VALUE="ComicMySQL">';
$output[] = '<INPUT TYPE="hidden" NAME="filter" VALUE="' . $filter . '">';
$output[] = '<INPUT TYPE="hidden" NAME="order" VALUE="' . $order . '">';
$output[] = '<TABLE BORDER="0" WIDTH="100%">';
$output[] = '<TR><TD ALIGN="right">MySQL:</TD><TD><TEXTAREA NAME="sql" ROWS="5" COLS="50" WRAP="soft"></TEXTAREA></TD></TR>';
$output[] = '</TABLE>';
$output[] = '<INPUT TYPE="submit" VALUE="Run SQL Command">';
$output[] = '</FORM>';
print join("\n", $output);
if($phpnuke) {
CloseTable();
include 'footer.php';
}
}

function ComicEdit($comic) {
global
$language,
$hlpfile,
$admin,
$phpnuke,
$filter,
$order,
$PHP_SELF
;
if($phpnuke) {
include 'header.php';
GraphicAdmin($hlpfile);
OpenTable();
}
$result = mysql_query("SELECT * FROM cpgnuke_comic WHERE id = '$comic'");
$row = mysql_fetch_array($result);
$output = array();
// edit comic
$output[] = '<CENTER><FONT SIZE="+1"><B>Edit Comic</B></FONT></CENTER>';
$output[] = '<FORM ACTION="' . $PHP_SELF . '" METHOD="post">';
$output[] = '<INPUT TYPE="hidden" NAME="op" VALUE="ComicSave">';
$output[] = '<INPUT TYPE="hidden" NAME="comic" VALUE="' . $row['id'] . '">';
$output[] = '<INPUT TYPE="hidden" NAME="filter" VALUE="' . $filter . '">';
$output[] = '<INPUT TYPE="hidden" NAME="order" VALUE="' . $order . '">';
$output[] = '<TABLE BORDER="0" WIDTH="100%">';
$output[] = '<TR><TD>ID:</TD><TD><INPUT TYPE="text" NAME="xid" SIZE="30" MAXLENGTH="255" VALUE="' . htmlentities($row['id']) . '"></TD></TR>';
$output[] = '<TR><TD>Name:</TD><TD><INPUT TYPE="text" NAME="xname" SIZE="30" MAXLENGTH="255" VALUE="' . htmlentities($row['name']) . '"></TD></TR>';
$output[] = '<TR><TD>URL:</TD><TD><INPUT TYPE="text" NAME="xurl" SIZE="30" MAXLENGTH="255" VALUE="' . htmlentities($row['url']) . '"></TD></TR>';
$output[] = '<TR><TD>Method:</TD><TD><INPUT TYPE="text" NAME="xmethod" SIZE="30" MAXLENGTH="255" VALUE="' . htmlentities($row['method']) . '"></TD></TR>';
$output[] = '<TR><TD>Argument:</TD><TD><INPUT TYPE="text" NAME="xarg" SIZE="30" MAXLENGTH="255" VALUE="' . htmlentities($row['arg']) . '"></TD></TR>';
$output[] = '<TR><TD>Argument 2:</TD><TD><INPUT TYPE="text" NAME="xarg2" SIZE="30" MAXLENGTH="255" VALUE="' . htmlentities($row['arg2']) . '"></TD></TR>';
$output[] = '<TR><TD>Argument 3:</TD><TD><INPUT TYPE="text" NAME="xarg3" SIZE="30" MAXLENGTH="255" VALUE="' . htmlentities($row['arg3']) . '"></TD></TR>';
$output[] = '<TR><TD>Argument 4:</TD><TD><INPUT TYPE="text" NAME="xarg4" SIZE="30" MAXLENGTH="255" VALUE="' . htmlentities($row['arg4']) . '"></TD></TR>';
$output[] = '<TR><TD>Active:</TD><TD><SELECT NAME="xactive" SIZE="1">';
if($row['active']) {
$active_on = ' SELECTED';
}
else {
$active_off = ' SELECTED';
}
$output[] = '<OPTION VALUE="1"' . $active_on . '>Active</OPTION>';
$output[] = '<OPTION VALUE="0"' . $active_off . '>Inactive</OPTION>';
$output[] = '</SELECT></TD></TR>';
$output[] = '</TABLE>';
$output[] = '<INPUT TYPE="submit" VALUE="Save Changes">';
$output[] = '</FORM>';
// display MySQL 'add' command for comic
$output[] = '<CENTER><FONT SIZE="+1"><B>MySQL &quot;Add&quot; Command</B></FONT></CENTER>';
$output[] = '<CENTER><TABLE BORDER="1">';
$output[] = '<TR><TD>';
$output[] = "INSERT INTO cpgnuke_comic (id, name, url, method, arg, arg2, arg3, arg4) VALUES ('" . $row['id'] . "', '" . addslashes($row['name']) . "', '" . addslashes($row['url']) . "', '" . addslashes($row['method']) . "', '" . addslashes($row['arg']) . "', '" . addslashes($row['arg2']) . "', '" . addslashes($row['arg3']) . "', '" . addslashes($row['arg4']) . "')";
$output[] = '</TD></TR>';
$output[] = '</TABLE></CENTER>';
// display MySQL 'update' command for comic
$output[] = '<CENTER><FONT SIZE="+1"><B>MySQL &quot;Update&quot; Command</B></FONT></CENTER>';
$output[] = '<CENTER><TABLE BORDER="1">';
$output[] = '<TR><TD>';
$output[] = "UPDATE cpgnuke_comic SET name='" . addslashes($row['name']) . "', url='" . addslashes($row['url']) . "', method='" . addslashes($row['method']) . "', arg='" . addslashes($row['arg']) . "', arg2='" . addslashes($row['arg2']) . "', arg3='" . addslashes($row['arg3']) . "', arg4='" . addslashes($row['arg4']) . "' WHERE id='" . $row['id'] . "' LIMIT 1";
$output[] = '</TD></TR>';
$output[] = '</TABLE></CENTER>';
print join("\n", $output);
if($phpnuke) {
CloseTable();
include 'footer.php';
}
}

function ComicSave($id, $name, $url, $method, $arg, $arg2, $arg3, $arg4, $active) {
global
$filter,
$order,
$PHP_SELF
;
if($active) {
$active = "'1'";
}
else {
$active = 'NULL';
}
mysql_query("UPDATE cpgnuke_comic SET id='$id', name='$name', url='$url', method='$method', arg='$arg', arg2='$arg2', arg3='$arg3', arg4='$arg4', active=$active WHERE id='$id'");
Header('Location: ' . $PHP_SELF . '?op=ComicsAdmin&filter=' . $filter . '&order=' . $order);
}

function ComicAdd($id, $name, $url, $method, $arg, $arg2, $arg3, $arg4, $active) {
global
$filter,
$order,
$PHP_SELF
;
if($active) {
$active = "'1'";
}
else {
$active = 'NULL';
}
mysql_query("INSERT INTO cpgnuke_comic (id, name, url, method, arg, arg2, arg3, arg4, active) VALUES ('$id', '$name', '$url', '$method', '$arg', '$arg2', '$arg3', '$arg4', $active)");
Header('Location: ' . $PHP_SELF . '?op=ComicsAdmin&filter=' . $filter . '&order=' . $order);
}

function ComicActive($id, $active) {
global
$filter,
$order,
$PHP_SELF
;
if($active) {
$active = "'1'";
}
else {
$active = 'NULL';
}
mysql_query("UPDATE cpgnuke_comic SET active=$active WHERE id='$id'");
Header('Location: ' . $PHP_SELF . '?op=ComicsAdmin&filter=' . $filter . '&order=' . $order);
}

function ComicMySQL($sql) {
global
$filter,
$order,
$PHP_SELF
;
mysql_query(stripslashes($sql));
Header('Location: ' . $PHP_SELF . '?op=ComicsAdmin&filter=' . $filter . '&order=' . $order);
}

function ComicDel($comic, $ok = false) {
global
$hlpfile,
$filter,
$order,
$PHP_SELF
;
if($ok) {
mysql_query("DELETE FROM cpgnuke_comic WHERE id='$comic'");
Header('Location: ' . $PHP_SELF . '?op=ComicsAdmin&filter=' . $filter . '&order=' . $order);
}
else {
include 'header.php';
GraphicAdmin($hlpfile);
OpenTable();
$output = array();
$output[] = '<BR><CENTER>';
$output[] = '<FONT COLOR="red"><B>WARNING: Are you sure you want to delete this comic?</B></FONT><BR><BR>';
$output[] = '[ <A HREF="' . $PHP_SELF . '?op=ComicDel&comic=' . $comic . '&filter=' . $filter . '&order=' . $order . '&ok=1">Yes</A> | <A HREF="' . $PHP_SELF . '?op=ComicsAdmin&filter=' . $filter . '&order=' . $order . '">No</A> ]<BR><BR>';
}
print join("\n", $output);
CloseTable();
include 'footer.php';
}
?>


_________________
Sgt.Bookie
TwelvevoltmanDOTcom 
View user's profile Send private message Visit poster's website
SmackDaddy
Involved
Involved



Joined: Jun 02, 2004
Posts: 268
Location: Englewood, OH

PostPosted: Tue Jun 15, 2004 1:28 am Reply with quote

Not sure what version of phpnuke you are running..... there were some code changes in the latest security update for phpnuke 7.3.....
 
View user's profile Send private message Send e-mail Visit poster's website
sgtbookie







PostPosted: Tue Jun 15, 2004 9:34 pm Reply with quote

Sorry, I should have mentioned that. Same problem running on 6.8 - 7.0 PHPnuke sites.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©