PDA

View Full Version : A Few Things I Need Help On PHP



Private_Guy
07-02-2007, 01:25 AM
Hi there all,

How is everybody doing? Well I was wondering how to do the followings:

1. Creating a Call Back Script which tells you who is using your script and etc..

2. How to change PHP Strings by a form. Example, I have a string called $SITE_NAME and want it to be changed by a form which changed the config.php by itself if you know what I mean?

Thanks very much for your help and support :).

Best Regards,
Private_Guy

alexjewell
07-02-2007, 02:16 AM
If #2 is saying what I think it is, I just did a script like that. Let me just make sure I'm understanding you correctly. Say $SITE_NAME = 'something.com';

Then, someone submits a form to give $SITE_NAME a new declaration, 'something2.com'? So, thus making it $SITE_NAME = 'something2.com';?

Private_Guy
07-02-2007, 02:19 AM
Hi there,

Thanks for the quick reply. Well no, Lets say I have SITE_NAME= Someone.com in a file called config.php. Now I want to change the value of SITE_NAME by a form, e.g. Form.php. Do you get me now?

So mainly, changing a php string by a form.

Thanks very much.

Best Regards,
Private_Guy

alexjewell
07-02-2007, 02:25 AM
Yes, that's what I said. Basically, I just did something like this. Here:

http://www.dynamicdrive.com/forums/showpost.php?p=98757&postcount=8

Take a look at that code. It's a little complicated for what you need, but the main idea for your problem is in write.php

Private_Guy
07-02-2007, 02:50 AM
Hi there,

But im sure its must simpler then that, it has too much codes which you sent me. Here, I will give you the following file names which it needs:

* We will use the string SITE_NAME HERE
<?
include("config.php");
include("functions.php");
?>

Now a form here, to change the Site_Name string included in the config.php file.

Thanks very much.

Best Regards,
Private_Guy

alexjewell
07-02-2007, 02:57 AM
I'd have to modify my code a lot to do that, so I'll just give you the gist.

Look at the following piece of code from write.php:



if(@$_POST[$edit_file]){
$page = $_POST[$edit_file];
$pageu = strtoupper($edit_file);
$newcontent = '$'.$edit_file.' = <<<'.$pageu.'101291'."\n".$page."\n".$pageu.'101291;';

list($a,$b) = explode('$'.$edit_file,$php_file,2);
list($b,$c) = explode($pageu."101291;",$b,2);
$php_final = $a."\n\n".$newcontent."\n\n".$c;


$file = 'inc.php';
$file = @fopen($file,'w+');
@fwrite($file,$php_final);
@fclose($file);

echo '<meta http-equiv="refresh" content="0;url='.$success.'">';}


For mine, it's written a bit different, but do you see what it's doing?

Private_Guy
07-02-2007, 03:02 AM
Dam.. You have to do all this, I thought you basically had to do the following:

fopen("config.php")
fwrite("config.php") something like that. lol

alexjewell
07-02-2007, 03:04 AM
Haha, well, how many variables are in config.php?

Private_Guy
07-02-2007, 03:09 AM
Haha, only 11 Variables :)

alexjewell
07-02-2007, 03:10 AM
then you do need something like the above. If it were only one, you'd need something simple, a few lines.

Now, since it's 11 variables, then it's the above. Do you understand the code?

Private_Guy
07-02-2007, 03:14 AM
Not really :S. Sorry, but im not a pro on PHP, do you have Gmail or Yahoo or MSN messenger? :). Cheers

Private_Guy
07-02-2007, 03:18 AM
To be honest not really :S, im not really a pro on PHP language. Well do you have MSN or Yahoo or Gmail Messenger to help me with it? :) Cheers

alexjewell
07-02-2007, 03:19 AM
Yahoo IM? alexjewell@sbcglobal.net
IM me.

Private_Guy
07-02-2007, 03:24 AM
Thanks m8