Jump to content


Adding php to a file, using another php file.

  • Please log in to reply
1 reply to this topic

#1 Short-URL

  • Members
  • PipPip
  • Member
  • 11 posts

Posted 27 August 2006 - 11:43 AM


I am trying to create a php file, and add some php coding to that file, using another php file.
Heres the code that I am using:

$add = "<?php $handle3 = fopen(\"$short/status.php\", \"w\"); fputs($handle3, \"Ip Adress here\"); fclose($handle3); header(\"Location: http://$long\"); ?>";

mkdir("/home/smallurl/public_html/$short", 0777);
$handle = fopen("$short/index.php", "w");
fputs($handle, "$add");  

$handle2 = fopen("$short/status.php", "w");
fputs($handle2, "");  

The code that is in the var $add, is the bit added to the file. But when added to the file it comes out as this:

<?php  = fopen("plugworld/status.php", "w"); fputs(, "Ip Adress here"); fclose(); header("Location: http://www.plug-world.net"); ?>

The Vars are no longer there.

Can anyone help?


#2 Orio

  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 27 August 2006 - 11:55 AM

Try escaping the dollar sign on every var:
$handle3 becomes \$handle3

Think you're smarty?

(Gone until 20 to November)

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users