Jump to content

[SOLVED] PHP Code In A PHP Code?


Azzyh

Recommended Posts

Hello.

I have made this script:

<?
$msg = $_GET['testc'];
    if($_GET["testc"]) {
             if(mkdir(strtolower($msg), 0775)) {
                if(fwrite(fopen(strtolower($msg)."/index.php", "w+"), "CONTENT FOR THE INDEX FILE")) {
                    print "Done: <a href='http://azzyh.dk/$msg'>$msg.azzyh.dk</a>";
                     }else{
                    print "Error #8 contact admin, and report please.";
                }
            }else{
                print "Error #9 contact admin, and report please.";
            }
        }
?>

 

But i want to have a PHP script in the index.php file that the script above ^ is writing.

How should i do that ?

Here's the script i want in:

<?
$msg = $_GET['test'];
$logfile= 'log.html';
$fp = fopen($logfile, "a"); 
fwrite($fp, $msg);
fclose($fp); 
?>

 

Should i go like this:

<?
$msg = $_GET['testc'];
    if($_GET["testc"]) {
             if(mkdir(strtolower($msg), 0775)) {
                if(fwrite(fopen(strtolower($msg)."/index.php", "w+"), 
			?>
			<?
$msg = $_GET['test'];
$logfile= 'log.html';
$fp = fopen($logfile, "a"); 
fwrite($fp, $msg);
fclose($fp); 
?>
			<?
			)) {
                    print "Done: <a href='http://azzyh.dk/$msg'>$msg.azzyh.dk</a>";
                     }else{
                    print "Error #8 contact admin, and report please.";
                }
            }else{
                print "Error #9 contact admin, and report please.";
            }
        }
?>

That wouldn't work i believe!? unexpected syntax.

 

Thanks in forward!

 

Link to comment
https://forums.phpfreaks.com/topic/182465-solved-php-code-in-a-php-code/
Share on other sites

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.