Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: A Few Things I Need Help On PHP

  1. #1
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default A Few Things I Need Help On PHP

    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

  2. #2
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    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';?
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  3. #3
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

  4. #4
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Yes, that's what I said. Basically, I just did something like this. Here:

    http://www.dynamicdrive.com/forums/s...57&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
    Last edited by alexjewell; 07-02-2007 at 02:33 AM.
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  5. #5
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

  6. #6
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    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:

    PHP Code:
        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?
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  7. #7
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

  8. #8
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Haha, well, how many variables are in config.php?
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  9. #9
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Haha, only 11 Variables

  10. #10
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    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?
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •