Results 1 to 3 of 3

Thread: $ sign problem

  1. #1
    Join Date
    Jun 2008
    Location
    pakistan
    Posts
    109

    Unanswered: $ sign problem

    i make a installation process of script like vbulletin and others forum it write all the information to the file and i use this script but when i write here $ sign it give me error undefined variable in this line ...

    so how to write replace function of php that it will replace any sign in $ sign

    PHP Code:
    $school_nam=$_POST['sname'];
    $school_desc=$_POST['sdesc'];
    $db_host=$_POST['dbhost'];
    $db_nam=$_POST['dbname'];
    $db_use=$_POST['dbuser'];
    $db_pas=$_POST['dbpass'];
    $admin_user=$_POST['auser'];
    $admin_pass=$_POST['apass'];
    $file="../prunner/vars.php";
    $fh=fopen($file,'w');
    $string="<?php &amp;host_name='$db_host'; &amp;db_name='$db_nam'; &amp;db_user='$db_use'; &amp;db_pass='$db_pas'; &amp;school_name='$school_nam'; &amp;school_desc='$school_desc'?>";
    $writeit=fwrite($fh,$string);
    if(!$writeit){
        echo "Some Files Missing Contact Us";
        echo "<FORM> ";
    echo "<INPUT type='button' value='Close Window' onClick='window.close()'> ";
    echo "</FORM>"; 
    }
    else{
        echo "File Writing Successfully Now You Will Be Redirected To Step 2";
    }
    fclose($fh);
    &amp; replace in $ sign any way to replace then please make this script correct and post it so i can easily do this work

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    suggest you build your string sequentially then examines the value of Sstring
    this will help you understand precisely where the scirpt is failing

    eg

    $string = "<?php &amp;";
    $string .= "host_name='$db_host';&amp;";
    $string .= "db_name='$db_nam'; &amp;";
    $string .= "db_user='$db_use'; &amp;";
    $string .= "db_pass='$db_pas'; &amp;";
    $string .= "school_name='$school_nam'; &amp;";
    $string .= "school_desc='$school_desc';";
    $string .= " ?>";

    however my suspisicion is that the PHP parser will not like the <php at the start of $string and the ?> may tell PHP to stop parsing any further code as PHP

    again developoing better debugging skills will help you identify where the fault is being reported
    $writeit=fwrite($fh,$string);
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2008
    Location
    pakistan
    Posts
    109
    Thanks dude

Posting Permissions

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