Jump to content

l95theses

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

l95theses's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This is my script that is not finishing, and I'm getting error code for the credit card transaction part where is commented by ~'s <?php $link = mysql_connect("***", "***", "***") or die(mysql_error()); mysql_select_db("***") or die(mysql_error()); $sql = "SHOW TABLES FROM ***"; $result = mysql_query($sql); echo "<center><table border='1' background=bg.gif width=390>"; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $date = date("n/j/Y"); $time = 12; $date2 = explode("/",$date); $dateday = ($date2[1]-1); while ($row = mysql_fetch_row($result)) { $checker = explode("_",$row[0]); $checker = $checker[0]; if($checker!="backup") { if($row[0]!="login" & $row[0]!="login2") { $rowboat = str_replace("543210","-",$row[0]); $rowboat = str_replace("_","/",$rowboat); $rowboat = str_replace("012345"," ",$rowboat); $rowboat2 = explode("-",$rowboat); $rowboat2 = $rowboat2[1]; $rowboat3 = explode("/",$rowboat2); if($dateday==$rowboat3[1] & $time>=12 & $date2[0]==$rowboat3[0] & $date2[2]==$rowboat3[2]) { // get users to send to next function and amounts // ~~~~~ Declaring variables.. ~~~~~ $result5 = mysql_query("SELECT * FROM $row[0]"); $row5 = mysql_fetch_array($result5) or die(mysql_error()); $result2 = mysql_query("SELECT * FROM $row[0] WHERE courseid='lookhere'"); $row2 = mysql_fetch_array($result2) or die(mysql_error()); $fields = mysql_list_fields("***", $row[0], $link); $count = mysql_num_fields($fields); $current = $row['current']; // ~~~~~ end declaration for ( $counter = 6; $counter <= ($count-1); $counter += 1) { $spliter = mysql_field_name($fields, $counter); $spliter2 = str_replace("_",":",$spliter); $amount3 = mysql_query("SELECT * FROM login WHERE login='$row2[$spliter]'"); $amount2 = mysql_fetch_array($amount3) or die(mysql_error()); $amount = $amount2['current_bid']; if(isset($row2[$spliter])) { // clearing current bids out of user's accounts mysql_query("UPDATE login SET current_slot=NULL WHERE login='$row2[$spliter]'") or die(mysql_error()); mysql_query("UPDATE login SET current_bid=NULL WHERE login='$row2[$spliter]'") or die(mysql_error()); mysql_query("UPDATE login SET current_course=NULL WHERE login='$row2[$spliter]'") or die(mysql_error()); // credit card transactions for everyone in the closing course. //-- using our $amount2 variable that is an array to grab personal information to submit to the credit card query. $ccnumber = $amount2['ccnumber']; $expdate = $amount2['expdate']; $cardcode = $amount2['cardcode']; $firstname = $amount2['firstname']; $lastname = $amount2['lastname']; $address = $amount2['address']; $city = $amount2['city']; $state = $amount2['state']; $zip = $amount2['zip']; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $cap = array(); $cap['x_login'] = "***"; $cap['x_tran_key'] = "***"; $cap['x_version'] = "3.1"; $cap['x_delim_char'] = "|"; $cap['x_delim_data'] = "TRUE"; $cap['x_test_request'] = "FALSE"; $cap['x_relay_response'] = "FALSE"; $cap['x_type'] = "AUTH_ONLY"; $cap['x_method'] = "CC"; $cap['x_relay_response'] = "FALSE"; $cap['x_card_num'] = "4007000000027"; $cap['x_exp_date'] = "0309"; $cap['x_card_code'] = "123"; $cap['x_amount'] = "1.20"; $cap['x_first_name'] = "John"; $cap['x_last_name'] = "Smith"; $cap['x_address'] = "1234 West Main St."; $cap['x_city'] = "Some City"; $cap['x_state'] = "CA"; $cap['x_zip'] = "12345"; foreach( $cap as $key => $value ) $fields .= "$key=" . urlencode( $value ) . "&"; //////////////////////////////////////////////////// $ch = curl_init("https://test.authorize.net/gateway/transact.dll"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim( $fields, "& " )); $resp = curl_exec($ch); curl_close ($ch); //////////////////////////////////////////////////// $resp = explode("|",$resp); if ($resp[3]=="This transaction has been approved.") { echo "<table border=1><tr><td>Approved</td></tr></table>"; } else { echo "<table border=1><tr><td>".$resp[3]."</td></tr></table>"; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // end credit card transactions // last thing to do is to rename the table so it's closed on the website. if($counter <= ($count-1)) { $newname = "backup_".$row[0]; mysql_query("RENAME TABLE $row[0] TO $newname") or die(mysql_error()); echo "we renamed the table too"; } } } echo "</table>"; } echo "<table border=1><tr><td>"; echo "<a href=spliter.php?course=".$row[0].">".$rowboat."</a>"; echo ", <a href=spliteram.php?course=".$row[0].">am</a>"; echo ", <a href=spliterpm.php?course=".$row[0].">pm</a>"; echo "</td></tr></table>"; } } } echo "anything after that loop is not executing causing some problems with the credit card script. I don't know why."; echo "also I don't want static variables to be used after the loop. So I can't just end the php tag and start a new one."; ?>
  2. <?php $link = mysql_connect("***", "***", "***") or die(mysql_error()); mysql_select_db("***") or die(mysql_error()); $sql = "SHOW TABLES FROM ***"; $result = mysql_query($sql); echo "<center><table border='1' background=bg.gif width=390>"; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $date = date("n/j/Y"); $time = 12; $date2 = explode("/",$date); $dateday = ($date2[1]-1); while ($row = mysql_fetch_row($result)) { $checker = explode("_",$row[0]); $checker = $checker[0]; if($checker!="backup") { if($row[0]!="login" & $row[0]!="login2") { $rowboat = str_replace("543210","-",$row[0]); $rowboat = str_replace("_","/",$rowboat); $rowboat = str_replace("012345"," ",$rowboat); $rowboat2 = explode("-",$rowboat); $rowboat2 = $rowboat2[1]; $rowboat3 = explode("/",$rowboat2); if($dateday==$rowboat3[1] & $time>=12 & $date2[0]==$rowboat3[0] & $date2[2]==$rowboat3[2]) { // get users to send to next function and amounts // ~~~~~ Declaring variables.. ~~~~~ $result5 = mysql_query("SELECT * FROM $row[0]"); $row5 = mysql_fetch_array($result5) or die(mysql_error()); $result2 = mysql_query("SELECT * FROM $row[0] WHERE courseid='lookhere'"); $row2 = mysql_fetch_array($result2) or die(mysql_error()); $fields = mysql_list_fields("***", $row[0], $link); $count = mysql_num_fields($fields); $current = $row['current']; // ~~~~~ end declaration for ( $counter = 6; $counter <= ($count-1); $counter += 1) { $spliter = mysql_field_name($fields, $counter); $spliter2 = str_replace("_",":",$spliter); $amount3 = mysql_query("SELECT * FROM login WHERE login='$row2[$spliter]'"); $amount2 = mysql_fetch_array($amount3) or die(mysql_error()); $amount = $amount2['current_bid']; if(isset($row2[$spliter])) { // clearing current bids out of user's accounts mysql_query("UPDATE login SET current_slot=NULL WHERE login='$row2[$spliter]'") or die(mysql_error()); mysql_query("UPDATE login SET current_bid=NULL WHERE login='$row2[$spliter]'") or die(mysql_error()); mysql_query("UPDATE login SET current_course=NULL WHERE login='$row2[$spliter]'") or die(mysql_error()); // credit card transactions for everyone in the closing course. //-- using our $amount2 variable that is an array to grab personal information to submit to the credit card query. $ccnumber = $amount2['ccnumber']; $expdate = $amount2['expdate']; $cardcode = $amount2['cardcode']; $firstname = $amount2['firstname']; $lastname = $amount2['lastname']; $address = $amount2['address']; $city = $amount2['city']; $state = $amount2['state']; $zip = $amount2['zip']; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $cap = array(); $cap['x_login'] = "***"; $cap['x_tran_key'] = "***"; $cap['x_version'] = "3.1"; $cap['x_delim_char'] = "|"; $cap['x_delim_data'] = "TRUE"; $cap['x_test_request'] = "FALSE"; $cap['x_relay_response'] = "FALSE"; $cap['x_type'] = "AUTH_ONLY"; $cap['x_method'] = "CC"; $cap['x_relay_response'] = "FALSE"; $cap['x_card_num'] = "4007000000027"; $cap['x_exp_date'] = "0309"; $cap['x_card_code'] = "123"; $cap['x_amount'] = "1.20"; $cap['x_first_name'] = "John"; $cap['x_last_name'] = "Smith"; $cap['x_address'] = "1234 West Main St."; $cap['x_city'] = "Some City"; $cap['x_state'] = "CA"; $cap['x_zip'] = "12345"; foreach( $cap as $key => $value ) $fields .= "$key=" . urlencode( $value ) . "&"; //////////////////////////////////////////////////// $ch = curl_init("https://test.authorize.net/gateway/transact.dll"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim( $fields, "& " )); $resp = curl_exec($ch); curl_close ($ch); //////////////////////////////////////////////////// $resp = explode("|",$resp); if ($resp[3]=="This transaction has been approved.") { echo "<table border=1><tr><td>Approved</td></tr></table>"; } else { echo "<table border=1><tr><td>".$resp[3]."</td></tr></table>"; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // end credit card transactions // last thing to do is to rename the table so it's closed on the website. if($counter <= ($count-1)) { $newname = "backup_".$row[0]; mysql_query("RENAME TABLE $row[0] TO $newname") or die(mysql_error()); echo "we renamed the table too"; } } } echo "</table>"; } echo "<table border=1><tr><td>"; echo "<a href=spliter.php?course=".$row[0].">".$rowboat."</a>"; echo ", <a href=spliteram.php?course=".$row[0].">am</a>"; echo ", <a href=spliterpm.php?course=".$row[0].">pm</a>"; echo "</td></tr></table>"; } } } ?> this is more like what I need to do. I need it for credit card transmission and it's giving me this error. (13) The merchant login ID or password is invalid or the account is inactive.
  3. I have a php script that goes through a mysql database and checks to see if there is a time placed in a mysql field. This seems to work, except at the end of the php script. If I put anything at the end of this script, does not execute the rest of it. Only the parts within the loop are finished. I can't for the life of me figure out this problem. Here is my script. <?php $courseid = "salad5432101_1_2008"; $link = mysql_connect("***", "***", "***") or die(mysql_error()); mysql_select_db("golf") or die(mysql_error()); $result = mysql_query("SELECT * FROM $courseid"); $row = mysql_fetch_array($result) or die(mysql_error()); $result2 = mysql_query("SELECT * FROM $courseid WHERE courseid='lookhere'"); $row2 = mysql_fetch_array($result2) or die(mysql_error()); $fields = mysql_list_fields("golf", $courseid, $link); $counts = mysql_num_fields($fields); $current = $row['current']; $rowboat = str_replace("543210","-",$courseid); $rowboat = str_replace("_","/",$rowboat); $rowboat = str_replace("012345"," ",$rowboat); $increase2 = 0; $increase2t = 0; $increase = 0; echo "<font size=4><b>Golf Course Tee Times Bid Confirmation</b><br><font size=3><b>".$rowboat."</b><br>"; echo "<table border=1><tr><td><b>Tee time</b></td><td><b>Bidder's Login</b></td><td><b>Full Name</b></td><td><b>Email</b></td><td><b>Address</b></td><td><b>City</b></td><td><b>Zip</b></td><td><b>Phone</b></td><td><b>Amount paid</b></td><td><b>Increase Amount %50</b></td></tr>"; for ( $counter = 6; $counter <= ($counts-1)aa; $counter += 1) { $spliter = mysql_field_name($fields, $counter); $spliter2 = str_replace("_",":",$spliter); $amount3 = mysql_query("SELECT * FROM login WHERE login='$row2[$spliter]'"); $amount2 = mysql_fetch_array($amount3) or die(mysql_error()); $amount = $amount2['current_bid']; if(isset($row2[$spliter])) { $increase = (($amount-$current)/2); $increase2t += (($amount-$current)/2); $increase2 += ($current+($increase)); echo "<tr><td>".$spliter2."</td><td>".$row2[$spliter]."</td><td>".$amount2['firstname'].$amount2['lastname']."</td><td>".$amount2['email']."</td><td>".$amount2['address']."</td><td>".$amount2['city']."</td><td>".$amount2['zip']."</td><td>".$amount2['phone']."</td><td>".$amount."</td><td>".$increase."</td></tr>"; } } echo "Hey Jude2"; ?>
  4. I'm able to get the $itemg to be a recognized variable to check for, but when i try to change the $ceitem1_array items into a dynamic variable and make it like this $itemg2 = "citem" . $itemnum2 . "_array[0]"; that doesn't work becuase it never seems to evaluate true. This is the loop snippet of code that i wrote that works correctly. while ( $itemnum < 20 ) { if ( $$itemg == $citem1_array[0] ) { echo "$citem1_array[1] - $citem1_array[2]"; echo "<br>"; } $itemnum = $itemnum + 1; $itemg = "item" . $itemnum; }
  5. im trying to change the citem in increments untill all of the citems have been checked, so that every item that i have in inventory is gone through, here is the full php doc. <html><body><embed src=retail.swf height=100% width=100% wmode=transparent></body></html> <?php $citem2_array[0] = "1"; $citem2_array[1] = "Zephyrhills Spring water"; $citem2_array[2] = "$1.79"; $citem1_array[0] = "2"; $citem1_array[1] = "Kombucha Wonder Drink"; $citem1_array[2] = "$1.59"; $citem3_array[0] = "3"; $citem3_array[1] = "Chocolate Rice Dream Drink"; $citem3_array[2] = "$1.88"; $totalinv = 4; $totalitems = $_POST['n1']; $item1 = $_POST['item1']; $item2 = $_POST['item2']; $item3 = $_POST['item3']; $item4 = $_POST['item4']; $item5 = $_POST['item5']; $item6 = $_POST['item6']; $item7 = $_POST['item7']; $item8 = $_POST['item8']; $item9 = $_POST['item9']; $item10 = $_POST['item10']; $item11 = $_POST['item11']; $item12 = $_POST['item12']; $item13 = $_POST['item13']; $item14 = $_POST['item14']; $item15 = $_POST['item15']; $item16 = $_POST['item16']; $item17 = $_POST['item17']; $item18 = $_POST['item18']; $item19 = $_POST['item19']; $item20 = $_POST['item20']; $itemnum = 0; while ( $itemnum < 20 ) { if ( $$itemg == $citem1_array[0] ) { echo "$citem1_array[1] - $citem1_array[2]"; echo "<br>"; } if ( $$itemg == $citem2_array[0] ) { echo "$citem2_array[1] - $citem2_array[2]"; echo "<br>"; } if ( $$itemg == $citem3_array[0] ) { echo "$citem3_array[1] - $citem3_array[2]"; echo "<br>"; } $itemnum = $itemnum + 1; $itemg = "item" . $itemnum; } ?>
  6. I'm trying to make this code dynamic so that I can decrease it by the number of items in the inventory, this is the static formula to that works, but I don't want to have to add this every time I have another item to check for. Help me to dynamically subtract one from the amount of items. PLEASE!!! thanks... if ( $$itemg == $citem1_array[0] ) { echo "$citem1_array[1] - $citem1_array[2]"; echo "<br>"; } if ( $$itemg == $citem2_array[0] ) { echo "$citem2_array[1] - $citem2_array[2]"; echo "<br>"; } if ( $$itemg == $citem3_array[0] ) { echo "$citem3_array[1] - $citem3_array[2]"; echo "<br>"; }
×
×
  • 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.