Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Zapis kodu PHP do pliku
marcinpruciak
post 1.01.2009, 00:23:34
Post #1





Grupa: Zarejestrowani
Postów: 161
Pomógł: 9
Dołączył: 14.07.2008

Ostrzeżenie: (0%)
-----


Mam taki kod:

  1. <?
  2.  
  3.  $config = "<?php \n";
  4.  $config .= "if(!defined('RG_EMULATION')) { define( 'RG_EMULATION', $RGEmulation ); }\n";
  5.  $config .= "$mosConfig_MetaAuthor = '1';
  6. $mosConfig_MetaDesc = 'Joomla - portal dynamiczny i system zarządzania treścią.........';
  7. $mosConfig_MetaKeys = 'Joomla, joomla.................';
  8. $mosConfig_MetaTitle = '1';
  9.  
  10. $mosConfig_admin_expired = '1';
  11. $mosConfig_allowUserRegistration = '1';
  12. ...
  13. $mosConfig_shownoauth = '0';
  14. $mosConfig_sitename = 'joomla....';
  15. $mosConfig_smtpauth = '0';
  16. $mosConfig_smtphost = 'localhost';
  17. $mosConfig_smtppass = '';
  18. $mosConfig_smtpuser = '';
  19. $mosConfig_uniquemail = '1';
  20. $mosConfig_useractivation = '1';
  21. $mosConfig_vote = '0';";
  22.  
  23.      $config .= "setlocale (LC_TIME, $mosConfig_locale);\n";
  24.  $config .= '?>';
  25.  
  26.  
  27.  $fp = fopen("./users/conf_test.php", "w");
  28.  fputs($fp, $config, strlen($config));
  29.  fclose($fp);


A w pliku conf_test dodają się takie rzeczy:

Kod
<?php 
if(!defined('RG_EMULATION')) { define( 'RG_EMULATION',  ); }
 = '1';
 = 'Joomla - portal dynamiczny i system zarz±dzania tre¶ci±.........';
 = 'Joomla, joomla.................';
 = '1';

 = '1';
 = '1';
 = '1';

 = '900';
 = '0';
...
 = '';
 = '';
 = '1';
 = '1';
 = '0';setlocale (LC_TIME, $mosConfig_locale);
?>


Brakuje nazw zmiennych. Nie wiem co tu nie gra. Niby jest wszystko dobrze.

PS. Szczęśliwego Nowego Roku.


--------------------
Go to the top of the page
+Quote Post
pyro
post 1.01.2009, 00:32:25
Post #2





Grupa: Zarejestrowani
Postów: 2 148
Pomógł: 230
Dołączył: 26.03.2008

Ostrzeżenie: (0%)
-----


bo w cudzysłowach zmienne są interpretowane, musisz użyc apostrofów


--------------------
ET LINGUA EIUS LOQUETUR IUDICIUM
Go to the top of the page
+Quote Post
marcinpruciak
post 1.01.2009, 01:03:03
Post #3





Grupa: Zarejestrowani
Postów: 161
Pomógł: 9
Dołączył: 14.07.2008

Ostrzeżenie: (0%)
-----


Chyba jednak nie to, albo coś źle robię. Może pokaż przykład. W `` wogóle nie dodaje się żaden tekst.


--------------------
Go to the top of the page
+Quote Post
bim2
post 1.01.2009, 01:55:23
Post #4





Grupa: Zarejestrowani
Postów: 1 873
Pomógł: 152
Dołączył: 9.04.2006
Skąd: Berlin

Ostrzeżenie: (0%)
-----


  1. <?
  2.  
  3. $config = '<?php \n';
  4. $config .= 'if(!defined('RG_EMULATION')) { define( 'RG_EMULATION', $RGEmulation ); }\n';
  5. $config .= '$mosConfig_MetaAuthor = '1';
  6. $mosConfig_MetaDesc = 'Joomla - portal dynamiczny i system zarządzania treścią.........';
  7. $mosConfig_MetaKeys = 'Joomla, joomla.................';
  8. $mosConfig_MetaTitle = '1';
  9.  
  10. $mosConfig_admin_expired = '1';
  11. $mosConfig_allowUserRegistration = '1';
  12. ...
  13. $mosConfig_shownoauth = '0';
  14. $mosConfig_sitename = 'joomla....';
  15. $mosConfig_smtpauth = '0';
  16. $mosConfig_smtphost = 'localhost';
  17. $mosConfig_smtppass = '';
  18. $mosConfig_smtpuser = '';
  19. $mosConfig_uniquemail = '1';
  20. $mosConfig_useractivation = '1';
  21. $mosConfig_vote = '0';';
  22.  
  23.     $config .= 'setlocale (LC_TIME, $mosConfig_locale);\n';
  24. $config .= '?>';
  25.  
  26.  
  27. $fp = fopen("./users/conf_test.php", "w");
  28. fputs($fp, $config, strlen($config));
  29. fclose($fp);


--------------------
Go to the top of the page
+Quote Post
marcinpruciak
post 1.01.2009, 11:42:29
Post #5





Grupa: Zarejestrowani
Postów: 161
Pomógł: 9
Dołączył: 14.07.2008

Ostrzeżenie: (0%)
-----


Dzięki działa, tak jak chciałem.

Ten post edytował marcinpruciak 1.01.2009, 14:23:31


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 09:27