[HELP] I need help to finish this code.

Release your script here.
State:
- Author
- What it does
- Perhaps a little guide.
- Also, if the snippet is of any use to the community, it has a chance of getting posted on the main page, so don't hesitate to submit/ask!

[HELP] I need help to finish this code.

Postby slowerx » Sun Apr 17, 2011 9:34 pm

Hi, i need some help to finish this code , it's for an Anti Cheat of Counter-Strike 1.6 , this Anti-Cheat is for gather's.

I don't know how to finish this code:


Code c++:

Code: Select all
if (isEditEnabled == 1) {


sprintf(scfile, "/ac_checklogin.php?u=%s&v=%s&upm=0&p=%s", usernamex, tver, passwdx);

} else {
if (checkState == 1 && hasdatafile == 1) {
sprintf(scfile, "/ac_checklogin.php?u=%s&v=%s&upm=%s&p=0", usernamex, tver, upmd5);
}
}


WebForm wf;

wf.setHost("");
//String ^xuname= gcnew String(szTempp);
wf.setScriptFile(scfile);
if (wf.sendRequest()) {

char response[101];
if(wf.getResponse(response,100))
{

try {

char tresponse[101];
sprintf(tresponse, "update");
if (stricmp(response, tresponse) == 0 ) {
MessageBox( "You need to update your anti-cheat!", "Error!", MB_OK | MB_ICONINFORMATION);
return;
}
if (stricmp(response, usernamex) == 0 ) {

gusername = (LPCTSTR)response;


if(checkState == 1) {
  //pCheckBox->SetCheck(BST_CHECKED);

//save password here

ofstream myfilex;
myfilex.open("data");

myfilex << gusername << endl;
myfilex << rand() << rand() << rand();

myfilex.close();

//fstream filestr;

 // filestr.open ("data", fstream::in | fstream::out | fstream::app);

  //filestr << gusername;
  //filestr.close();


string line;
ostringstream out;
ifstream myfile ("data");
if (myfile.is_open())
{
int ccount = 0;
while (! myfile.eof() )
{
getline (myfile,line);
out << line;
string line2 = out.str();
CString line3 = line2.c_str();
if (ccount == 1) {
upmd5 = line3;
}
ccount++;
}
}
myfile.close();



//char tfiletdx[100];
//sprintf(tfiletdx, "Test: %s \r\n", upmd5);

//MessageBox( tfiletdx, "asdx", MB_OK | MB_ICONINFORMATION);
//MessageBox( "Checked!", "Test!", MB_OK | MB_ICONINFORMATION);
}


//MessageBox( response, "Logged in!", MB_OK | MB_ICONINFORMATION);

//MessageBox( response, "Logged in!", MB_OK | MB_ICONINFORMATION);
UpdateData(TRUE);

GetDlgItem(IDC_EDIT1)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_EDIT2)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_STATIC)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_STATIC4)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_CHECK1)->ShowWindow(SW_HIDE);

GetDlgItem(IDC_STATIC2)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BUTTON1)->ShowWindow(SW_HIDE);
GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);


//GetDlgItemText(IDC_EDIT1, gusername, sizeof(gusername));
char sinfo[200];

char sinfob[200];


GetDlgItemText(IDC_STATIC6, sinfo, sizeof(sinfo));
GetDlgItemText(IDC_STATIC7, sinfob, sizeof(sinfob));

//CString unamet = usernamex;
char lgdinas[100];
sprintf(lgdinas, "Logged in as %s", gusername);

BOOL cont = m_sListener.Create();
if (!cont) {
MessageBox( LPCTSTR(cont), "Error!", MB_OK | MB_ICONINFORMATION);
return;
}

/*UINT nPort = 8909;
m_sListener.Connect(LPCTSTR("188.93.234.66"), nPort);*/
UINT nPort = 6713;
m_sListener.Connect(LPCTSTR("66.90.82.207"), nPort);
m_constatus = "Connecting...";

