Jump to content

Archived

This topic is now archived and is closed to further replies.

xyn

Unexpected '{'

Recommended Posts

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)
[color=red]{[/color]//LINE6
echo('license renew');
}
else
{
echo('fine');
}
?>

Share this post


Link to post
Share on other sites
You are missing a ")" at the end of the if.
if(!is_writable($host_dir/$host_lang/$panel_id)[color=red])[/color]

Orio.

Share this post


Link to post
Share on other sites
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.
[code=php:0]<?PHP
if(!file_exists('$host_dir/$host_lang/$panel_id'))
{
  @rmdir('./panel');
  echo ('Please contact our administration team');
}
?>[/code]

Share this post


Link to post
Share on other sites
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:

[code]
if(!file_exists("$host_dir/$host_lang/$panel_id"))
[/code]

example:

[code]
<?php
$test = 'hello world';

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

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

Share this post


Link to post
Share on other sites

×

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.