Files
ayanova7/archive/ayanova 1.9.4 CE final release db schema 171/sp/KD.cpp

227 lines
5.8 KiB
C++

// KD.cpp : implementation file
//
#include "stdafx.h"
#include "sp.h"
#include "KD.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CKD dialog
CKD::CKD(CWnd* pParent /*=NULL*/)
: CDialog(CKD::IDD, pParent)
{
//{{AFX_DATA_INIT(CKD)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pApp = (CSpApp*)AfxGetApp();
/*
rs=new GZRset("Error 69 - email tech support");
rs->SetConnect(m_pApp->strConnectString);
*/
//Initialize recordset pointer
rs=m_pApp->rsPool->GetRS("CKD");
k=new GZK;
}
void CKD::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CKD)
DDX_Control(pDX, IDC_LBLK, m_lblK);
DDX_Control(pDX, IDC_LBLINFO, m_lblInfo);
DDX_Control(pDX, IDC_LBLC, m_lblC);
DDX_Control(pDX, IDC_EDK, m_edK);
DDX_Control(pDX, IDC_EDC, m_edC);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CKD, CDialog)
//{{AFX_MSG_MAP(CKD)
ON_BN_CLICKED(IDC_BTNSAVE, OnBtnsave)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CKD message handlers
void CKD::OnBtnsave()
{
CString key,keyvalue;
CString comp,company;
CString kCompHash;
CString temp,q;
int firstcomma,secondcomma,thirdcomma;
m_edC.GetWindowText(company);
m_edK.GetWindowText(keyvalue);
comp=company;
key=keyvalue;
// COMPARE AGAINST ZAP LIST
k->GZHash(&comp);
k->GZDecrypt(&key,false);
firstcomma=key.Find(',',0);
secondcomma=key.Find(',',firstcomma+1);
thirdcomma=key.Find(',',secondcomma+1);
if(firstcomma==-1 || secondcomma==-1 || thirdcomma==-1)
{
AfxMessageBox(k->InLineDecrypt("gE8Brl9JYwu9G+0BoCLatUpt2Ug5YXYs+1lBHILkRHB7hcyeWE6o3q8ztyj+9wTPP9+OzYAj"
"ejaF8zlelDCG1Pz34nBTyKwSovUmpyTTNzQ"));
/*Key or registered name is not valid.
Please check your entries and try again.*/
return;
}
kCompHash=key.Left(firstcomma);
if(kCompHash!=comp)
{
AfxMessageBox(k->InLineDecrypt("gE8Brl9JYwu9G+0BoCLatUpt2Ug5YXYs+1lBHILkRHB7hcyeWE6o3q8ztyj+9wTPP9+OzYAj"
"ejaF8zlelDCG1Pz34nBTyKwSovUmpyTTNzQ"));
/*Key or registered name is not valid.
Please check your entries and try again.*/
return;
}
//v1.9.4.5 TEAM ESD IMMEDIATE KEY CHECK
if(kCompHash=="1575153704")//TEAM ESD
{
AfxMessageBox(k->InLineDecrypt("gE8Brl9JYwu9G+0BoCLatUpt2Ug5YXYs+1lBHILkRHB7hcyeWE6o3q8ztyj+9wTPP9+OzYAj"
"ejaF8zlelDCG1Pz34nBTyKwSovUmpyTTNzQ"));
/*Key or registered name is not valid.
Please check your entries and try again.*/
return;
}
//*************v1.9.4.5 changes***********************************************
//v1.9.4.5 add expiry date check as in the spDoc validate function that is
//run at each login against the key code
//expiry date?
temp=key.Right(key.GetLength()-thirdcomma-1);
if(temp==k->InLineDecrypt("Md2gXbFO5Vu4MqQpfyEWdw"/*15 eval key*/)
|| temp==k->InLineDecrypt("hm0s/6NFOzjXMUUd/HaGEA") /*69 licensed key*/
|| temp==k->InLineDecrypt("o2jDhqik1/EKD7zT1MBbJQ") /*5 eval key*/)
{
temp="";//do nothing, it's got a valid code number at the end, no worries
//this is just a way to avoid re-writing the borrowed code above
}
else//the date portion at the end isn't a code number, it should be a date
//verify it's a valid date
{
//If we are here, then this key has an expiry date, check if expired and announce time left?
COleDateTime dtData;
COleDateTime dtNow=COleDateTime::GetCurrentTime();
COleDateTimeSpan dtSpan;
dtData.ParseDateTime(temp);
CString m_strExpiryDays;
CString strTemp;
temp.Empty();//don't leave it floating around in memory
if(dtData.GetStatus()!=0)//couldn't parse the date and time
{
AfxMessageBox(k->InLineDecrypt("gE8Brl9JYwu9G+0BoCLatUpt2Ug5YXYs+1lBHILkRHB7hcyeWE6o3q8ztyj+9wTPP9+OzYAj"
"ejaF8zlelDCG1Pz34nBTyKwSovUmpyTTNzQ"));
/*Key or registered name is not valid.
Please check your entries and try again.*/
return;
}
}
//**********END V1.9.4.5 changes*****************************************
q.Format("UPDATE defaults SET defaults.regto = \"%s\", defaults.[key] = \"%s\";",company,keyvalue);
if(!rs->Ex(q))
{
AfxMessageBox("Error saving information");
return;
}
else
{
AfxMessageBox(k->InLineDecrypt("ASRkzgxvjiV1EvBmxwtBVDVZ8mV1DqMqb6LMrZSb1PvJqc6eiDW1eIzpxeqgGH07O63CorO9"
"+pnHKPzq2fOIWnO7cnQUX0ptXc+WVZbNvOMHOAxiTJ3TYzdkdDlaGCON"));
/*AyaNova unlocked successfully!
Restart AyaNova at all computers
for changes to take effect.*/
rs->Close();
if(k!=NULL)
{
delete k;
k=NULL;
}
CDialog::OnOK();
}
}
BOOL CKD::OnInitDialog()
{
CDialog::OnInitDialog();
CString s;
s="QWCsICmK0VAp3QHZkVXA6zD5n8y6eFWhlrv9f3tN7iI";
/*Enter registration key*/
k->GZDecrypt(&s,false);
SetWindowText(s);
m_lblInfo.SetWindowText(k->InLineDecrypt("sqFcTepw4hTfxfEcWmBEnVoqtOQdRplq7YTuO15bhbpGHizIoQxNjPsvveG/VPqTr9cRA1gV"
"KtUz5WpV8cUdKtAopAVu/6fo8t3P8bAeRwOdaPRYwMnj6Tnal8xZGiC5ltQDIudvV2hUK+b1"
"IkF/JnIEcODBNqJrPO1eHaGc0HE="));
/*Thank you for registering AyaNova!
Enter your registered company name
and keycode in the text boxes provided below.
*/
m_lblC.SetWindowText(k->InLineDecrypt("7/dnsYwUjm7Bg8gxlE7K4eFK4UxUsu+Hha4OI04vLRs"));//registered to
m_lblK.SetWindowText(k->InLineDecrypt("VIXCLaT+N2aEpijLHKeTUw"));//keycode
rs->Query("SELECT defaults.regto, defaults.key FROM defaults;");
rs->FetchField("regto",&s);
m_edC.SetWindowText(s);
rs->FetchField("key",&s);
m_edK.SetWindowText(s);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
CKD::~CKD()
{
m_pApp->rsPool->ReleaseRS(&rs->m_nID);
if(k!=NULL) delete k;
}