Jump to content

[SOLVED] Running other php scripts within a php script w/o shell access


Metonmuris

Recommended Posts

I have created some GD2 generation scripts that only need to be updated everyonce an while, and because they can take some heavy cpu time I would only like them to run when they have changed and not whenever any visits the image.

So I set up a script that calls all of the graphics generators as functions and logs the result (Success/Fail) into a log database.

[code=php:0]$doPieGraph = 0;
$doPieGraph = $_GET['piegraph'];

include("../../jpgraph/jpgraph.php");
include("../../jpgraph/jpgraph_bar.php");
include("../displays/graph_utilities");
include("../displays/killratio_chart.php");
include("../displays/killratio_map.php");
include("../displays/killratio_piechart.php");
include('../../config/mysqlvars.php');

$query = array();

if(DrawKRMap($mysqlvars))
{
array_push($query, "INSERT INTO `log` ( `id` , `log_id` , `timestamp` , `error_lvl` , `info` )
VALUES ('0', '100', NOW( ) , '0', 'Kill Ratio Map Successfully Updated');");
echo "true KRMAP <br/>";
}
else
{
array_push($query, "INSERT INTO `log` ( `id` , `log_id` , `timestamp` , `error_lvl` , `info` )
VALUES ('0', '100', NOW( ) , '1', 'Kill Ratio Map ERROR');");
echo "false KRMAP <br/>";
}

if(DrawKRGraph($mysqlvars, '../../assets/graphs/killVdeath.png'))
{
array_push($query, "INSERT INTO `log` ( `id` , `log_id` , `timestamp` , `error_lvl` , `info` )
VALUES ('0', '101', NOW( ) , '0', 'Kill Ratio Chart Successfully Updated');");
echo "true KRCHART <br/>";
}
else
{
array_push($query, "INSERT INTO `log` ( `id` , `log_id` , `timestamp` , `error_lvl` , `info` )
VALUES ('0', '101', NOW( ) , '1', 'Kill Ratio Chart ERROR');");
echo "false KRCHART <br/>";
}

if($doPieGraph == 1)
{
if(DrawKRPieChart($mysqlvars))
{
array_push($query, "INSERT INTO `log` ( `id` , `log_id` , `timestamp` , `error_lvl` , `info` )
VALUES ('0', '102', NOW( ) , '0', 'Kill Ratio Pie Graph Successfully Updated');");
echo "true KRPIE <br/>";
}
else
{
array_push($query, "INSERT INTO `log` ( `id` , `log_id` , `timestamp` , `error_lvl` , `info` )
VALUES ('0', '102', NOW( ) , '1', 'Kill Ratio Pie Graph ERROR');");
echo "false KRPIE <br/>";
}
}

$link = mysql_connect($mysqlvars['host'], $mysqlvars['user'], $mysqlvars['pass']);
mysql_select_db($mysqlvars['db']);

for($i =0; $i < count($query); $i++)
{
mysql_query($query[$i]);
}

mysql_close($link);

echo "??????";
[/code]


Now the scripts works when dealing with DrawKRMap(), but as soon as it gets to DrawKRChart() is stopped outputting the debug echos and ends like it worked. This is more or less the result that the DrawKRChart() uses JpGraph, whereas DrawKRMap() is straight GD2.

This doesn't work, so I am sitting here scratching my head trying to figure out how to do this, then I though why not do a CLI operation... Well that doens't work either, because I don't have access to it on my host  >:(

So my question is there a way to get php to poke/fork another php file in the same way a user would by visiting that php page without using system or php-cli.

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.