PDA

View Full Version : Console Access


Pyromanci
12-07-2006, 04:42 PM
Well, its been a while since I posted. So I post this code mod I have made.

This is a mod for the admin section of SD. It should function with just about any version. It also require a min of PHP 4 on the server. I made this mod because I needed to access the mysqldump commands, because my host times out during and php based sql exports because they take longer then 60 seconds. So I figured I just make a console access page for my SD admin.

Install Instructions:

Upload the attached file and place it in your main admin folder.

Then open your menu.php file and add a menu print function call to the file. Here is how i did it (code is from SD 2.4)

// admin menus
if($userinfo['adminaccess'])
{

// ########################## Menu_Settings ##########################

StartMenu();
PrintMenuTitle('Settings', true);
PrintMenuRow('mainsettings.php', 'Main Settings');
PrintMenuRow('skins.php', 'Skins');
PrintMenuRow('plugins.php', 'Plugins');

if($mainsettings['sdversiontype'] == 'Pro')
{
PrintMenuRow('forumintegration.php', 'Forum Integration');
}

PrintMenuRow('languages.php', 'Languages');
PrintMenuRow('comments.php', 'Comments');
EndBlock();
PrintMenuTitle('Admin', true);
PrintMenuRow('database.php', 'Database');
PrintMenuRow('info.php', 'Server Info');
PrintMenuRow('syslog.php', 'System Log');

PrintMenuRow('console.php', 'Server Console'); // <-------- This is the call for this mod

EndBlock();
EndMenu();
Once that is done go into your admin panel and move to that page. To run a simple test to make sure everything is working. Use the command whoami.

Let me know what you think. If you like things like this I do have more. I even have one that allows you to change the meta description for each catagory.

Tobias
12-07-2006, 05:39 PM
It's beautiful! Nice coding and great functionality, thanks a lot for sharing!

Pyromanci
12-07-2006, 05:57 PM
Thanks, and its funny you say nice coding. i am a retentive freak when it comes to formating. Spent to many years learning to code and/or computer program with scripts and apps that had no formating or many different formats.

kboy_16
12-07-2006, 06:46 PM
very useful, thanks!

Tobias
12-07-2006, 11:00 PM
Thanks, and its funny you say nice coding. i am a retentive freak when it comes to formating. Spent to many years learning to code and/or computer program with scripts and apps that had no formating or many different formats.

With "nice" I wasn't referring to the formatting, but usage of PHP commands and ways to accomplish the different parsing stages - in other words: cool work! :D

thomas
12-07-2006, 11:37 PM
nice. I seem to get a cgi error on the IIS server, but my other box works fine

Pyromanci
12-08-2006, 12:21 AM
whats the error(s) you get on IIS? I never tested it on a windows server, so if you give me the error and i place it on my IIS server and get it fixed.

thomas
12-08-2006, 12:35 AM
phpwarning: readdir(): supplied argument is not a valid Directory resource in e:\inetpub\esvc000171\admin\console.php on line 154.tshaw 165.228.58.230/admin/console.php?December 8, 2006 10:32:30

phpwarning: closedir(): supplied argument is not a valid Directory resource in e:\inetpub\esvc000171\admin\console.php on line 180.tshaw 165.228.58.230/admin/console.php?December 8, 2006 10:32:30

phpwarning: readdir(): supplied argument is not a valid Directory resource in e:\inetpub\esvc000171\admin\console.php on line 154.tshaw 144.136.1.234/admin/console.php?December 8, 2006 10:32:30

phpwarning: closedir(): supplied argument is not a valid Directory resource in e:\inetpub\esvc000171\admin\console.php on line 180.tshaw 144.136.1.234/admin/console.php?December 8, 2006 10:32:30

phpwarning: readdir(): supplied argument is not a valid Directory resource in e:\inetpub\esvc000171\admin\console.php on line 154.tshaw 165.228.58.230/admin/console.php?December 8, 2006 10:32:14

phpwarning: closedir(): supplied argument is not a valid Directory resource in e:\inetpub\esvc000171\admin\console.php on line 180.tshaw 165.228.58.230/admin/console.php?December 8, 2006 10:32:14

phpwarning: readdir(): supplied argument is not a valid Directory resource in e:\inetpub\esvc000171\admin\console.php on line 154.tshaw 165.228.58.230/admin/console.php?December 8, 2006 10:32:14

phpwarning: closedir(): supplied argument is not a valid Directory resource in e:\inetpub\esvc000171\admin\console.php on line 180.tshaw 165.228.58.230/admin/console.php?December 8, 2006 10:32:14

phpwarning: readdir(): supplied argument is not a valid Directory resource in e:\inetpub\esvc000171\admin\console.php on line 154.tshaw 165.228.58.230/admin/console.php?December 8, 2006 10:32:07

phpwarning: closedir(): supplied argument is not a valid Directory resource in e:\inetpub\esvc000171\admin\console.php on line 180.tshaw 165.228.58.230/admin/console.php?December 8, 2006 10:32:07

and also....

CGI Error

The specified CGI application misbehaved by not returning a complete set of HTTP headers.

Pyromanci
12-08-2006, 03:26 AM
k, i will take a look at it tomarrow when i am right at the servers. So i don't have to worry about FTP lag. Is that IIS 6 or 5 your running?

william
12-09-2006, 12:16 AM
I am using it on a php5 server, but every command I type in just gets repeated in the window with no results.

Pyromanci
12-09-2006, 01:53 AM
If it doesn't return anything but PHPConsole> (command) and there are no errors then there is a issue with the serer you have your sit on. They probably have all the ssh commands disabled or the varrious possible php syntax's that can pass shell commands through disabled in some way.

I have had hosts do that to me in the past.

Pyromanci
12-09-2006, 10:06 PM
I noticed that if it is a windows based machine (iis or apache) there are all sorts of problems.

So for now, stick with linux/unix based servers and i get a windows based version completed sortly.

A windows based server using apache will not return commands.