thomas_smith Posted January 1, 2010 Share Posted January 1, 2010 Hi! I am trying to create a trial of my php script for 7 days. What php code can I use so that in 7 days the user will be directed to my payment page. I know that there already is code that will expire the script on a certain day. Well looking forward to your responses. thomas Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 1, 2010 Share Posted January 1, 2010 I'm not aware of a method without using an encoding software, such as Zend or CodeCop. If you want to risk the (albeit minute) possibility of them cracking your code, you can encode it in base64 (base64_encode, base64_decode (including the 'expiry date') and use eval. $code = "BBCCAA44FF[...]"; //whatever you encoded with base64_encode() eval(base64_decode($code)); //Run the encoded code, including expiry section Quote Link to comment Share on other sites More sharing options...
thomas_smith Posted January 1, 2010 Author Share Posted January 1, 2010 I'm not aware of a method without using an encoding software, such as Zend or CodeCop. If you want to risk the (albeit minute) possibility of them cracking your code, you can encode it in base64 (base64_encode, base64_decode (including the 'expiry date') and use eval. $code = "BBCCAA44FF[...]"; //whatever you encoded with base64_encode() eval(base64_decode($code)); //Run the encoded code, including expiry section Ya right now I am using SourceCop and had little to no response from them so I had to look around. They posted something like this: if(date("Y-m-d")>="2005-11-11"){ header("Location: error.php"); exit(); } Hope this helps... thomas Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 1, 2010 Share Posted January 1, 2010 You can use this code, sourcecop encodes it right? Then it should expire at the date you specify. You may want to replace date() with $date='xx/yy/zz'.. if you wish to test if your code works (on the odd case your expiry does not function, to be safe) Quote Link to comment Share on other sites More sharing options...
thomas_smith Posted January 1, 2010 Author Share Posted January 1, 2010 You can use this code, sourcecop encodes it right? Then it should expire at the date you specify. You may want to replace date() with $date='xx/yy/zz'.. if you wish to test if your code works (on the odd case your expiry does not function, to be safe) any way i can expire it in 7 days? Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 1, 2010 Share Posted January 1, 2010 There's no way to tell it to expire in 7 days, unless you enter the current date into an SQL database, and base the activated date on that. If you don't it'll just keep upping date() one day each time it's executed. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.