Jump to content

2 in 1 variabe questions


blueman378

Recommended Posts

ok i am trying to declare this variable:

$owner = "$_SESSION['reguname']";

but it in itself is causing problems can anyone tell me why?

th error is

faultCode0faultStringParse error:syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/register.php on line 47

 

it is part of the code that does this :

/**make the user folder*/
mkdir ("/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/users/".$_SESSION['reguname'], 0777);
echo "Folder ".$_SESSION['reguname']." created \n";


/** make the user page*/
fopen ("/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/users/".$_SESSION['reguname']."/index.php", 'w', 0777);
echo "file created \n";


/** write to the file */
$your_data = "<?php $owner = "$_SESSION['reguname']"; include('../../userindex.php'); ?>";

// Open the file and erase the contents if any
$fp = fopen("/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/users/".$_SESSION['reguname']."/index.php", "w");

// Write the data to the file
fwrite($fp, $your_data);

// Close the file
fclose($fp);

echo "page code wrote \n";

 

$_SESSION['reguname']

is assigned its value earlier on.

,

once this problem is solved if i need it i will ask my other question.

 

thanks for your help

Link to comment
Share on other sites

ok i got it to work now just had to play around with the quotes its:

$your_data = '<?php $owner = $_SESSION["reguname"]; include("../../userindex.php"); ?>';

 

now my second question is it states : $owner = $_SESSION["reguname"]; now how would i go about making it so that rather than acctually writing that out, it writes out the value of $_SESSION["reguname"]?

 

thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.