Search
Left Quote    I start where the last man left off.
- Thomas A. Edison    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Username and Password Issue...!!!
  This user is offline  abhi
  Subject: "Username and Password Issue...!!!" Posted: @ 2:11 pm on Nov 26 2007   
Member #: 379
Rank: User - (19)
Since: 07/30/07
Posts: 19
From: Michigan

Username and Password Issue...!!!

--------------- --------------- --------------- --------------- --------------- -----
I have another important issue........ca n anybody please tell me what would be the code if i want that a small screen should pop up and ask me for username and password instead of my putting in the username and password in the command itself like this:
w:/php actimp.php abc_de/*******@ IRIM1 szt_w_act.ctl ACT-2006-03-29. 001.txt.The one in bold is the username.follow ed by password followed by the database.My boss doesnt want the username and password to be inserted in the command itself.Instead there should be a pop up that shd ask for username and password and the database.
Please Help...!!!.
The actual code looks something like this:
<?php
// actimp.php
// Reads a act control loader and looks for '#INFILE#'
// Author: sss
// Date: 7/23/04

// Usage:
// php actimp.php <user/pass@d atabase> <control-fil e> <filename to import>


if($_SERVER['ar gc'] <> 4)
{
print("Usa ge: php actimp.php <user/pass@d atabase> <control-fil e> <filename to import>\n\n& quot;
exit(0);
}

if(!file_exists ($_SERVER['argv '][2]))
{
print("Err or: Template control file does not exist.\n\n" ;
exit(1);
}
elseif(!file_ex ists($_SERVER[' argv'][3]))
{
print("Err or: Import file does not exist.\n\n" ;
exit(1);
}
elseif(strlen($ _SERVER['argv'] [3]) <> 22)
{
print("Err or: Import file must use the following naming convention.\n\n ";
print("\tA CT-YYYY-MM-DD.S SS.txt where SSS is the sequence number\n\n" ;
exit(1);
}
else{

$lines = file($_SERVER[' argv'][2]);
$newfile = false;
$newfile =fopen('temp.ct l', 'w');
if(!$newfile){< br /> print("Err or: Cannot create temporary control file ";
exit(2);
}
$impfile=$_SERV ER['argv'][3];
$date=substr($i mpfile,4,4).sub str($impfile,9, 2).substr($impf ile,12,2);
$seq=substr($im pfile,15,3);

foreach ( $lines as $line_num => $line) {

if(preg_match(& quot;/#INFILE#/ i", $line))
$line=str_repla ce("#INFIL E#",$_SERV ER['argv'][3],$ line);
else if(preg_match(& quot;/#DATE#/i& quot;,$line))
$line=str_repla ce("#DATE# ",$date,$l ine);
else if(preg_match(& quot;/#INTEGER# /i",$line) )
$line=str_repla ce("#INTEG ER#",$seq, $line);

fwrite($newfile ,$line);
}

fclose($newfile );


$cmd= 'sqlldr userid='.$_SERV ER['argv'][1].' control=temp.ct l log='.substr($_ SERVER['argv'][ 3],0,19).'log';
passthru($cmd);
unlink('temp.ct l');

}



abhishekitty@ya
hoo.com |     Viewed: 10,277 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Username and Password Issue...!..." Posted: @ 3:26 pm on Nov 26 2007    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Is this on a website? If you use .HTACCESS for the directory, it will present a pop-up box to enter in username and password. I believe you can have 3 tries before it "error's out."

Search google for .htaccess and the .htpasswd file.

You can encrypt the .htpasswd file as well, here is a site that has a form to do so: Encrypt .htpasswd




-bs0d | AllSyntax.com

    Viewed: 10,268 Times | Reply to This | To top
  This user is offline  abhi
  Subject: "re: Username and Password Issue...!..." Posted: @ 5:29 pm on Nov 26 2007    
Member #: 379
Rank: User - (19)
Since: 07/30/07
Posts: 19
From: Michigan

Thank-You so much for your help bs0d...No its not basically for the webiste its just that I run the following command in cmd prompt and the above mentioned code is executed...it loads the ACT data through SQL loader...the command is as follows :
w:/php actimp.php abc_de/*******@ IRIM1 szt_w_act.ctl ACT-2006-03-29. 001.txt.
The **** shows the username and password.My boss wants that we should not put the username and passowrd directly while writing the command....It should prompt us to give the username and password...One last question for you.........whe re should I insert the .htaccess username and passowrd code in my code and would this code do what is required...!!!




abhishekitty@ya
hoo.com |     Viewed: 10,258 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Username and Password Issue...!..." Posted: @ 6:45 pm on Nov 26 2007    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

you're able to execute php pages, what server are you running? I think .htaccess is specific to Apache; thats where you would make the configurations.




-bs0d | AllSyntax.com

    Viewed: 10,253 Times | Reply to This | To top
  This user is offline  abhi
  Subject: "re: Username and Password Issue...!..." Posted: @ 6:55 pm on Nov 26 2007    
Member #: 379
Rank: User - (19)
Since: 07/30/07
Posts: 19
From: Michigan

How would I know which Server am I running...!!!




abhishekitty@ya
hoo.com |     Viewed: 10,249 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Username and Password Issue...!..." Posted: @ 7:04 pm on Nov 26 2007    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

ask your boss




-bs0d | AllSyntax.com

    Viewed: 10,245 Times | Reply to This | To top
  This user is offline  abhi
  Subject: "re: Username and Password Issue...!..." Posted: @ 8:34 pm on Nov 26 2007    
Member #: 379
Rank: User - (19)
Since: 07/30/07
Posts: 19
From: Michigan

I think the server recognises php script...thats for sure...!!!




abhishekitty@ya
hoo.com |     Viewed: 10,239 Times | Reply to This | To top
  This user is offline  abhi
  Subject: "re: Username and Password Issue...!..." Posted: @ 1:35 pm on Dec 04 2007    
Member #: 379
Rank: User - (19)
Since: 07/30/07
Posts: 19
From: Michigan

Its a windows server...!!!




abhishekitty@ya
hoo.com |     Viewed: 10,026 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank