Jump to content

JackWetson

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

JackWetson's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I didn't bother with default as the user won't even get to this page if product isnt set, other than that you think it should work?
  2. Hi All, Im using the below code to create basically a key depending on which product is bought, however the expiry keeps going back to the year 1967 or something like that. I cannot see anything wrong with my code. Can anyone advise where I am going wrong? <?php require_once('./class/paypal.php'); //when needed require_once('./class/httprequest.php'); //when needed //Use this form for production server //$r = new PayPal(true); //Use this form for sandbox tests $r = new PayPal(); $final = $r->doPayment(); if ($final['ACK'] == 'Success') { $key = sha1($_COOKIE['myusername']+microtime(true).mt_rand(10000,90000)); $user = $_COOKIE['myusername']; $host = "tXYZ"; // Host name $username = "XXXXX"; // Mysql username $password = "@sdasdasdasdU)J&4z[X!IT"; // Mysql password $db_name = "toasdasdas"; // Database name $tbl_name = "keys"; // Table name $product = $_COOKIE['product']; // Connect to server and select databse. mysql_connect("$host", "$username", "$password") or die("cannot connect"); mysql_select_db("$db_name") or die("cannot select DB"); $today = date("YYYY-MM-DD"); switch ($product) { case "Torn Buddy - 1 Year": { $timestamp = mktime(0,0,0,date("m"),date("d"),date("Y")+1); $expiry = date("Y-m-d",$timestamp); break; } case "Torn Buddy - 6 Months": { $timestamp =mktime(0,0,0,date("m")+6,date("d"),date("Y")); $expiry = date("Y-m-d",$timestamp); break; } case "Torn Buddy - 3 Months": { $timestamp =mktime(0,0,0,date("m")+3,date("d"),date("Y")); $expiry = date("Y-m-d",$timestamp); break; } case "Torn Buddy - 1 Month": { $timestamp =mktime(0,0,0,date("m")+1,date("d"),date("Y")); $expiry = date("Y-m-d",$timestamp); break; } case "Torn Buddy - 3 Day": { $timestamp =mktime(0,0,0,date("m"),date("d")+3,date("Y")); $expiry = date("Y-m-d",$timestamp); break; } } $expiry = date("YYYY-MM-DD", $timestamp); $sql = "INSERT INTO `keys` (`User` ,`Key` ,`Type` ,`Start` ,`End` ,`InUse`) VALUES ('$user', '$key', '$product', '$today', '$expiry', '0')"; mysql_query($sql); } ?> .... more code
  3. Because I had already tried that, that was why! Thank you for the fix, I was obviously just over-complicating the solution!
  4. But i want to put the contents of $line into the text area so i can edit the contents, not just print it to the screen!
  5. Hi Guys, Im trying to load the contents of an html file into a text area for editing, this is the code I have so far but it doesnt seem to be working. I think it's because some of the $line have "" etc in them which is messing it up, any help/advice is greatly appreciated. I've also commented out some things i've tried and didnt work! $handle = fopen("".$tmpfile, 'r'); $lines = file($tmpfile); echo '<form method="post" name="box" action="">'; echo '<textarea name="codebox"></textarea>'; echo '</form>'; foreach ($lines as $line_num => $line) { //$line = htmlentities($line,ENT_QUOTES); //echo $line; print("<script language = 'javascript'>alert(".''.$line.");</script>"); //Typical Line <html xmlns="http://www.w3.org/1999/xhtml"> // echo "<script language = 'javascript'>var newtext = "."'".$line."'"."; document.box.codebox.value += 'newtext'; </script>"; // echo "". htmlspecialchars($line) . "<br />\n"; } fclose($handle);
×
×
  • 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.