dynamically create php script

This is a discussion on "dynamically create php script" within the PHP Forum section. This forum, and the thread "dynamically create php script are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 13th, 2007, 07:28
SuperMember

SuperMember
Join Date: Apr 2007
Location: Sydney
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
dynamically create php script

Code: Select all
 
while ($p < count($categoryarray)) 
{ 
        if (!file_exists($statepath.$categoryarray[$p])) 
        { 
            $ourFileName = "$statepath$categoryarray[$p]";
   $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
   $stringData = "php script goes here";
   fwrite($ourFileHandle, $stringData);
   fclose($ourFileHandle);
        } 
        $p++; 
}
Hi Im trying to use this code to dynamically create a php file, for instance how do I insert this code:

Code: Select all
include 'connectdb_techs.php';
  include 'input_check.php';
  $area = sql_quote($_POST['state']);
  if ($area == '') { $area = sql_quote($_GET['state']); }
  $cat = sql_quote($_POST['cat']);
  if ($cat == '') { $cat = sql_quote($_GET['cat']); }
in $stringData without it closing the statement early, and end up with a valid php file??

Thanks,

Nathan.
Reply With Quote

  #2 (permalink)  
Old Nov 13th, 2007, 16:08
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: dynamically create php script

Have you tried something like this? I don't know whether it will work or not.
PHP: Select all

include 'connectdb_techs.php';
  include 
'input_check.php';
  
$area sql_quote($_POST['state']);
  if (
$area == '') { $area sql_quote($_GET['state']); }
  
$cat sql_quote($_POST['cat']);
  if (
$cat == '') { $cat sql_quote($_GET['cat']); } 
in a file called script.php (or a more suitable name) then use:
PHP: Select all

$stringData file_get_contents('script.php'); 

Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to set the FOCUS() dynamically with javascript AJAY KUMAR JavaScript Forum 2 Jul 9th, 2007 03:29
Best script to create users for password protected pages? vandiermen PHP Forum 3 Apr 23rd, 2007 12:22
Forcing a 3 row layout dynamically rosh1e Web Page Design 6 Apr 7th, 2007 13:24
Dynamically load PPT or PPS into the Flash using XML bijeeshmk Flash & Multimedia Forum 0 Jan 24th, 2007 06:14
Changing URLs dynamically - is this possible? fallen_angel Web Page Design 8 May 16th, 2006 23:31


All times are GMT. The time now is 11:41.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43