0): while($getvaluerow = mysql_fetch_row($resultstmt)) { $adminuser=$getvaluerow[0]; $adminpassword=$getvaluerow[1]; $yesno=1; }; endif; return $yesno; }; function startpagenomenu() { echo ""; echo(' Indianmetals | Users '); echo " "; // BEGIN Head Code Inclusion Standard /// $DOCUMENT_ROOT=".."; /// #include($_SERVER['DOCUMENT_ROOT'] . "/include/head_standard.txt"); // END Head Code Inclusion Standard echo(''); echo(' '); }; $adminuser=$imiuserid; $adminpass=$imipassid; global $admincheck ; $admincheck=admincheck($adminuser,$adminpass); if ($admincheck != 1): startpage(10,"Users","users",""); else: if ($state == "updateuser" && $admincheck == 1): /*$additionalmetatag=""; $additionalmetatag1=" onLoad=\"biginit();\" "; startpagewithmetatag(10,"Users","users","",$additionalmetatag,$additionalmetatag1); */ #startpage(10,"Users","users",""); startpagenomenu(); else: if ($admincheck != 1): startpage(10,"Users","users",""); else: startpagenomenu(); endif; endif; endif; if ($currcompid==''): echo "



You are not authorised member of indianmetals.com.
Site could not process the request you have mentioned.This could have been caused by any of the following :-

You are not Authorised Member of the site.

Either you have not Logged in or your session has expired.

Somebody has already logged in with your Username and Password.

Your Login has crossed permitted number of Users.

You may have not properly Logged off, kindly Login after sometime.

Registration is FREE Click here to register.

"; return; endif; endif; if ($currcompid!=''): $companyname = getvalueforid("companywebupdate","compid","company",$currcompid,"n"); if ($state != "confirmcontract"): #echo "
Welcome $companyname
"; endif; endif; if ($state!='forgotpassword'): if (!isset($currcompid)): echo "Invalid request"; exit; endif; endif; else: require_once($DOCUMENT_ROOT . "/include/ipcode.php"); require_once($DOCUMENT_ROOT . "/include/tableborder.php"); startpage(10,"Users","users",""); endif; endif; global $DOCUMENT_ROOT; require_once($DOCUMENT_ROOT. '/include/email_styles.php'); function checkuserpass($field,$corporperso,$arg) { if ( $corporperso == 'corp'): { $chkstmt = "select compid from companywebupdate where corp$field = '$arg' "; } elseif ( $corporperso == 'perso'): { $chkstmt = "select compid from companywebupdate where perso$field = '$arg' "; }; endif; #echo $chkstmt."
"; $reststmt = mysql_query($chkstmt); $i = mysql_numrows($reststmt); $result=""; if ($i > 0 ): $compid = mysql_result($reststmt,0,"compid"); $result ="Found in $compid"; endif; return $compid; }; if (!isset($send)): $send='y'; endif; function getvalueforid($tablename,$wherefieldidname,$resultfieldname,$getvaluefor,$type) { if ($type=="c"): $getvaluestmt ="select $resultfieldname from $tablename where $wherefieldidname = '$getvaluefor' "; elseif ($type=="n"): $getvaluestmt ="select $resultfieldname from $tablename where $wherefieldidname = $getvaluefor "; endif; $getvalueresult = mysql_query( $getvaluestmt); if ( mysql_errno() > 0 ): echo mysql_errno(). "$getvaluestmt".mysql_error()."

"; endif; $rows=mysql_numrows($getvalueresult); if ($rows > 0): while($getvaluerow = mysql_fetch_row($getvalueresult)) { $getvalue = $getvaluerow[0]; }; endif; return $getvalue; }; function forgotpasswordform() { #User Name: $returnform = "

Corporate:
Email :
"; return $returnform; }; function updateuserform($currcompid) { global $sitemenuhome; $stmt="select corpuser,corppassword,persouser,persopassword from companywebupdate where compid = $currcompid "; $compidresult = mysql_query($stmt); if (mysql_errno() == 0): $compctr = mysql_result($compidresult,0,"corpuser"); $prevcorpuser = mysql_result($compidresult,0,"corpuser"); if ($prevcorpuser !=''): $corpuser=$prevcorpuser; endif; $prevcorppassword = mysql_result($compidresult,0,"corppassword"); if ($prevcorppassword !=''): $corppassword=$prevcorppassword; endif; $prevpersouser = mysql_result($compidresult,0,"persouser"); if ($prevpersouser !=''): $persouser = $prevpersouser; endif; $prevpersopassword = mysql_result($compidresult,0,"persopassword"); if ($prevpersopassword != ''): $persopassword=$prevpersopassword; endif; endif; $date = mysql_query("select DAYOFMONTH(now()) as day ,DATE_FORMAT(now(),'%Y-%m-%d') as dt"); $startdate = mysql_result($date,0,"dt"); $stmt="select emaillist.email from companywebupdate,emaillist where companywebupdate.emailid = emaillist.emailid and companywebupdate.compid = $currcompid"; $compidresult = mysql_query($stmt); if (mysql_errno() == 0): $email = mysql_result($compidresult,0,"email"); endif; $returnform = "

Corporate:
User Name :
Password :
.
Corporate:
User Name :
Password :

"; return $returnform; }; function sendemailusers($toemail,$subjectmatter,$textmatter,$htmlmatter,$fromemail,$emailformatdetailsid) { $textmattergen=$textmatter; $htmlmattergen=$htmlmatter; $htmlno=1; $id=$emailformatdetailsid; $rtn =email_format($id,$htmlno,$toemail,$fromemail,$subject,$htmlmattergen,$textmattergen); if ($rtn ==0): global $DOCUMENT_ROOT; include($_SERVER['DOCUMENT_ROOT']. '/include/promotional.php'); $matter=$textmatter.$botmatterpromotionaltext."\n--1316415226\nContent-type: text/html\nContent-Transfer-Encoding: 7bit\n\n\n"; $htmlmattertop="Indianmetals | Registration
IndianMetals.com    •Help  •Home   
"; $htmlmatterbot="
".$promotionaltext."
"; $matter=$matter.$htmlmattertop.$htmlmatter.$htmlmatterbot."\n\n--1316415226--\n--1091233530--"; mail($toemail,$subjectmatter,$matter,"From: ".$fromemail."\nMIME-Version: 1.0\nContent-type: multipart/related; boundary=1091233530\ncharset: gb2312\n\n--1091233530\n--1091233530\nContent-type: multipart/alternative;boundary=1316415226\n\n--1316415226\nContent-type: text/plain\nContent-Transfer-Encoding: 7bit\n"); endif; }; function updateuser($compid,$corpuser,$corppassword,$persouser,$persopassword,$email) { global $webmasteremail; global $send; $stmt="select corpuser,compid from companywebupdate where corppassword = '$corppassword' and corpuser = '$corpuser' and persopassword = '$persopassword' and persouser = '$persouser' and compid <> $compid "; $compidresult = mysql_query($stmt); $compctr = mysql_numrows($compidresult); $corpuserresult = checkuserpass('user','corp',$corpuser); if ($corpuserresult <> '' && $corpuserresult <> $compid ): #corpuserresult:$corpuserresult #compid:$compid echo "This User was for Corporate was used . Press Back and change username and password"; return; elseif ($corpuserresult == ''): $corppasswordresult = checkuserpass('password','corp',$corppassword); if ($corppasswordresult <> '' && $corppasswordresult <> $compid): #$corppasswordresult echo "This Password for Corporate was used . Press Back and change username and password"; return; elseif ($corppasswordresult == ''): $persouserresult = checkuserpass('user','perso',$persouser); if ($persouserresult <> '' && $persouserresult <> $compid): #$persouserresult echo "This User for Personnel was used . Press Back and change username and password"; return; elseif ($persouserresult == ''): $persopasswordresult = checkuserpass('password','perso',$persopassword); if ( $persopasswordresult <> '' && $persopasswordresult <> $compid): #$persopasswordresult echo "This Password for Personnel was used. Press Back and change username and password"; return; elseif ($persopasswordresult == ''): #echo "Unique User and Password"."
"; endif; endif; endif; endif; if ($persopasswordresult == '' ): $passwordresult = mysql_query("select corpuser,corppassword,compid from companywebupdate where corppassword = '$corppassword' and corpuser = '$corpuser' and persopassword = '$persopassword' and persouser = '$persouser' "); $i = mysql_numrows($passwordresult); if ($i == 0): $date = mysql_query("select DAYOFMONTH(now()) as day ,DATE_FORMAT(now(),'%Y-%m-%d') as dt"); $startdate = mysql_result($date,0,"dt"); $ustmt="Update companywebupdate set corpuser ='$corpuser',corppassword ='$corppassword' where compid = $compid"; $result = mysql_query($ustmt); if (mysql_errno() > 0 ): echo mysql_errno().": ".mysql_error()." in $ustmt
"; return; endif; $ustmt="Update companywebupdate set persouser ='$persouser',persopassword ='$persopassword' where compid = $compid"; $result = mysql_query($ustmt); if (mysql_errno() > 0 ): echo mysql_errno().": ".mysql_error()." in $ustmt
"; return; endif; $companystmt="select company,person,DATE_FORMAT(date,'%Y-%m-%d') as date from companywebupdate where corpuser ='$corpuser' and corppassword ='$corppassword' and persouser ='$persouser' and persopassword ='$persopassword' and compid = $compid"; $result = mysql_query($companystmt); if (mysql_errno() > 0 ): echo mysql_errno().": ".mysql_error()." Error in $companystmt
"; return; endif; $num=mysql_numrows($result); if ($num == 1 ): $company = mysql_result($result,0,"company"); $person = mysql_result($result,0,"person"); $latestcomplisteddate=mysql_result($result,0,"date"); else: mail("$webmasteremail","Error in send username $num :".$companystmt,"From: $email"); echo "Error in send username $num :".$companystmt; return; endif; $subjectforuser="Username/Password for - indianmetals.com"; $topmatter="Thank you for subscribing "; $topmatter=$topmatter.sprintf("\n%s\t\n","Corporate").sprintf("\n%s\t\n","Username: $corpuser").sprintf("%s\t\n","Password: ".$corppassword); $topmatter=$topmatter.sprintf("\n\n%s\t\n","Personnel").sprintf("\n%s\t\n","Username: $persouser").sprintf("%s\t\n","Password: ".$persopassword); $botmatter=sprintf("\n%s\t\n","For any comments, query or assistance please feel free to email us at webmaster@indianmetals.com.").sprintf("\n%s\t\n","Regards").sprintf("\n%s\t\n","Indianmetals.com Team"); $matter="
Attn: $person

Thank you for subscribing.Please find Your Username & Password"; $matter=$matter."
Corporate - $company
"."Username: $corpuser"."
Password: ".$corppassword; $matter=$matter."

Personnel
"."Username: $persouser
"."Password: ".$persopassword; $matter=$matter."

Click here to Change Password

For any comments, query or assistance please feel free to email us at webmaster@indianmetals.com.
Regards
Indianmetals Team"; if ($send =='y'): $toemail= $email." (".$person.")"; #$toemail= "navin@indianmetals.com"; $subjectmatter=$subjectforuser ; $fromemail=$webmasteremail; $htmlmatter=$matter; $textmatter = $topmatter.$botmatter; $emailformatdetailsid=1; sendemailusers($toemail,$subjectmatter,$textmatter,$htmlmatter,$fromemail,$emailformatdetailsid); #mail("$email","$subjectforuser",$topmatter.$matter.$botmatter,"From: $webmasteremail"); $subjectforuser="User:$username sent to $company - CompanyID: $compid - indianmetals.com"; elseif ($send =='n'): $subjectforuser="To be sent Later - User:$username NOT sent to $company - CompanyID: $compid - indianmetals.com"; endif; $toemail= $webmasteremail; #$toemail= "navin@indianmetals.com"; $subjectmatter=$subjectforuser ; $fromemail=$email." (".$person.")"; $htmlmatter=$matter; $textmatter = $topmatter.$botmatter; $emailformatdetailsid=1; sendemailusers($toemail,$subjectmatter,$textmatter,$htmlmatter,$fromemail,$emailformatdetailsid); /*$listedcompid = $compid; $pophtm ="http://www.indianmetals.com/myim/sendtradealertforcompid.php?state=sendtradealertmain&listedcompid=$listedcompid&latestcomplisteddate=$latestcomplisteddate"; echo "";*/ #mail("$webmasteremail","$subjectforuser",$topmatter.$matter.$botmatter,"From: $email"); echo "

Thank You for using indianmetals.com

"; echo "


Your Username and Password has been emailed

"; elseif ($i == 1): $alreadycompid = mysql_result($passwordresult,0,"compid"); if ($alreadycompid <> $compid): #by $alreadycompid echo "

This password was used . Press Back and change username and password

"; else: echo "

No change made to your Username & password .

"; endif; endif; else: echo "

This password for this company already Not Requested

"; endif; }; function forgotpassword($user,$email) { global $webmasteremail; #$corpuserresult = checkuserpass('user','corp',$user); #if ($corpuserresult == ''): # echo "

Sorry your username is not found in our Records

"; # return; #endif; #$forgotpasswordstmt="select corpuser,corppassword,persouser,persopassword from companywebupdate,emaillist where companywebupdate.emailid = emaillist.emailid and emaillist.email = '$email' and (corpuser = '$user' or persouser = '$user')"; $forgotpasswordstmt="select corpuser,corppassword,persouser,persopassword,company,person from companywebupdate,emaillist where companywebupdate.emailid = emaillist.emailid and emaillist.email = '$email' "; $topmatter=sprintf("%s\t\n","Thank you for subscribing ").sprintf("%s\t\n","Following are the Username and Password as requested by you -").sprintf("%s\t\n",""); $forgotpasswordresult = mysql_query($forgotpasswordstmt); $i = mysql_numrows($forgotpasswordresult); if ($i == 0): { echo "

Sorry your email address is not found in our Records

"; } else: { $j=0; while($j < $i) { $corpuser=mysql_result($forgotpasswordresult,$j,"corpuser"); $corppassword=mysql_result($forgotpasswordresult,$j,"corppassword"); $persouser=mysql_result($forgotpasswordresult,$j,"persouser"); $persopassword=mysql_result($forgotpasswordresult,$j,"persopassword"); $company=mysql_result($forgotpasswordresult,$j,"company"); $person=mysql_result($forgotpasswordresult,$j,"person"); if ($corpuser == ''): $approvedornot="( Awaiting Scrutiny )"; $company=$company.$approvedornot; $matter=$matter."Company: $company"; $topmatter=$topmatter.sprintf("\n%s\t\n","Company: $company"); else: $topmatter=$topmatter.sprintf("\n%s\t\n","Company: $company"); $topmatter=$topmatter.sprintf("\n%s\t\n","Corporate").sprintf("\n%s\t\n","Username: $corpuser").sprintf("%s\t\n","Password: ".$corppassword); $topmatter=$topmatter.sprintf("\n%s\t\n","Personnel").sprintf("\n%s\t\n","Username: $persouser").sprintf("%s\t\n","Password: ".$persopassword); sprintf("%s\t\n","---------------------"); $matter=$matter."
Corporate - $company
"."Username: $corpuser"."
Password: ".$corppassword; $matter=$matter."

Personnel
"."Username: $persouser
"."Password: ".$persopassword; $matter=$matter."

For any comments, query or assistance please feel free to email us at webmaster@indianmetals.com.
Regards
Indianmetals Team"; endif; $j++; }; $subjectforuser="Reminder Username/Password for - indianmetals.com"; $matter="
Attn: $person

Thank you for subscribing".$matter; $$matter=$matter.sprintf("\n%s\t\n","For any comments, query or assistance please feel free to email us at webmaster@indianmetals.com.").sprintf("\n%s\t\n","Regards").sprintf("\n%s\t\n","Indianmetals.com Team"); $botmatter=sprintf("%s\t\n","Regards").sprintf("%s\t\n","Indianmetals.com team"); $toemail= $email." (".$person.")"; $subjectmatter=$subjectforuser ; $fromemail=$webmasteremail; $htmlmatter=$matter; $textmatter = $topmatter.$botmatter; $emailformatdetailsid=6; sendemailusers($toemail,$subjectmatter,$textmatter,$htmlmatter,$fromemail,$emailformatdetailsid); #mail("$email","$subjectforuser",$topmatter.$matter.$botmatter,"From: $webmasteremail"); $subjectforuser="Reminder User:$username sent to $company - $compid - indianmetals.com"; $toemail= $webmasteremail; $subjectmatter=$subjectforuser ; $fromemail=$email." (".$person.")"; $htmlmatter=$matter; $textmatter = $topmatter.$botmatter; #mail("$webmasteremail","$subjectforuser",$topmatter.$matter.$botmatter,"From: $email"); $emailformatdetailsid=6; sendemailusers($toemail,$subjectmatter,$textmatter,$htmlmatter,$fromemail,$emailformatdetailsid); echo "

Thank You for Using indianmetals.com

"; echo "


Your Password has been emailed

"; } endif; }; function adduser($compid,$email) { global $sitemenuhome; $random = mysql_query("select ascii(SUBSTRING(RAND(),3,LENGTH(RAND()))) as asci,SUBSTRING(RAND(),3,LENGTH(RAND())) as rnd"); $companyquery = mysql_query("select company,person from companywebupdate where compid = $compid"); $company = mysql_result($companyquery,0,"company"); $person = mysql_result($companyquery,0,"person"); $compshrt=substr($company,0,4); $persoshrt=substr($person,0,4); $rndnum = mysql_result($random,0,"rnd"); $ascinum = mysql_result($random,0,"asci"); $corppassword = $compshrt.substr(chr($ascinum).$rndnum,0,8); $corpuser=$compshrt.substr(base64_encode($compshrt),0,4); $random = mysql_query("select ascii(SUBSTRING(RAND(),3,LENGTH(RAND()))) as asci,SUBSTRING(RAND(),3,LENGTH(RAND())) as rnd"); $rndnum = mysql_result($random,0,"rnd"); $ascinum = mysql_result($random,0,"asci"); $persopassword = $persoshrt.substr(chr($ascinum).$rndnum,0,8); $persouser=$persoshrt.substr(base64_encode($persoshrt),0,4); $strlen =strlen ($corppassword); if ($strlen > 10): $corppassword = substr ($corppassword, 0, 10); endif; $strlen =strlen ($corpuser); if ($strlen > 10): $corpuser = substr ($corpuser, 0, 10); endif; $strlen =strlen ($persopassword); if ($strlen > 10): $persopassword = substr ($persopassword, 0, 10); endif; $strlen =strlen ($persouser); if ($strlen > 10): $persouser = substr ($persouser, 0, 10); endif; $stmt="select corpuser,corppassword,persouser,persopassword from companywebupdate where compid = $compid "; $compidresult = mysql_query($stmt); #and corpuser = '' #echo $stmt."

"; if (mysql_errno() == 0): $compctr = mysql_result($compidresult,0,"corpuser"); $prevcorpuser = mysql_result($compidresult,0,"corpuser"); if ($prevcorpuser !=''): $corpuser=$prevcorpuser; endif; $prevcorppassword = mysql_result($compidresult,0,"corppassword"); if ($prevcorppassword !=''): $corppassword=$prevcorppassword; endif; $prevpersouser = mysql_result($compidresult,0,"persouser"); if ($prevpersouser !=''): $persouser = $prevpersouser; endif; $prevpersopassword = mysql_result($compidresult,0,"persopassword"); if ($prevpersopassword != ''): $persopassword=$prevpersopassword; endif; endif; #echo $compctr."

"; if ($compctr == ""): if ($corppassword != ""): $pstmt="select corpuser,corppassword from companywebupdate where corppassword = '$corppassword' and corpuser = '$corpuser'"; $passwordresult = mysql_query($pstmt); # echo $pstmt."

"; $i = mysql_numrows($passwordresult); if ($i == 0): $date = mysql_query("select DAYOFMONTH(now()) as day ,DATE_FORMAT(now(),'%Y-%m-%d') as dt"); $startdate = mysql_result($date,0,"dt"); $corpuser=strtolower($corpuser); $corppassword=strtolower($corppassword); $persouser=strtolower($persouser); $persopassword=strtolower($persopassword); $returnform = "

Send Now

Corporate:
User Name :
Password :
Personnell :
User Name :
Password :
"; return $returnform; else: $returnform = "This password was used "; return $returnform; endif; endif; else: $returnform = "Password for this company was already availed "; return $returnform; endif; }; if ($state !=''): switch($state) { case "add"; $returnform =adduser($addcompid,$email); echo printTable548Start("","Send Username / Password [gif to be made]","Send Username / Password",""); echo $returnform; break; case "updateuser"; echo printTable548Start("","Change Username Password [gif to be made]","Change Username Password",""); if ($corpuser == '' || $corppassword == '' || $persouser =='' || $persopassword==''): echo "

It seems you have not completed the Form.
All User names Passwords must be Entered.
Press Back button on your Browser.

"; break; endif; updateuser($compid,$corpuser,$corppassword,$persouser,$persopassword,$email); break; case "forgotpasswordform"; echo printTable548Start("","Forgort Username Password [gif to be made]","Forgot Username Password",""); $form =forgotpasswordform(); echo $form; break; case "forgotpassword"; echo printTable548Start("","Forgort Username Password [gif to be made]","Forgot Username Password",""); forgotpassword($user,$email); break; case "updateuserform"; echo printTable548Start("","Change Username Password [gif to be made]","Change Username Password",""); $form=updateuserform($currcompid); echo $form; break; } echo printTable548End(""); if ($admincheck != 1): echo ""; global $DOCUMENT_ROOT; include($_SERVER['DOCUMENT_ROOT'] . '/include/body_footer_standard.txt'); echo ""; endif; exit; endif; #afterpagewithbotmenu(0); ?>