This is what i write which creates an index file for me:
<?
$contents = ("\n<head><title>Template 1</title>\n<META NAME='DESCRIPTION' CONTENT TYPE='text/html'>
</head>\n\n<body>\n<input type='hidden' name='Formusername' value='<?php eval ('\$Formusername = \'$Formusername\';');echo(\$Formusername);?>'>\n<input type='hidden' name='Template' value='<?php eval ('\$Template = \'$Template\';');echo(\$Template);?>'>\n\n");
$contents .= ("\$db = @mysql_connect('IP', 'user');
if (!\$db) { echo('<P>Unable to connect to the database server at this time.</P> '); exit();}");
$contents .=("mysql_select_db('Marketplace_International',\$db);
if (! @mysql_select_db('Marketplace_International') ) { echo( '<P>Unable to locate the database ' . 'database at this time.</P>' ); exit();}");
$contents .=("\$query = 'SELECT Bin_data,Filetype from Template WHERE Id=(\$Template)';
eval ('\$query = \'$query\';');");
$contents .=("\$result = @(\$query);
if (!mysql_affected_rows()){
echo 'No results returned';
}
\$data = @MYSQL_RESULT(\$result,0,'Bin_data');
\$type = @MYSQL_RESULT(\$result,0,'Filetype');
eval ('\$type = \'$type\';');
eval ('\$data = \'$data\';');
echo (\$data);
mysql_close();");
$contents .=("\n</body>\n");
$fp = fopen("/home/supracore/public_html/smac/test1/$Formusername/index.php","w+");
chmod ("/home/supracore/public_html/smac/test1/$Formusername/index.php", 0777);
if ($fp)
{
fwrite($fp, $contents);
fclose($fp);
}
?>
but this is what gets pulled out when I try to access the index.php file:
$db = @mysql_connect('142.176.153.212', 'root'); if (!$db) { echo('
Unable to connect to the database server at this time.
'); exit();}mysql_select_db('Marketplace_International',$db); if (! @mysql_select_db('Marketplace_International') ) { echo( '
Unable to locate the database ' . 'database at this time.
' ); exit();}$query = 'SELECT Bin_data,Filetype from Template WHERE Id=($Template)'; eval ('$query = \'\';');$result = @($query); if (!mysql_affected_rows()){ echo 'No results returned'; } $data = @MYSQL_RESULT($result,0,'Bin_data'); $type = @MYSQL_RESULT($result,0,'Filetype'); eval ('$type = \'\';'); eval ('$data = \'\';'); echo ($data); mysql_close();
can anyone please inform me where I went wrong?
Thanks ,
Steve