Jump to content


Photo

Unexpected '{'


  • Please log in to reply
3 replies to this topic

#1 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 22 October 2006 - 02:20 PM

hey guys,
I'm trying to make a license thing, where i store a product ID,
in my database and a product id in a directory, then i use
chmodd to check the license.

Basically when they user purchases a product when the payment
is accepted via paypal i make a random ID, which then saves into
a database, then i make a file called 'product_RANDOMID.txt' this
is then saved in my clients directory, on their site everytime they
use the main config (always used) it will check my site for their file
and if the chmodd = 0000 the license needs renewing, or if the file
doesnt exist they get they panel deleted.

Focusing on the CHMODD first, My problem is unexpected '{' on line 6.
my code:
<?php
$host_dir = 'http://www.MYURL.co.uk';
$host_lang = 'en';
$panel_id = 'dpanel_1234567.txt'; //their code
if(!is_writable($host_dir/$host_lang/$panel_id)
{//LINE6
echo('license renew');
}
else
{
echo('fine');
}
?>

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 22 October 2006 - 02:25 PM

You are missing a ")" at the end of the if.
if(!is_writable($host_dir/$host_lang/$panel_id))

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 22 October 2006 - 02:38 PM

I have another problem with the other aprt now:
basically if they install the product in a folder called
'panel' and i deleted their file from my website, i wanted
their panel to get removed, the following code doesn't
work.
<?PHP
if(!file_exists('$host_dir/$host_lang/$panel_id'))
{
   @rmdir('./panel');
   echo ('Please contact our administration team');
}
?>


#4 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 22 October 2006 - 03:25 PM

the problem with your code is that the error suppressor (@) makes it hard to see what's going on in the event of something going wrong. remove it for the time being and try it again to see what error you're getting, if any.

also, variables contained within single quotes will not be parsed. so you need to change your 'if' line to use double quotes:

if(!file_exists("$host_dir/$host_lang/$panel_id"))

example:

<?php
$test = 'hello world';

echo '$test'; // outputs: $test

echo "$test"; // outputs: hello world
?>

"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users