unit Unit2;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, mysql50conn, sqldb, FileUtil, LResources, Forms, Controls,
Graphics, Dialogs, StdCtrls, ExtCtrls;
type
{ TForm2 }
TForm2 = class(TForm)
Button1: TButton;
EditPort: TEdit;
EditHost: TEdit;
EditBase: TEdit;
EditUser: TEdit;
Label1: TLabel;
Label10: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
MemoConf: TMemo;
MySQL50Connection2: TMySQL50Connection;
Panel1: TPanel;
QueryCharSet: TSQLQuery;
SQLTransaction1: TSQLTransaction;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure MySQL50Connection2AfterConnect(Sender: TObject);
procedure Panel1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form2: TForm2;
implementation
{ TForm2 }
procedure TForm2.FormCreate(Sender: TObject);
Var
host_st : String[20];
base_st : String[10];
port_st : String[10];
user_st : String[10];
// f : System.text;
ii : Integer;
varst : String[20];
begin
host_st := MySql50Connection2.HostName;
base_st := MySql50Connection2.DatabaseName;
// port_st := MySql50Connection2.port;
user_st := MySql50Connection2.UserName;
varst := '';
{ AssignFile(f, 'baseconf.ini');
Reset(f);
Readln(f, host_st);
MemoConf.Lines.Add(host_st);
Readln(f, base_st);
MemoConf.Lines.Add(base_st);
Readln(f, port_st);
MemoConf.Lines.Add(port_st);
Readln(f, user_st);
MemoConf.Lines.Add(user_st);
CloseFile(f);
}
// If Length(host_st) <> 0 then
// MySql50Connection2.HostName :=host_st;
If Length(base_st) <> 0 then
MySql50Connection2.DatabaseName:=base_st;
// If Length(port_st) <> 0 then
// MySql50Connection2.port := StrToInt(port_st);
// If Length(user_st) <> 0 then
// MySql50Connection2.UserName:= user_st;
Try
// MySqL50Connection2.Connected:= False;
MySqL50Connection2.Connected:= True;
except
MessageDLG('Ошибка подключения', 'Не погу подключиться к'+#10#13'host='+host_st+
#10#13+'base='+base_st+#10#13+'port='+port_st+#10#13+'user='+user_st,
mtError,[mbOk],0);
end;
EditHost.Text:= MySql50Connection2.HostName;
EditBase.Text:= MySql50Connection2.DatabaseName;
EditPort.Text:= '0';
EditUser.Text:= MySql50Connection2.UserName;
end;
procedure TForm2.MySQL50Connection2AfterConnect(Sender: TObject);
begin
end;
procedure TForm2.Panel1Click(Sender: TObject);
begin
end;
procedure TForm2.Button1Click(Sender: TObject); // Выбрать базу
begin
MySql50Connection2.Connected:= False;
MemoConf.Clear;
MemoConf.Lines.Add(''+EditHost.Text+'');
MemoConf.Lines.Add(''+EditBase.Text+'');
MemoConf.Lines.Add(''+EditPort.Text+'');
MemoConf.Lines.Add(''+EditUser.Text+'');
MemoConf.Lines.SaveToFile('baseconf.ini');
If Length(EditHost.Text) <> 0 then
MySql50Connection2.HostName :=EditHost.Text;
If Length(EditBase.Text) <> 0 then
MySql50Connection2.DatabaseName:=EditBase.Text;
{ If Length(EditPort.Text) <> 0 then
MySql50Connection2.port := StrToInt(EditPort.Text);
}
If Length(EditUser.Text) <> 0 then
MySql50Connection2.UserName:= EditUser.Text;
Try
MySqL50Connection2.Connected := True;
Form2.Visible := False;
// Form1.Label2.Caption := Form2.MySql50Connection2.DatabaseName;
// FormLeks.Label23.Caption := Form2.MySql50Connection2.DatabaseName;
// FormPos.Label21.Caption:= Form2.MySql50Connection2.DatabaseName;
except
MessageDLG('Ошибка подключения', 'Не погу подключиться к'+#10#13'host='+EditHost.Text+
#10#13+'base='+EditBase.Text+#10#13+'port='+EditPort.Text+#10#13+'user='+EditUser.Text,
mtError,[mbOk],0);
end;
end;
initialization
{$I unit2.lrs}
end.
$uploadname=basename($_FILES['photo']['name'])
$uploadpath='img/'.$uploadname;
if (isset($_POST['pname']) && isset($_POST['dolg']) && isset($_POST['data_okon']) && isset($_POST['diplom']) && isset($_POST['sertifikat']) && isset($_POST['data_sertif']) && move_uploaded_file($_FILES['photo']['tmp_name'], $uploadpath))