Jump to content
user567

PHP to Delphi 7 - offer 10 usd LR

Recommended Posts

Salut, offer 10 usd la primul dintre voi care imi scrieti codul php de mai jos in Delphi 7.

<?php

$imput = file("$argv[1]");
$output = file("$argv[2]");

if (!empty($imput) AND !empty($output)) {

foreach ($imput as $nr => $line) {
$ss = explode(":",$line);
$email = trim($ss[0]);
$pass = trim($ss[1]);

$split = explode("@",$email);
$utente = trim($split[0]);
$domain = trim($split[1]);

$SaveFile = fopen($output, "a");
fwrite($SaveFile, "smpt.$domain:$email:$pass\r\n");
fclose($SaveFile);

}} else {

Print "file.exe input.txt output.txt";

}
print "Done.\n";
?>

Link to comment
Share on other sites

Nu am nevoie de nici un ban, uite aici codul:


program Extract;

{$APPTYPE CONSOLE}

uses
SysUtils;

var
FileIn,FileOut: TextFile;
S,Email,Password,Domain: String;
begin
if ParamCount >= 2 then
begin
if FileExists(ParamStr(1)) then
begin
AssignFile(FileIn, ParamStr(1));
Reset(FileIn);
end
else
WriteLn('The file' + ParamStr(1) + 'does not exist, please create it');
if FileExists(ParamStr(2)) then
begin
AssignFile(FileOut, Paramstr(2));
ReWrite(FileOut);
end
else
begin
FileCreate(ParamStr(2));
AssignFile(FileOut, Paramstr(2));
end;
while not Eof(FileIn) do
begin
ReadLn(FileIn, S);
Email := Copy(S, 1, Pos(':', S) - 1);
Password := Copy(S, Pos(':', S) + 1, Length(S) - Pos(':', S));
Domain := Copy(Email, Pos('@', Email) + 1, Length(Email) - Pos('@', Email));
WriteLn(FileOut, 'smtp.' + Domain + ':' + Email + ':' + Password);
end;
CloseFile(FileIn);
CloseFile(FileOut);
WriteLn('Done');
end
else
Write('Example: file.exe input.txt output.txt');
end.

Ps: Cand rulezi executabilul nu uita sa folosesti comanda cd ca sa te duci in acel director altfel va spune ca fisierul input.txt nu exista.....se poate corecta usor bugul asta dar cred ca asta poti face si tu!

Edited by Paul4games
Link to comment
Share on other sites

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.   Paste as plain text instead

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