Click to See Complete Forum and Search --> : Product Activation


Dquinney
02-15-2005, 05:10 PM
I need a script that will enable me to send a url such as;
http://dpank.com/pro-act/activation.php?UserName=TEST1&Serial=TEST2
and it will look to see if there is a file called TEST1 with TEST2 as the data inside if that is true it will some how say that else it will create the file named TEST1 with TEST2 as the data inside. TEST1 and TEST2 will be variable any probs email me @ dquinney@gmail.com

Thanks In Advance Daniel Quinney

ShrineDesigns
02-15-2005, 06:07 PM
example<?php
$dir = '/path/to/';

if(isset($_GET['user']) && isset($_GET['serial']))
{
if(file_exists($dir . $_GET['user']))
{
// ...
}
else
{
$fp = fopen($dir . $_GET['user'], 'wb');
fwrite($fp, $_GET['serial']);
fclose($fp);
}
}
?>

Dquinney
02-15-2005, 06:17 PM
i get the error

Warning: fopen(/pro-act/Admin): failed to open stream: No such file or directory in /home/dpank75/public_html/pro-act/new.php on line 12

Warning: fwrite(): supplied argument is not a valid stream resource in /home/dpank75/public_html/pro-act/new.php on line 13

Warning: fclose(): supplied argument is not a valid stream resource in /home/dpank75/public_html/pro-act/new.php on line 14

Dquinney
02-15-2005, 06:19 PM
<?php
$dir = '/pro-act/';

if(isset($_GET['user']) && isset($_GET['serial']))
{
if(file_exists($dir . $_GET['user']))
{
// ...
}
else
{
$fp = fopen($dir . $_GET['user'], 'wb');
fwrite($fp, $_GET['serial']);
fclose($fp);
}
}
?>

ShrineDesigns
02-15-2005, 09:27 PM
try using an absolute path /home/dpank75/public_html/pro-act/

Dquinney
02-16-2005, 03:09 AM
Also i need it to print 'Error' if there is a file already called USER1. Else prink 'Ok'
Thanks For The Help Daniel Quinney

ShrineDesigns
02-16-2005, 12:16 PM
replace // ...with exit('Error');after fclose($fp);add echo 'Ok';

Dquinney
02-16-2005, 12:23 PM
does'nt work always sayes 'error'
http://dpank.com/chicago/new.php?user=admin&serial=1478

ShrineDesigns
02-16-2005, 12:25 PM
try http://dpank.com/pro-act/activation.php?UserName=MrMaGoo&Serial=foobar

Dquinney
02-16-2005, 12:38 PM
it does not do any think any more,