Beste webmasters
Ben ik weer even,
Ik heb een programma die verzend informatie via een url naar een script op de site.
Dit script leest het uit en moet het eventueel opslaan in de database of iets terug sturen.
Normaal zond hij e-mail,password en guid.
Ik heb progname toegevoegd zodat dezelfde mensen meerdere programma's kunnen hebbben.
Bij het registreren lukt het, maar als de persoon inlogt krijgt hij een foutmelding.
Die hij normaal moet krijgen als hij geen toegang of een foute aanmelding heeft gedaan.
VB.NET script, zo zend hij de url
Het auth.phpCode:Private strProgname As String = "Test" 'Naam van je programma Function Login(ByVal email As String, ByVal pass As String) Dim url As String = "http://dwebs.be/guid/auth.php?email=" & email & "&pass=" & Md5hash(Md5hash(Md5hash(pass))) & "&guid=" & Md5hash(Md5hash(Md5hash(Guid))) & "&progname=" & Md5hash(Md5hash(Md5hash(strProgname))) Dim wr As New WebClient Dim Request As String = wr.DownloadString(url).ToString Dim DeReq As String = rc4(Request) Return DeReq End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click If txtPassword.Text = "" Then Exit Sub If txtEmail.Text = "" Then Exit Sub txtEmail.Enabled = False txtPassword.Enabled = False btnLogin.Enabled = False 'Label1.Text = "Logging in..." Dim Value As String = Login(txtEmail.Text, txtPassword.Text) If Value.ToString = "Active" Then ' Label1.Text = "ACS Status: Active" ' Now proceed with program.. MessageBox.Show("You've successfully logged into whatever your system you wanted to login to.") Exit Sub Else If Value.ToString = "Fail" Then MessageBox.Show("Invalid Email/Password authentication" & vbCrLf & "You don't have a license to use this program", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If If Value.ToString = "Invalid" Then ' Label1.Text = "Invalid Guid Match" MessageBox.Show("Invalid GUID Match. If you have switched computers. Notify a Admin for a GUID Reset.", "", MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Sub End If If Value.ToString = "" Then MessageBox.Show(Value.ToString) Exit Sub End If End If End Sub
and progname='$progname' <- heb ik toegevoegd
PHP Code:
<?php
include('config.php');
$statu = "Inactive";
function rc4($pt) {
$key = "Danny(!)Weide43";
$s = array();
for ($i=0; $i<256; $i++) {
$s[$i] = $i;
}
$j = 0;
$x;
for ($i=0; $i<256; $i++) {
$j = ($j + $s[$i] + ord($key[$i % strlen($key)])) % 256;
$x = $s[$i];
$s[$i] = $s[$j];
$s[$j] = $x;
}
$i = 0;
$j = 0;
$ct = '';
$y;
for ($y=0; $y<strlen($pt); $y++) {
$i = ($i + 1) % 256;
$j = ($j + $s[$i]) % 256;
$x = $s[$i];
$s[$i] = $s[$j];
$s[$j] = $x;
$ct .= $pt[$y] ^ chr($s[($s[$i] + $s[$j]) % 256]);
}
return $ct;
}
ob_start();
//Put maintenance here if you like :D
//echo(rc4("Maintenance is currently in progress. Come back soon."));
//exit;
// Define $email and $pass
$email=$_GET['email'];
$pass=md5(md5(md5($_GET['pass'])));
$guid=md5(md5(md5($_GET['guid'])));
$progname=md5(md5(md5($_GET['progname'])));
// To protect MySQL injection (more detail about MySQL injection)
$email = stripslashes($email);
$pass = stripslashes($pass);
$guid = stripslashes($guid);
$progname = stripslashes($progname);
$email = mysql_real_escape_string($email);
$pass = mysql_real_escape_string($pass);
$guid = mysql_real_escape_string($guid);
$progname = mysql_real_escape_string($progname);
$sql="SELECT * FROM $tbl_name WHERE email='$email' and pass='$pass' and progname='$progname'";
$result=mysql_query($sql);
$guid2="SELECT * FROM $tbl_name WHERE email='$email' and guid='$guid' and progname='$progname'";
$result=mysql_query($sql);
$guidres=mysql_num_rows(mysql_query($guid2));
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $email and $pass, table row must be 1 row
if($count==1){
if($guidres==1) {
$status = "SELECT * FROM $tbl_name WHERE email='$email' and status='0' and progname='$progname'";
$stats = mysql_query($status);
$off = mysql_num_rows($stats);
if(!$off==1) {
echo(rc4("Banned"));
exit;
}
//Action Here.
echo(rc4($statu));
exit;
//Guid
} else {
$chk = "SELECT * FROM $tbl_name WHERE email='$email' and status='4' and progname='$progname'";
$chk2 = mysql_query($chk);
$chk3=mysql_num_rows($chk2);
if($chk==1) {
$reg = "UPDATE $tbl_name SET guid='$guid' WHERE email='$email'";
mysql_query($reg);
$reg2 = "UPDATE $tbl_name SET status='0' WHERE email='$email'";
mysql_query($reg2);
echo(rc4("Active"));
exit;
} else {
echo(rc4("Invalid"));
exit;
}
}
//Password
} else {
$chk = "SELECT * FROM $tbl_name WHERE email='$email' and status='4'";
$chk=mysql_num_rows(mysql_query($chk));
if(!$chk==1) {
echo(rc4("Fail"));
exit;
} else {
$reg = "UPDATE $tbl_name SET pass='$pass' WHERE email='$email'";
mysql_query($reg);
$re = "UPDATE $tbl_name SET guid='$guid' WHERE email='$email'";
mysql_query($re);
$reg2 = "UPDATE $tbl_name SET status='0' WHERE email='$email'";
mysql_query($reg2);
echo(rc4($status));
exit;
}
}
ob_end_flush();
?>
- PHP uitlees probleem
-
07-06-2011, 17:20 #1
- Berichten
- 1.025
- Lid sinds
- 14 Jaar
PHP uitlees probleem
Laatst aangepast door Danny vs : 07-06-2011 om 17:38
-
-
07-06-2011, 17:27 #2
- Berichten
- 200
- Lid sinds
- 15 Jaar
Re: PHP uitlees probleem
Maak eens overal kleine letters van, dus progname ipv Progname.
Ik zie bij je vb script geval hem staan met P, en bij het inlezen met een p.
En is dat echt nodig dat strProgname? Wellicht moet je het dan weer terug om zetten oid..
Ik zou in elk geval even kijken of alles aan 'beide kanten' gelijk is :)
-
07-06-2011, 17:39 #3
- Berichten
- 1.025
- Lid sinds
- 14 Jaar
Re: PHP uitlees probleem
Maak eens overal kleine letters van, dus progname ipv Progname.
Ik zie bij je vb script geval hem staan met P, en bij het inlezen met een p.
En is dat echt nodig dat strProgname? Wellicht moet je het dan weer terug om zetten oid..
Ik zou in elk geval even kijken of alles aan 'beide kanten' gelijk is :)
Maar was vergeten om voor jullie die declaratie erbij te stoppen
Dus nog altijd hetzelfde probleem
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic