PDA

View Full Version : Naughty question


arkum
01-16-2007, 02:56 PM
Ok, it's not about actionscript, but the backend forums seem to have about a post a week and I don't have a week.

Was passing a var to my php script from flash and asigning the value to a var in php. Everything was working fine. Now I have decided to hard code the value into the php script, but this causes the script to fail.

Ok,

so if I use:

Code:

$myFileFull = "body_text/".$myFileName;

it works fine, but if I use:

$myFilePath = "body_text/";
$myFileFull = $myFilePath.$myFileName;

It fails. This makes no sense to me.

Please can anybody see what I'm doing wrong?

theelephantwords
01-16-2007, 03:10 PM
<?php
$myFilePath = "body_text/";
$myFileName = "yeah!";
$Q = $_POST["Q"];
$myFileFull = $myFilePath.$myFileName.$Q;
echo "&toflash=".$myFileFull;
?>


what happens if you do that?

CyanBlue
01-16-2007, 03:11 PM
Um... How naughty of you... Just because Server side scripting forum does not have good traffic, that does not give you right to post your question to wherever you want... You should really go to the PHP forum to ask that question then... :p

What you are asking does not make sense to me...
Let's do a quick test by adding an echo() function at the end... Run two scripts and copy and paste the output for us...
$myFileFull = "body_text/" . $myFileName;
echo("myFileName = " . $myFileName . "<br>");
echo("myFileFull = " . $myFileFull . "<br>");
$myFilePath = "body_text/";
$myFileFull = $myFilePath.$myFileName;
echo("myFilePath = " . $myFilePath . "<br>");
echo("myFileName = " . $myFileName . "<br>");
echo("myFileFull = " . $myFileFull . "<br>");

arkum
01-23-2007, 10:13 AM
Hi Cyan Blue,

It's really odd. My scripts work ok when called from a swf, but if I load the page in a browser, even the simplest echo fails and most scripts just display part of the code, not the output.

Anyway, thanks for replying

CyanBlue
01-23-2007, 01:36 PM
Well... The only time when it would happen is when you have some naughty thing going on your server... :D
You are sure that the server has the PHP installed, right??? Do you have an URL where I can see it???

Cota
01-23-2007, 02:02 PM
if its displaying parts of code, then you have a missing " somewhere, or a missing "." Generally, those are the causes of echo's displaying code. Also, make sure your server has more than just php3 installed on it.

arkum
01-23-2007, 03:33 PM
Hello,

I'm running php5 on my laptop (macpro). Can't work it out.
If I try to open the below code in a browser, I get:

' . $msg . ''; echo $out; ?>,

output to my browser, but if I run it from flash it works like a dream.



<?php

$xml = '';
$xmlfile = "pages/downloads/xml/downloads.xml";
$content = file_get_contents('php://input');
$targetFile;
$msg;
$out;

if ($content !== false) {
if(file_exists($xmlfile)) {
$msg = 'Exists';
if(is_writable($xmlfile)) {
$msg .= '_isWritable';
if (!$targetFile = fopen($xmlfile, 'w+')){
$msg .= "_can't be opened";
}else{
if(fwrite($targetFile, $content) === FALSE){
$msg .= "_can't be written";
}else{
$msg .= '_isWritten';
}
}
}else{
$msg .= '_is not writable';
}
}else{
$msg = "Doesn't Exist";
}
}else{
$msg = "Couldn't open stream";
}

$out = '<message>' . $msg . '</message>';

echo $out;

?>