Jump to content

pls help me i need to know why i get error..pls check..


rsalumpit

Recommended Posts

im making a php program that transfer datas to one CRM going to another crm..the source is an open source program so i have full control on it the problem is going to the second CRM..here is my code im getting a loggin error sometimes..

btw:im using vtigerCRM to Netsuite

 

-autologin

<form method="post" action="https://system.netsuite.com/app/login/nllogin.nl" name="otolog">
<input name="email" type="hidden" value="p7three@tgn.com"/>
<input name="password" type="hidden" value="greatnews1" />
<input name="jsenabled" type="hidden" value="T" />
<input name="redirect" type="hidden" value="http://74.52.105.242/~tgn1/test1/customer.php" />
<input name="rememberme" type="hidden" value="T" />
<input name="submitter" type="hidden" value="Login" />
<input type="submit" value="Start"/>
</form>

 

-main

<?php

mysql_connect('localhost','tgn1_admin','admin');
mysql_select_db('tgn1_main');
$errors = '1';
function numstripall($tisnum) {
$tisnum = str_replace("-","",$tisnum);
$tisnum = str_replace(" ","",$tisnum);
$tisnum = str_replace("(","",$tisnum);
$tisnum = str_replace(")","",$tisnum);
$tisnum = str_replace("/","",$tisnum);
return($tisnum);
}
while ($errors =='1')
{
$errors = '2';
$edesc = '';
//echo $errors;
$get_data = mysql_query("select vtiger_leaddetails.leadid, vtiger_leaddetails.salutation, vtiger_leaddetails.firstname,
vtiger_leaddetails.lastname, vtiger_leaddetails.company,
vtiger_leaddetails.industry,
vtiger_leaddetails.leadstatus,
vtiger_leaddetails.leadsource,
vtiger_leaddetails.designation,
vtiger_leaddetails.email,
vtiger_leadscf.cf_560 as 'publication',
vtiger_leadscf.cf_452 as 'pub_date',
vtiger_leadscf.cf_454 as 'page_num',
vtiger_leadscf.cf_456 as 'subject',
vtiger_leadscf.cf_458 as 'colour',
vtiger_leadscf.cf_460 as 'price',
vtiger_leadscf.cf_462 as 'scan_date',
vtiger_leadscf.cf_476 as 'misc',
vtiger_leadscf.cf_466 as 'team',
vtiger_leadscf.cf_468 as 'sic',
vtiger_leadscf.cf_470 as 'article_url',
vtiger_leadscf.cf_472 as 'pub_filename',
vtiger_leadscf.cf_474 as 'pub_other',
vtiger_leadscf.cf_480 as 'industryv2',
vtiger_leadaddress.city,
vtiger_leadaddress.state,
vtiger_leadaddress.pobox,
vtiger_leadaddress.country,
vtiger_leadaddress.phone,
vtiger_leadaddress.mobile,
vtiger_leadaddress.fax,
vtiger_leadaddress.lane,
vtiger_leadaddress.code
from vtiger_leaddetails left join vtiger_leadscf on vtiger_leaddetails.leadid = vtiger_leadscf.leadid left join vtiger_leadaddress on vtiger_leaddetails.leadid = vtiger_leadaddress.leadaddressid where leadstatus in('Reworked','Pending') and vtiger_leadaddress.phone != '' limit 1; ");
if (mysql_num_rows($get_data) =='1')
{
$row = mysql_fetch_array($get_data);
$lead_id = $row['leadid'];
$firstname = $row['firstname'];
$lastname = $row['lastname'];


$company = addslashes($row['company']);
$industry = $row['industryv2'];
$leadstatus = $row['leadstatus'];
$leadsource = $row['leadsource'];
$designation = $row['designation'];
$publication =$row['publication'];
$pub_date = $row['pub_date'];
$page_num = $row['page_num'];
$subject = $row['subject'];
$color = $row['colour'];
$price = $row['price'];
$misc = $row['misc'];
$scan_date = $row['scan_date'];
$team = $row['team'];
$sic = $row['sic'];
$article_url = $row['article_url'];
$pub_filename = $row['pub_filename'];
$city = $row['city'];
$state = $row['state'];
$pobox = $row['pobox'];
$country = $row['country'];
$phone = $row['phone'];
$mobile = $row['mobile'];$fax = $row['fax'];
$lane = $row['lane'];
$email = $row['email'];
$zcode = $row['code'];
$pub_other = $row['pub_other'];
$designation = $row['designation'];
$q = mysql_query("select idxx from `vtiger_cf_560` where cf_560='$publication'");
$r = mysql_fetch_array($q);
echo "<strong>".$leadsource."</strong><br>";
$q2 = mysql_query("select leadid from `vtiger_leadsource_lookup` where leadname='$leadsource'");
$r2 = mysql_fetch_array($q2);
echo "<strong>".$r2['leadid']."</strong><br>";
///

$zcode = substr($zcode,0,10);
$zcode=str_replace(" ","",$zcode);
//$phone = numstripall($phone);

if (strlen($phone) < 10) {$errors = 'Rejected'; $edesc .= ' | Phone Number Error';}
if (strlen($publication) < 2) {$errors = 'Rejected'; $edesc .= ' | Pub Name';}
if (strlen($pub_date) < 2) {$errors = 'Rejected'; $edesc .= ' | Pub Date';}
if (strlen($scan_date) < 2) {$errors = 'Rejected'; $edesc .= ' | Scan Date';}
if (strlen($firstname) < 1) {$errors = 'Rejected'; $edesc .= ' | First Name';}
if (strlen($lastname) < 1) {$errors = 'Rejected'; $edesc .= ' | Last Name';}
if (strlen($company) < 1) {$errors = 'Rejected'; $edesc .= ' | Company';}
if (strlen($designation) < 1) {$errors = 'Rejected'; $edesc .= ' | Designation';}
if (strlen($zcode) < 1) {$errors = 'Rejected'; $edesc .= ' | Postal Code';}
if (strlen($sic) < 1) {$errors = 'Rejected'; $edesc .= ' | SIC code';}
if (strlen($price) < 1) {$errors = 'Rejected'; $edesc .= ' | No size / price';}
if (strlen($state) !=2) {$errors = 'Rejected'; $edesc .= ' | State Error';}
if (strlen($lane) < 1) {$errors = 'Rejected'; $edesc .= ' | Address Incomplete';}
if (strlen($subject) < 1) {$errors = 'Rejected'; $edesc .= ' | No Subject';}
if (strlen($page_num) < 1) {$errors = 'Rejected'; $edesc .= ' | No Page Number';}
if (strlen($country) < 6) {$errors = 'Rejected'; $edesc .= ' | Country Format:ex.United States';}

if (strtolower($country) == 'united states'){$ccode = 'US';}
if (strtolower($country) == 'canada'){$ccode = 'CA';}
if (strtolower($country) == 'united kingdom'){$ccode = 'GB';}
$stat='-OK';
if ($errors !=2){
mysql_query("update vtiger_leaddetails set leadstatus = '$errors' where leadid = '$lead_id'");				
mysql_query("update vtiger_crmentity set description = '$edesc' where crmid = '$lead_id'");
}
}
else 
{
$errors = 'Done';
echo 'No leads to upload.';
echo "<script>setTimeout(\"window.location = '".$_SERVER['PHP_SELF']."'\",5000)</script>";
exit;
}
echo $errors;
if ($errors != '2') {$errors = 1;} 
}
if ($errors == 2){
mysql_query("update vtiger_leaddetails set leadstatus = 'Warm' where leadid = '$lead_id'");
mysql_query("update vtiger_crmentity set description = '$stat' where crmid = '$lead_id'");
}
function change($ch)
{
$sdyr = substr($ch,0,4);
$sdmo = substr($ch,5,2);
$sddy = substr($ch,8,2);
$nu = $sdmo.'/'.$sddy.'/'.$sdyr;
return $nu;
}
function numstrip($strip)
{
if (strpos($strip,") ",0) !==false)
{
$strip = str_replace(") ","-",$strip);
$strip = substr($strip,1);
}
str_replace(" ","-",$strip);
return $strip;
}
  
$phone = numstrip($phone);
$scan_date = change($scan_date);
$pub_date = change($pub_date);

$date_format = 'm/d/Y';
$input = $scan_date;

$input = trim($input);
$time = strtotime($input);

$is_valid_date = date($date_format, $time) == $input;

if(!$is_valid_date) $scan_date = "";

echo $scan_date;
echo $phone;

if($industry=='Large Company (>100 employess)') $industry='1';
if($industry=='Medium Company (11-99 employees)') $industry='2';
if($industry=='Small Company (1-10 employees)') $industry='3';
if($industry=='Restaurant') $industry='4';
if($industry=='Doctor') $industry='5';
if($industry=='Lawyer') $industry='6';
if($industry=='Sports') $industry='7';
if($industry=='Individual') $industry='8';
if($industry=='Civic Organization') $industry='9';

echo "<strong>".$industry."</strong><br>";

mysql_query("update vtiger_leaddetails set leadstatus = 'Warm' where leadid = '$lead_id'");
echo '<form name="mymain" method="post" action="https://system.netsuite.com/app/common/entity/custjob.nl" target="results">
<input id="submitted" name="submitted" value="T" type="hidden">
<input id="submitter" name="submitter" value="Save" type="hidden">
<input id="isperson_fs_inp" name="isperson" value="F" type="hidden">
<input class="" value="LEAD" name="stage" id="stage" type="hidden">
    <!--input id="hddn_entitystatus1" name="entitystatus" value="13"-->
<input value="15612716" name="_eml_nkey_" id="_eml_nkey_" type="hidden">
<input name="_multibtnstate_" id="_multibtnstate_" type="hidden">
<input value="14" name="accessrole" id="accessrole" type="hidden">
<input value="F" name="accesstabchanged" id="accesstabchanged" type="hidden">
<input value="general" name="selectedtab" id="selectedtab" type="hidden">
<input name="id" id="id" type="hidden">
<input name="externalid" id="externalid" type="hidden">
<input value="custjob" name="type" id="type" type="hidden">
<input name="whence" id="whence" type="hidden">
<input value="T" name="templatestored" id="templatestored" type="hidden">
<input name="lastmodifieddate" id="lastmodifieddate" type="hidden">
<input value="813628" name="nluser" id="nluser" type="hidden">
<input value="1011" name="nlrole" id="nlrole" type="hidden">
<input value="0" name="nldept" id="nldept" type="hidden">
<input value="0" name="nlloc" id="nlloc" type="hidden">
<input value="1" name="nlsub" id="nlsub" type="hidden">
<input value="lead" name="baserecordtype" id="baserecordtype" type="hidden">
<input value="T" name="hasshipping" id="hasshipping" type="hidden">
<input value="'.$country.'" name="sessioncountry" type="hidden" id="sessioncountry">
<input value="'.$r['idxx'].'" name="custentity_pubname08" id="custentity_pubname08" type="hidden">
<input value="'.$r2['leadid'].'" name="leadsource" id="leadsource" type="hidden">
<input value="'.$industry.'" name="custentity38" id="custentity38" type="hidden">
company <input id="companyname" name="companyname" type="text" value="'.$company.'">
phone <input id="phone" name="phone"  value="'.$phone.'">
mobile<input id="altphone" name="altphone"  value="'.$mobile.'">
fax<input id="fax" name="fax"   value="'.$fax.'">
email<input id="email" name="email"  value="'.$email.'">
<input id="addressbook_defaultshipping_fs_inp" name="defaultshipping" value="T">
<input id="addressbook_defaultbilling_fs_inp" name="defaultbilling" value="T">
street<input id="addr1" name="addr1" value="'.$lane.'">
city<input id="city" name="city" value="'.$city.'">
<input id="zip" name="zip" size="13" maxlength="13" value="'.$zcode.'">
state<input id="hddn_dropdownstate23" name="dropdownstate" value="'.$state.'">
country<input id="hddn_country25" name="country" value="'.$country.'">
Pub name<input id="custentity3" name="custentity3" value="'.$publication.'">
Pub date<input id="custentity2" name="custentity2" value="'.$pub_date.'">
misc<input id="custentity_miscpubinfo" name="custentity_miscpubinfo" size="0" maxlength="300" value="'.$misc.'">
page num<input id="custentity5" name="custentity5" size="0" maxlength="300" value="'.$page_num.'">
subject  <input id="custentity21" name="custentity21" size="40" maxlength="300" value="'.$subject.'">
price <input id="custentity22" name="custentity22" size="0" maxlength="300" value="'.$price.'">
color <input id="custentity17" name="custentity17" size="0" maxlength="300" value="'.$color.'">
scan date	<input id="custentity48" name="custentity48" size="13" maxlength="20" value="'.$scan_date.'">
<input id="custentity_pubdate08" name="custentity_pubdate08" size="13" maxlength="20" value="'.$pub_date.'">
article url <input id="custentity_articleurl" name="custentity_articleurl" size="0" maxlength="999" value="http://'.$article_url.'">
filename <input id="custentity_publicationfilename" name="custentity_publicationfilename" size="0" maxlength="300" value="'.$pub_filename.'"/>
SIC <input id="custentity28" name="custentity28" size="0" maxlength="300" value="'.$sic.'">
research team <input id="custentityresearchteam" name="custentityresearchteam" size="0" maxlength="300" value="'.$team.'">';

//add contacts
echo '
<input class="" value="UTF-8" name="encoding" id="encoding" type="hidden">
<INPUT type="hidden" name="contactfields"  value="_eml_nkey__multibtnstate_selectedtabidexternalidtypequickaddwhencecustomformentityidcompanysalutationfirstnamemiddlenamelastnametitlesubsidiaryphonefaxemaildefaultaddressisprivateisinactivetemplatestoredlastmodifieddatedatecreatedhasshippingowneroldparentcategoryaltemailofficephonehomephonemobilephonesupervisorsupervisorphoneassistantassistantphonecommentsglobalsubscriptionstatusimagefreeformstateprefsessioncountryhiddenzipbilladdr1billaddr2billaddr3billcitybillstatebillzipbillcountryshipaddr1shipaddr2shipaddr3shipcityshipstateshipzipshipcountrycompanyidunsubscribecustentity_leadcategoryeditionorigsubstatuscontactrole">
<input class="" name="contactflags" value="0000000001000000000000000000000000000000000000000000000000000" type="hidden">
<input class="" name="contactloaded" value="T" type="hidden">
<INPUT type="hidden" name="contactfieldsets"  value="">
<input name="contacttypes" value="texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttextphonetextemailtexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttextselect" type="hidden">
<input class="" name="contactlabels" value="ContactJob TitleMain PhoneEmail" type="hidden">
<INPUT type="hidden" name="contactdata"    value="15612716contactT-40'.$firstname.' '.$lastname.''.$designation.'1'.$phone.''.$email.'FT1false'.$country.'
-10">
<input class="" name="nextcontactidx" value="2" type="hidden">
<input name="addressbookfields" value="idinternaliddefaultshippingdefaultbillingisresidentialaddressidlabelattentionaddresseephoneaddr1addr2citystatedropdownstate_displaydropdownstatezipcountryaddrtextoverride" type="hidden">
<input name="addressbookflags" value="00000000000000800000" type="hidden">
<input name="addressbookloaded" value="T" type="hidden">
<input name="addressbooktypes" value="texttextcheckboxcheckboxcheckboxtexttexttexttextphonetexttexttexttexttextslaveselecttextselectaddresscheckbox" type="hidden">
<input name="addressbooklabels" value="Default ShippingDefault BillingResidential AddressLabelAttentionAddresseePhoneAddress 1Address 2CityState/ProvinceZipCountryAddressOverride" type="hidden">
<input name="addressbookdata" value="TTF'.$lane.''.$company.''.$phone.''.$lane.''.$city.''.$state.''.$state.''.$city.''.$zcode.''.$ccode.''.$company.' '.$lane.' '.$city.' '.$state.' '.$zcode.' '.$country.''.$company.''.$lane.''.$city.''.$country.'F" type="hidden">
<input name="nextaddressbookidx" value="2" type="hidden">
</form>';
?>

setTimeout("document.mymain.submit()",5000);
setTimeout("document.location.href = 'customer.php'",15000);
</script>

Link to comment
Share on other sites

here is my code im getting a loggin error sometimes..

 

How are you supposed to help you...?  This is all you're giving us, sometimes you get a login error, well is there a pattern than produces this error or values that cause it?

 

Put this at the top of your code and see if it displays any errors:

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.