djdellux Posted December 2, 2008 Share Posted December 2, 2008 within this code are certin select statements that will not run in MYSQL... i am not sure where they are being that i am not familiar with sql... the have the wrong syntax so im told. could anyone please look thru this and let me know what im not seeing???? thx dellux <?php //custmain.php $HTTP_HOST = HTMLSpecialChars(getenv("HTTP_HOST")); require("globals.php"); //start timer $mtime = explode(" ", microtime()); $mtime = $mtime[1] + $mtime[0]; $StartTime = $mtime; $SecLev = 'Cust'; //LogIt('custmain', 'desc', 'demo', 'cust'); $vars = array(array('Company', 1, 3, 1), array('SlpnNo', 0, 10, 1), array('SupvsrNo', 0, 10, 1), array('PassWd', 0, 15, 1), array('MD5', 0, 32, 0), array('CustNo', 1, 10, 1), array('subForm', 0, 1, 1), array('JobNo', 0, 10,1) ); include('regvars.inc.php'); $SERVER_SOFTWARE = HTMLSpecialChars(getenv('SERVER_SOFTWARE')); $REMOTE_ADDR = HTMLSpecialChars(getenv('REMOTE_ADDR')); if(empty($MD5)){$MD5 = ' ';} CheckLock($Company, 0); if(!Authenticate($PassWd, $SlpnNo, $CustNo, $Company, $SecLev, &$PassExpDays, &$MD5)) { if(substr($REMOTE_ADDR,0,7) != '192.168' and $REMOTE_ADDR != '209.205.32.98' or $LOCALALERTS) { LogFailure('Module: custmain.', $CustNo, $PassWd); TrackFail($CustNo, $PassWd, 'cust', $Company); } switch($Company) { case 'ATL': $errComp = 'Paragon Atlantic'; $errLink = 'paragonatlantic'; break; case 'CSE': $errComp = 'Canadian Servo & Electronics'; $errLink = 'cdnservo'; break; case 'PTI': $errComp = 'Paragon Technologies'; $errLink = 'paragontech'; break; default: $errComp = 'NONE'; break; } if(strtolower($_SERVER['HTTP_HOST']) == 'custweb.diversetechnologiesgroup.com') { $errComp = 'Diverse Technologies Group'; $errLink = 'diversetechnologiesgroup'; } $errMess = 'Your login failed! <br /><br /> <span style="font-size: smaller;">What could have gone wrong?</span><br /> <ul style="font-size: 12px; font-weight: normal; list-style: circle"> <li>Did you select the proper company to log into? (You chose <strong>"' . $errComp . '"</strong>)</li> <li>Did you mistype your customer code? (You typed <strong>"' . $CustNo . '"</strong>)</li> <li>Your session may have expired. Try to <a href="http://www.' . $errLink . '.com/lookup.php?custno=' . $CustNo . '">log back in</a>. </li> <li>Did you mistype your password?</li> <li>Are you setup to log in online? You need to call customer service to initially setup your account.</li> <li>Do you have a customer code? If you do not, you will need to contact customer service to have an account created.</li> <li>Contact infomation can be found <a href="http://www.' . $errLink . '.com/contact.htm">here</a></li> </ul> '; ErrorPage(2, $errMess); exit; } //clear any bad attempts we have logged for this company TrackFail($CustNo, '', 'cust', $Company, 1); //if a jobno is passed, redirect to the jobform if(!empty($JobNo)) { //$QUERY_STRING = getenv('QUERY_STRING'); $queryString = 'Company=' . $Company . '&MD5=' . $MD5 . '&CustNo=' . $CustNo . '&JobNo=' . $JobNo . '&link=1'; header('Location: jobquery.php?' . $queryString); exit; } $Demo = 0; if($CustNo == 'DEMO') { $Demo = 1; } $Select = 'SELECT cCompany FROM jobtrack!cust WHERE cCustNo == "' . $CustNo . '"'; $data = MakeSelect($Select, $Company); $cCompany = trim($data[0][0]); $PageTitle = 'Customer Page for ' . $cCompany; SendHeaders($PageTitle); echo '<div class="custhead">'; SearchBox(); echo $PageTitle; echo '</div>' . "\n"; include('custnavbar.php'); switch($Form) { case 'YourInfo': YourInfo($CustNo, $Company); break; case 'YourHistory': YourHistory(); break; case 'YourWarr': YourWarr($CustNo, $Company, $StartTime); break; case 'Options': Options($CustNo, $Company, $StartTime, $SlpnNo, $SupvsrNo); break; default: YourInfo($CustNo, $Company); break; } function Options($custNo, $company, $startTime, $slpnNo) { global $MD5; global $SlpnNo; global $SupvsrNo; $HTTP_HOST = getenv('HTTP_HOST'); $select = 'SELECT cust.lDispOption, cust.lautofax, cust.lautoemail, cust.lhtmlemail, cust.csupptype FROM jobtrack!cust WHERE cust.cCustNo == "' . $custNo . '"'; $SQLData = ''; $data = MakeSelect($select, $company); $DispOption = $data[0][0]; $faxOption = $data[0][1]; $emailOption = $data[0][2]; $htmlEmails = $data[0][3]; $supptype = $data[0][4]; $conChecked = ''; $expChecked = ''; $faxChecked = ''; $emailChecked = ''; $noneChecked = ''; $htmlEmailsChecked = ''; $nonHtmlEmailsChecked = ''; $checkStr = ' checked="checked"'; if($DispOption) { $conChecked = $checkStr; } else { $expChecked = $checkStr; } if($faxOption) { $faxChecked = $checkStr; } elseif($emailOption) { $emailChecked = $checkStr; } else { $noneChecked = $checkStr; } if($htmlEmails) $htmlEmailsChecked = $checkStr; else $nonHtmlEmailsChecked = $checkStr; //Change display format echo '<br />'; echo '<div class="custoptionblockborder">'; echo '<div class="custoptionblockhead">Change Display Format</div>'; echo '<div class="custoptionblock">'; echo '<form action="/php/options.php" method="post">' . "\n"; echo '<br />' . "\n"; echo 'Your online reports are now available in two formats; condensed and expanded.<br />' . "\n"; echo 'The condensed reports display more data in a smaller area. This is well suited for<br />' . "\n"; echo 'customers with a higher number of repairs in house. <br />Your account defaults to the expanded version.<br /><br />' . "\n"; echo 'Format:<br />' . "\n"; echo '<input type="hidden" name="option" value="LDISPOPTION" />' . "\n"; echo '<input type="radio" name="value" value="T" ' . $conChecked . ' />Condensed<br />' . "\n"; echo '<input type="radio" name="value" value="F" ' . $expChecked . ' />Expanded<br /><br />' . "\n"; echo '<input type="submit" value="Save Changes" />' . "\n"; echo '<input type="hidden" name="CustNo" value="' . urlencode($custNo) . '" />' . "\n"; echo '<input type="hidden" name="MD5" value="' . $MD5 . '" />' . "\n"; echo '<input type="hidden" name="Company" value="' . $company . '" />' . "\n"; if(!empty($SlpnNo)) echo '<input type="hidden" name="SlpnNo" value="' . $slpnNo . '" />' . "\n"; if(!empty($SupvsrNo)) echo '<input type="hidden" name="SupvsrNo" value="' . $supvsrNo . '" />' . "\n"; echo '</form>' . "\n"; echo '</div></div>'; //Change reports delivery method echo '<div class="custoptionblockborder">'; echo '<div class="custoptionblockhead">Status Report Options</div>'; echo '<div class="custoptionblock">'; echo '<form action="/php/options.php" method="post">' . "\n"; echo '<br />' . "\n"; echo 'You choose how you receive your reports!<br /> Your status reports are available in three formats: email, fax or none at all.<br /><br />' . "\n"; echo 'Your account is currently set to: ' . "\n"; if($faxOption) { echo '<strong>Fax</strong>' . "\n"; } elseif($emailOption) { echo '<strong>Email</strong>' . "\n"; } else { echo '<strong>None</strong>' . "\n"; } echo '<br /><br />Format:<br />' . "\n"; echo '<input type="hidden" name="option" value="REPORTFORMAT" />' . "\n"; echo '<input type="radio" name="value" value="FAX" ' . $faxChecked . ' />Fax<br />' . "\n"; echo '<input type="radio" name="value" value="EMAIL" ' . $emailChecked . ' />E-Mail<br />' . "\n"; echo '<input type="radio" name="value" value="NONE" ' . $noneChecked . ' />No status reports<br /><br />' . "\n"; echo '<input type="submit" value="Save Changes" />' . "\n"; echo '<input type="hidden" name="CustNo" value="' . urlencode($custNo) . '" />' . "\n"; echo '<input type="hidden" name="MD5" value="' . $MD5 . '" />' . "\n"; echo '<input type="hidden" name="Company" value="' . $company . '" />' . "\n"; if(!empty($SlpnNo)) echo '<input type="hidden" name="SlpnNo" value="' . $slpnNo . '" />' . "\n"; if(!empty($SupvsrNo)) echo '<input type="hidden" name="SupvsrNo" value="' . $supvsrNo . '" />' . "\n"; echo '</form>' . "\n"; echo '</div></div>'; //Accept HTML emails? echo '<div class="custoptionblockborder">'; echo '<div class="custoptionblockhead">Accept HTML Emails</div>'; echo '<div class="custoptionblock">'; echo '<form action="/php/options.php" method="post">' . "\n"; echo '<br />' . "\n"; echo 'You can also choose the format of your email reports!<br /> Your email status reports are available in two display formats: Plain text or HTML.<br /> HTML is the default.<br /><br />' . "\n"; echo 'Your account is currently set to: ' . "\n"; if($htmlEmails) { echo '<strong>HTML</strong>' . "\n"; } elseif(!$htmlEmails) { echo '<strong>Plain Text</strong>' . "\n"; } echo '<br /><br />Email Format:<br />' . "\n"; echo '<input type="hidden" name="option" value="EMAILFORMAT" />' . "\n"; echo '<input type="radio" name="value" value="HTML" ' . $htmlEmailsChecked . ' />HTML<br />' . "\n"; echo '<input type="radio" name="value" value="PLAIN" ' . $nonHtmlEmailsChecked . ' />Plain Text<br />' . "\n"; echo '<br /><input type="submit" value="Save Changes" />' . "\n"; echo '<input type="hidden" name="CustNo" value="' . $custNo . '" />' . "\n"; echo '<input type="hidden" name="MD5" value="' . $MD5 . '" />' . "\n"; echo '<input type="hidden" name="Company" value="' . $company . '" />' . "\n"; if(!empty($SlpnNo)) echo '<input type="hidden" name="SlpnNo" value="' . $SlpnNo . '" />' . "\n"; if(!empty($SupvsrNo)) echo '<input type="hidden" name="SupvsrNo" value="' . $supvsrNo . '" />' . "\n"; echo '</form>' . "\n"; echo '</div></div>' . "\n"; /* apache 1 doesnt work with the ttf stuff :/ //Print Shipper echo '<br />' . "\n"; echo '<form action="/php/custshipper.php" method="get">' . "\n"; echo '<table summary="Print Shipper" class="infotable">' . "\n"; echo '<tr align="left" valign="bottom">' . "\n"; echo '<th style="color:maroon;">Print Shipper</th>' . "\n"; echo '</tr>' . "\n"; echo '<tr>' . "\n"; echo '<td style="text-align: left; padding: 5px;">' . "\n"; echo '<br />' . "\n"; echo 'You can print out a shipping label for packages destined for our repair facility.<br /><br />' . "\n"; echo 'Description: (optional)<br />' . "\n"; echo '<textarea wrap="soft" cols="30" rows="7" name="desc"></textarea><br /><br />' . "\n"; echo '<input type="submit" value="Print Shipper" />' . "\n"; echo '<input type="hidden" name="CustNo" value="' . $custNo . '" />' . "\n"; echo '<input type="hidden" name="MD5" value="' . $MD5 . '" />' . "\n"; echo '<input type="hidden" name="Company" value="' . $company . '" />' . "\n"; if(!empty($SlpnNo)) echo '<input type="hidden" name="Company" value="' . $slpnNo . '" />' . "\n"; if(!empty($SupvsrNo)) echo '<input type="hidden" name="SupvsrNo" value="' . $supvsrNo . '" />' . "\n"; echo '</td>' . "\n"; echo '</tr>' . "\n"; echo '</table>' . "\n"; echo '</form>' . "\n"; */ // Online RGA Form echo '<div class="custoptionblockborder">'; echo '<div class="custoptionblockhead">Create a RGA</div>'; echo '<div class="custoptionblock">'; echo '<form action="/php/rga.php" method="post">' . "\n"; echo '<br />' . "\n"; echo 'You can now start the warranty process online! <br /> Just enter a small amount of information to aid our technicians, <br /> and a RGA number will be automatically assigned.<br /><br />' . "\n"; //old job # echo 'Old Job #: (required)<br />' . "\n"; echo '<input type="text" name="oldJobNo" />' . "\n"; echo '<br /><br />' . "\n"; //email echo 'Your Email Address: (required)<br />' . "\n"; echo '<input type="text" name="email" />' . "\n"; echo '<br /><br />' . "\n"; //isolated ? echo 'Was the problem isolated with a known working unit? <br />' . "\n"; echo '<input type="checkbox" name="isolated" />' . "\n"; echo '<br /><br />' . "\n"; //Fail Mode? echo 'What was the failure mode?<br />' . "\n"; echo '<textarea cols="30" rows="4" name="failMode"></textarea>' . "\n"; echo '<br /><br />' . "\n"; //Cust assessment echo 'What is your assessment of the situation?<br />' . "\n"; echo '<textarea cols="30" rows="4" name="custAss"></textarea>' . "\n"; echo '<br /><br />' . "\n"; echo '<input type="submit" value="Submit" />' . "\n"; echo '<input type="hidden" name="CustNo" value="' . $custNo . '" />' . "\n"; echo '<input type="hidden" name="MD5" value="' . $MD5 . '" />' . "\n"; echo '<input type="hidden" name="Company" value="' . $company . '" />' . "\n"; if(!empty($SlpnNo)) echo '<input type="hidden" name="SlpnNo" value="' . $SlpnNo . '" />' . "\n"; if(!empty($SupvsrNo)) echo '<input type="hidden" name="SupvsrNo" value="' . $SupvsrNo . '" />' . "\n"; echo '</form>' . "\n"; echo '</div></div>' . "\n"; if(strtolower($_SERVER['HTTP_HOST']) != 'custweb.diversetechnologiesgroup.com') { echo '<div class="custoptionblockborder">'; echo '<div class="custoptionblockhead">Shipper</div>'; echo '<div class="custoptionblock">'; echo 'Create a shipper to document items being sent for repair<br /><br />'; echo '<form action="/php/custshipper.php" method="post">' . "\n" ; echo '<input name="MD5" type="hidden" value="' . $MD5 . '" />' . "\n" ; echo '<input name="Company" type="hidden" value="' . $company . '" />' . "\n" ; echo '<input name="CustNo" type="hidden" value="' . $custNo . '" />' . "\n" ; echo '<input type="submit" value="Create" />' . "\n" ; echo '</form>'; echo '</div></div>' . "\n"; } if($supptype == 'APPLIED') { echo '<div class="custoptionblockborder">'; echo '<div class="custoptionblockhead">Applied/Paragon Flyer</div>'; echo '<div class="custoptionblock">'; echo 'Create an Applied/Paragon Flyer.<br /><br />You can remove the header and footer from the printout by going to File->Page Setup In Internet Explorer.'; echo '<form action="/php/appliedflyer.php" method="get">' . "\n" ; echo '<input name="MD5" type="hidden" value="' . $MD5 . '" />' . "\n" ; echo '<input name="Company" type="hidden" value="' . $company . '" />' . "\n" ; echo '<input name="CustNo" type="hidden" value="' . $custNo . '" />' . "\n" ; echo '<input type="submit" value="Create" />' . "\n" ; echo '</form>'; echo '</div></div>' . "\n"; } } function YourWarr($custNo, $company, $startTime) { global $SERVER_SOFTWARE; global $HTTP_HOST; global $MD5; global $subForm; $top = ''; $demo = 0; if($custNo == 'DEMO') { $demo = 1; $top = 'TOP 5'; } $rgaTable = 'rga'; $jobTable = 'job'; if($subForm == 'WarrHistory') { $rgaTable = 'rgah'; $jobTable = 'jobh'; } $sqlData = ''; $cur = array(); $select = "SELECT $top $rgaTable.crgano, $rgaTable.coldjobno, $rgaTable.cnewjobno, $rgaTable.ccustcont, $rgaTable.lanother, $rgaTable.mntasmnt, $rgaTable.mntfail, $rgaTable.mntcmnt, $rgaTable.tcreate, $rgaTable.tchange, $jobTable.lwarrdet, $jobTable.din, $jobTable.dship FROM jobtrack!$rgaTable LEFT JOIN jobtrack!$jobTable ON $jobTable.cjobno == $rgaTable.cnewjobno" . "\n"; if($demo) { $select .= 'ORDER BY cRgaNo'; } else { $select .= "WHERE $rgaTable.cCustNo == \"" . $custNo . "\""; } $cur = MakeSelect($select, $company); if(sizeof($cur) == 0) { if($subForm == 'WarrHistory') { echo '<br /><div class="note" style="text-align: center">There are no history warranty repairs</div>' . "\n"; echo '<br />' . "\n"; } else { echo '<br /><div class="note" style="text-align: center">You do not have any warranty repairs at this time</div>' . "\n"; echo '<br />' . "\n"; } SendFooter($company, $startTime, $SERVER_SOFTWARE); exit; } echo '<table class="custmain" cellspacing="0" >' . "\n"; echo '<tr>' . "\n"; echo '<th class="custquery" style="text-align:center;">' . "\n"; echo 'RGA #</th>' . "\n"; echo '<th class="custquery" style="text-align:center;">' . "\n"; echo 'New Job #'; echo '</th>' . "\n"; echo '<th class="custquery" style="text-align:center;">' . "\n"; echo 'Old Job #'; echo '</th>' . "\n"; echo '<th class="custquery" style="text-align:center;">' . "\n"; echo 'Created'; echo '</th>' . "\n"; echo '<th class="custquery" style="text-align:center;">' . "\n"; echo 'Status'; echo '</th>' . "\n"; echo '</tr>' . "\n"; $loops = sizeof($cur); for($i = 0; $i < $loops; $i++) { $rgaNo = $cur[$i][0]; $oldJobNo = $cur[$i][1]; $newJobNo = $cur[$i][2]; $custCont = $cur[$i][3]; $createTD = $cur[$i][8]; $warrDet = $cur[$i][10]; $dateIn = $cur[$i][11]; $dateShipped = $cur[$i][12]; echo '<tr>' . "\n"; //rga # echo '<td style="text-align: right;">' . "\n"; echo '<a href="/php/rgaquery.php?' . '&WarrNo=' . trim($rgaNo) . '&CustNo=' . trim($custNo) . '&MD5=' . trim($MD5) . '&Company=' . trim($company); echo '">'; echo $rgaNo . '</a>' . "\n"; echo '</td>' . "\n"; //new job # if(empty($newJobNo)) { echo '<td style="text-align: right;">' . "\n"; echo 'None'; echo '</td>' . "\n"; } else { echo '<td style="text-align: right;">' . "\n"; echo '<a href="/php/jobquery.php?' . '&JobNo=' . trim($newJobNo) . '&CustNo=' . trim($custNo) . '&MD5=' . trim($MD5) . '&Company=' . trim($company); echo '" onmouseover="window.status=\'Click here for more information on ' . trim($newJobNo) . '\';return true;" onmouseout="window.status=\'\';return true;">'; echo $newJobNo . '</a>' . "\n"; echo '</td>' . "\n"; } //old job # if(empty($oldJobNo)) { echo '<td style="text-align: right;">' . "\n"; echo 'None'; echo '</td>' . "\n"; } else { echo '<td style="text-align: right;">' . "\n"; echo '<a href="/php/jobquery.php?' . '&JobNo=' . trim($oldJobNo) . '&CustNo=' . trim($custNo) . '&MD5=' . trim($MD5) . '&Company=' . trim($company); echo '" onmouseover="window.status=\'Click here for more information on ' . trim($oldJobNo) . '\';return true;" onmouseout="window.status=\'\';return true;">'; echo $oldJobNo . '</a>' . "\n"; echo '</td>' . "\n"; } //created echo '<td style="text-align: center;">' . "\n"; echo $createTD . "\n"; echo '</td>' . "\n"; //status echo '<td style="text-align: center;">' . "\n"; if($dateShipped and $dateShipped != '1899-12-30') { echo '<a href="/php/jobquery.php?' . '&JobNo=' . trim($newJobNo) . '&CustNo=' . trim($custNo) . '&MD5=' . trim($MD5) . '&Company=' . trim($company); echo '" onmouseover="window.status=\'Click here for more information on ' . trim($newJobNo) . '\';return true;" onmouseout="window.status=\'\';return true;">'; echo 'Shipped</a>' . "\n"; } elseif($warrDet) { echo '<a href="/php/jobquery.php?' . '&JobNo=' . trim($newJobNo) . '&CustNo=' . trim($custNo) . '&MD5=' . trim($MD5) . '&Company=' . trim($company); echo '" onmouseover="window.status=\'Click here for more information on ' . trim($newJobNo) . '\';return true;" onmouseout="window.status=\'\';return true;">'; echo 'Warranty has been determined</a>' . "\n"; } elseif(empty($dateIn) or $dateIn == '1899-12-30') { echo 'Not Received'; } elseif($dateIn != '1899-12-30' and !$warrDet) { echo 'Pending'; } echo '</td>' . "\n"; echo '</tr>' . "\n"; } if($subForm == "WarrHistory") { echo '<tr><td colspan="5" style="text-align: right;"> <a href="/php/custmain.php?' . '&CustNo=' . trim($custNo) . '&MD5=' . trim($MD5) . '&Form=YourWarr' . '&Company=' . trim($company) . '">View Active Warranties <img src="/img/arrow.png" border="0" alt="arrow" /></a>' . '</td></tr>'; } else { echo '<tr><td colspan="5" style="text-align: right;"> <a href="/php/custmain.php?' . '&CustNo=' . trim($custNo) . '&MD5=' . trim($MD5) . '&Form=YourWarr&subForm=WarrHistory' . '&Company=' . trim($company) . '">View History Warranties <img src="/img/arrow.png" border="0" alt="arrow" /></a>' . '</td></tr>'; } echo '</table>' . "\n"; } function YourInfo($CustNo, $Company) { global $SlpnNo; global $SupvsrNo; global $MD5; $Select = 'SELECT cust.cCustNo, cust.cCompany, cust.cAddr1, cust.cAddr2, cust.cCity, cust.cState, cust.cZip, cust.cCountry, cust.cBCont, cust.cBPhone, cust.cFax, cust.cEmail, cust.cSCompany, cust.cSAddr1, cust.cSAddr2, cust.cSCity, cust.cSState, cust.cSZip, cust.cSCountry, cust.cSCont, cust.cSPhone, cust.cBlanketPO, cust.cTerms, cust.lCODOnly, cust.lDiscount, cust.nDiscRate, cust.lAddlDisc, cust.lShipHold, cust.nAtdSAmt, cust.nYTDSalesC, cust.nYTDSalesP, cust.nYTDSales2, cust.cPartnerSP, cust.cSlpnNo, cust.lNewCust, cust.lDispOption, supptype.nPriceAdj, cust.lHwebprc FROM jobtrack!cust LEFT JOIN supptype ON supptype.cSuppType == cust.cSuppType WHERE cust.cCustNo == "' . $CustNo . '"'; $data = MakeSelect($Select, $Company); $CustNo = $data[0][0]; $cCompany = $data[0][1]; $Addr1 = $data[0][2]; $Addr2 = $data[0][3]; $City = $data[0][4]; $State = $data[0][5]; $Zip = $data[0][6]; $Country = $data[0][7]; $BCont = $data[0][8]; $BPhone = $data[0][9]; $Fax = $data[0][10]; $EMail = $data[0][11]; $SCompany = $data[0][12]; $SAddr1 = $data[0][13]; $SAddr2 = $data[0][14]; $SCity = $data[0][15]; $SState = $data[0][16]; $SZip = $data[0][17]; $SCountry = $data[0][18]; $SCont = $data[0][19]; $SPhone = $data[0][20]; $BlanketPO = $data[0][21]; $Terms = $data[0][22]; $CODOnly = $data[0][23]; $Discount = $data[0][24]; $DiscRate = $data[0][25]; $AddlDisc = $data[0][26]; $ShipHold = $data[0][27]; $AtdSAmt = $data[0][28]; $YTDSalesC = $data[0][29]; $YTDSalesP = $data[0][30]; $YTDSales2 = $data[0][31]; $PartnerSP = $data[0][32]; //$SlpnNo = trim(odbc_result($SQLData, 'cSlpnNo')); if(empty($SlpnNo)) $SlpnNo = ''; $NewCust = $data[0][34]; $DispOption = $data[0][35]; $PriceAdj = $data[0][36]; $HidePrice = $data[0][37]; MailForm('custmain', array('SupvsrNo' => $SupvsrNo, 'SlpnNo'=>$SlpnNo, 'CustNo'=>$CustNo, 'Company'=>$Company, 'CompanyName'=>$cCompany)); //echo '<h1 class="custhead">' . $PageTitle . '</h1>' . "\n"; //Sinclairs advertising page goes here: //current version of PHP doesnt like this ? Leaving it out for now. /* $fp = @fopen('http://www.paragontech.com/' . $Company . 'info.htm',"r"); if ($fp) { echo '<br /><div style="width: 90%">' . "\n"; $adPage = readfile('http://www.paragontech.com/' . $Company . 'info.htm'); echo substr($adPage, 0, -5); echo '</div>' . "\n"; } else { LogFailure('Custom Ad page not found! File requested was ' . $Company . 'info.htm', 'AD PAGE MISSING', '','',0); }*/ echo '<center>' . "\n"; if($ShipHold) { echo '<br />'; echo '<strong class="alert">' . "\n"; echo ' Your account is currently on shipping hold. Please contact our accounting department as soon as possible.' . "\n"; echo '</strong>' . "\n"; } elseif($NewCust) { echo '<br />'; echo '<strong class="alert">' . "\n"; echo ' Waiting for credit approval' . "\n"; echo '</strong>' . "\n"; } //Customer information table echo "\n\n"; echo '<table summary="Customer Information" class="infotable" cellspacing="0">' . "\n"; echo ' <tr align="left" valign="bottom"> ' . "\n"; echo ' <th class="infohead">Billing Information:</th>' . "\n"; echo ' <th class="infohead">Shipping Information:</th>' . "\n"; echo ' </tr> ' . "\n"; echo ' <tr>' . "\n"; echo ' <td class="infotable" style="text-align: left;">'. "\n"; echo trim($cCompany) . ' (' . trim($CustNo) . ')' . '<br />' . "\n"; echo trim($Addr1) . '<br />' . "\n"; echo '<br />' . "\n"; if(!empty($Addr2)) { echo trim($Addr2) . '<br />' . "\n"; } echo trim($City) . '<br />' . "\n"; if(!empty($Country)) { echo trim($Country) . '<br />' . "\n"; } echo TableTrim($State) . ', ' . TableTrim($Zip); echo '<br />' . "\n"; echo 'Billing Contact: ' . $BCont . '<br />' . "\n"; echo 'Billing Phone: ' . $BPhone . '<br />' . "\n"; echo 'Billing Terms: ' . "\n"; if($ShipHold) { echo '<strong style="color: red;">' . "\n"; echo 'Shipping Hold'. "\n"; echo '</strong>' . "\n"; } elseif($CODOnly) { echo '<strong>C.O.D.</strong>' . "\n"; } else { echo $Terms . '<br />' . "\n"; } if($DiscRate != 0 and $Discount and $PriceAdj == 0 and !$HidePrice) { echo '<br />' . "\n"; echo 'Discount Rate: ' . number_format(trim($DiscRate)) . '%' . "\n"; } else { echo '<br />' . "\n"; } if($AddlDisc) { echo '<br />' . "\n"; echo 'Additional Location Based Discounts Apply' . "\n"; } else { echo '<br />' . "\n"; } echo ' </td>' . "\n"; //Shipping Info echo ' <td class="infotable" style="text-align: left;">' . "\n"; echo trim($SCompany) . '<br />' . "\n"; echo trim($SAddr1) . '<br />' . "\n"; if(!empty($SAddr2)) { echo trim($SAddr2) . '<br />' . "\n"; } echo trim($SCity) . '<br />' . "\n"; if(!empty($SCountry)) { echo trim($SCountry) . ' '; } echo TableTrim($SState) . ', ' .$SZip; echo '<br />' . "\n"; echo 'Shipping Contact: ' . trim($SCont) . '<br />' . "\n"; echo 'Shipping Phone: ' . trim($SPhone) . '<br />' . "\n"; echo 'Fax: ' . trim($Fax) . '<br />' . "\n"; echo ' </td>' . "\n"; echo ' </tr>' . "\n"; echo '</table>' . '<br />' . "\n\n"; echo '</center>' . "\n"; } // end of YourInfo function YourHistory() { global $HTTP_HOST; global $MD5; global $CustNo; global $Company; global $Demo; $Select = 'SELECT cust.nytdsalesc, cust.nytdsalesp, cust.nytdsales2, cust.tenter FROM jobtrack!cust WHERE cust.cCustNo == "' . $CustNo . '"'; $data = MakeSelect($Select, $Company); $YTDSalesCurrent = $data[0]['nytdsalesc']; $YTDSalesPast = $data[0]['nytdsalesp']; $YTDSales2 = $data[0]['nytdsales2']; $tenter = $data[0]['tenter']; $Counter = 0; if(!empty($tenter) and substr($tenter, 0, 4) > 1990) { $Counter = (int)(date("Y") - (int)substr($tenter, 0, 4)) + 1; if($Counter > 5) $Counter = 5; } else { if(!empty($YTDSalesCurrent)) $Counter = 1; if(!empty($YTDSalesPast)) $Counter = 2; if(!empty($YTDSales2)) $Counter = 5; } if($Demo) $Counter = 3; echo '<br />' . "\n"; echo '<center>' . "\n\n"; echo '<form action="/php/custquery.php" method="post">' . "\n"; echo '<input type="hidden" name="MD5" value="' . $MD5 . '" />' . "\n"; echo '<input type="hidden" name="CustNo" value="' . $CustNo . '" />' . "\n"; echo '<input type="hidden" name="Company" value="' . $Company . '" />' . "\n"; echo '<input type="hidden" name="Form" value="YourActive" />' . "\n"; echo '<div class="custoptionblockborder">' . "\n"; echo '<div class="custoptionblockhead">Select Period</div>' . "\n"; echo '<div class="custoptionblock">' . "\n"; if(!$Counter) { echo 'You have no history at this time.' . "\n"; } else { echo 'Period to retrieve history for:<br /><br />' . "\n"; echo ' ' . "\n"; echo '<select name="DateRange">' ."\n"; for($i = 0; $i < $Counter; $i++) { echo '<option value="'; echo (date("Y", time()) - $i); echo '-' . (date("Y", time()) - ($i-1)) . '">'; echo ((double)date("Y", time()) - $i); echo ' - '; echo date("Y", time()) - ($i-1); echo '</option>' . "\n"; } echo '</select>' . "\n"; echo '<br /><br />' . "\n"; echo ' ' . "\n"; echo '<input type="submit" value="submit" />' ."\n"; } /* echo '<option value="' . (date("Y", time()) - 2) . '-' . (date("Y", time()) - 1) . '">'; echo ((double)date("Y", time()) - 2) . ' - ' . ((double)date("Y", time()) - 1); echo '</option>' . "\n"; echo '<option value="' . (date("Y", time()) - 3) . '-' . (date("Y", time()) - 2) . '">'; echo ((double)date("Y", time()) - 3) . ' - ' . ((double)date("Y", time()) - 2); echo '</option>' . "\n"; echo '<option value="' . (date("Y", time()) - 4) . '-' . (date("Y", time()) - 3) . '">'; echo ((double)date("Y", time()) - 4) . ' - ' . ((double)date("Y", time()) - 3); echo '</option>' . "\n"; echo '<option value="' . (date("Y", time()) - 5) . '-' . (date("Y", time()) - 4) . '">'; echo ((double)date("Y", time()) - 5) . ' - ' . ((double)date("Y", time()) - 4); echo '</option>' . "\n"; */ echo '</div>' . "\n"; echo '</div>' . "\n\n"; echo '</form>' . "\n"; echo '</center>' . "\n"; } //end of YourHistory SendFooter($Company, $StartTime, $SERVER_SOFTWARE); ?> Link to comment https://forums.phpfreaks.com/topic/135156-question-for-the-smart-guys/ Share on other sites More sharing options...
rhodesa Posted December 2, 2008 Share Posted December 2, 2008 so, i see 'jobtrack!cust' for the tablename. what is the meaning of the '!'. is it part of the table name or is it supposed to be a separator between db/schema and table Link to comment https://forums.phpfreaks.com/topic/135156-question-for-the-smart-guys/#findComment-703939 Share on other sites More sharing options...
djdellux Posted December 2, 2008 Author Share Posted December 2, 2008 its part of the table name could you give me any example so i know what im looking for because that is one of 20+ that i have to look thru....uggghhh...lol... i just dont know what statments wouldnt work if ya get what im saying Link to comment https://forums.phpfreaks.com/topic/135156-question-for-the-smart-guys/#findComment-703960 Share on other sites More sharing options...
Gighalen Posted December 2, 2008 Share Posted December 2, 2008 Your queries are trying to add/modify info under the table name cust.cCustNo. Are you connecting to the database itself or just mysql? Link to comment https://forums.phpfreaks.com/topic/135156-question-for-the-smart-guys/#findComment-703964 Share on other sites More sharing options...
rhodesa Posted December 2, 2008 Share Posted December 2, 2008 yeah...this statement confuses me on the naming of the tables: $select = 'SELECT cust.lDispOption, cust.lautofax, cust.lautoemail, cust.lhtmlemail, cust.csupptype FROM jobtrack!cust WHERE cust.cCustNo == "' . $custNo . '"'; this is in MySQL you said? do you manage it with phpMyAdmin? can you post a dump of the table structures? Link to comment https://forums.phpfreaks.com/topic/135156-question-for-the-smart-guys/#findComment-703976 Share on other sites More sharing options...
djdellux Posted December 2, 2008 Author Share Posted December 2, 2008 right now its accesing the Foxpro DB. i need them to go thru MySql...any better of an explnation Link to comment https://forums.phpfreaks.com/topic/135156-question-for-the-smart-guys/#findComment-703980 Share on other sites More sharing options...
rhodesa Posted December 2, 2008 Share Posted December 2, 2008 ok...yeah...the ! in Foxpro is a delimiter between the database name and the table name. So 'jobtrack' is the database and 'cust' is the table. to convert to MySQL, you need to do some modification. if there is only one database (jobtrack), then you can change 'jobtrack!cust' to just 'cust', and provide the database name to mysql_select_db() just after the connection. or, if there are several databases, you should use a period instead...like 'jobtrack.cust' Link to comment https://forums.phpfreaks.com/topic/135156-question-for-the-smart-guys/#findComment-703992 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.