//m_status=_T("Logged in!");
m_status=lgdinas;

UpdateData(FALSE);
//UpdateData(FALSE);

ATimer[0] = StartTimer(7000);

//ATimer[1] = SetTimer(IDT_TIMER_1, 10000, NULL);
ATimer[2] = SetTimer(IDT_TIMER_2, 30000, NULL);

} else {
//char tfiletd[100];

//sprintf(tfiletd, "Wrong username and/or password! %s - %s\r\n", usernamex, response);

//MessageBox( tfiletd, "Error!", MB_OK | MB_ICONINFORMATION);
<--


PHP check:

Code: Select all
<?php
     
    if (isset($_GET['u']) && isset($_GET['p']) && isset($_GET['v'])) {
     
     

 $version = $_GET['v'];
 if ($version >= "") {
     
                   
                   
 //include("funcs.php");

$database = "";
$user = "";
$pass = "";
$host = "81.92.219.115";
$connect = mysql_connect($host, $user, $pass) or die(mysql_error());
                    mysql_select_db($database, $connect) or die(mysql_error());

function checkState($username, $password){
   global $connect;
   if(!get_magic_quotes_gpc()) {
$username = addslashes($username);
   }
   $q = "select password from users where auth = '$username'";
   $result = mysql_query($q,$connect);
   if(!$result || (mysql_numrows($result) < 1)){
  return 1; //Indicates auth failure
   }
   $dbarray = mysql_fetch_array($result);
   $dbarray['password']  = stripslashes($dbarray['password']);
   $password = stripslashes($password);
   if($password == $dbarray['password']){
  return 0; //Success! auth and password confirmed
   }
   else{
  return 2; //Indicates password failure
   }
}
                   
                   
                    $loggedin = 0;
                    $ulevel = 0;
                    $ufunc = 0;
                    $cuser = "a";
                    $username = "a";
                    $username = $_GET['u'];
                    $upm = 0;
                    if (isset($_GET['upm'])) {
                            $upm = $_GET['upm'];
                    }

                    $upm = md5($upm);
                    $npassword = $_SERVER['QUERY_STRING'];
                    $password = urlencode($_GET['p']);
                    $groups = array();
                    $xpassword = $groups[4];
                    $method = 0;
                    //$username = escapem($username);
                    //$version = escapem($version);
                    //$password = escapem($password);
$tpassword = md5($xpassword);




                    if ($upm == 0) {
                            $res = mysql_query("SELECT auth, level FROM users WHERE auth='$username' AND password='$tpassword'");
                            $method = 1;

                           
                    } else {
                            $res = mysql_query("SELECT auth, level, ac_md5 FROM users WHERE auth='$username' AND ac_md5='$upm'");
                            $method = 2;
                    }

                    $num = mysql_num_rows($res);
                    $row = mysql_fetch_array($res);

                    if ($num == 1) {
                            $ip = $_SERVER['REMOTE_ADDR'];
                            $now = time();
                            $username = $row['auth'];
                            $loggedin = 1;
                            echo "$username";
                    } else {
                            echo "error2 - User: $username - Password: $groups[4] - UPM: $upm - $method";
                            //print_r($groups);
                    }
            } else {
                    echo "update";
            }
    }
                           
    ?>
<--



To creat a file "funcs.php", i don't understand how to can return data to the program to continue its execution.
slowerx
 

Re: [HELP] I need help to finish this code.

Postby james90 » Wed Nov 16, 2011 7:04 am

I am also searching for this, if you got solution of this please do let me know.
james90
 

Re: [HELP] I need help to finish this code.

Postby Cristian » Thu Nov 17, 2011 1:10 pm

C++ and PHP is not my favorite language, but that aside, what does the author of the code say?

If its for Anticheat there must some sort of board where you can discuss this matter, and I'm sure they know a lot more than we do.

Sorry I couldn't help
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar


Return to PHP Release

Who is online

Users browsing this forum: No registered users and 1 guest

cron