Jump to content

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');
}
?>
Link to comment
https://forums.phpfreaks.com/topic/24744-unexpected/
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]
Link to comment
https://forums.phpfreaks.com/topic/24744-unexpected/#findComment-112679
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]
Link to comment
https://forums.phpfreaks.com/topic/24744-unexpected/#findComment-112682
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.