Jump to content

If member doesn't have enough. It will deny the download with message.


FuZzI

Recommended Posts

I am new to PHP and trying to figure out stuff...

 

Here is the full script for that page:

 

Included this header2.php in drug_org.php

<?PHP


require "_connect.php";
require_once "functions.php";
//Including files
//Begin Variables

$actual_time = time();
//End Variables
	$lijstGebruikers = "SELECT * FROM users WHERE username='$cookieusername'";
	$resultLijstGebruikers = mysql_query($lijstGebruikers);
	if (mysql_num_rows($resultLijstGebruikers) == 1) {
		$check = "pos";
	} else {
		$melding = "You are not logged in. You will be redirected to the login page in 2 seconds" . "<META http-equiv=refresh content=\"1;url=index.php\">";
	}

	UpdateTable(users,online,$actual_time,username,$cookieusername); 
//Set Online Status

		$lijstGebruikers = "SELECT * FROM users WHERE username='$cookieusername'";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		while ($row = mysql_fetch_array($resultLijstGebruikers)) {
			 $username = $row[username];  	
			 $password = $row[password];  	
			 $rank = $row[rang];  		
			 $geld = $row[geld];  	
			 $crew = $row[crew];  	
			 $health = $row[health];  	
			 $gun = $row[gun];  	 	
			 $protection = $row[protection];  	
			 $quote = $row[quote];  	
			 $kills = $row[kills];
			 $crime = $row[crime];
			 $gta = $row[gta];  
			 $oc = $row[oc];  
			 $locatie = $row[locatie];
			 $recover = $row[recover];
			 $travel = $row[travel]; 
			 $bank = $row[bank];  	
			 $timebank = $row[timebank];
			 $online = $row[online];  
			 $moderator = $row[moderator];
			 $signedup = $row[signedup]; 	
			 $blank = $row[blank];
			 $latina = $row[latina];
			 $asian = $row[asian];
			 $black = $row[black];
			 $specialised = $row[specialised];
			 $level = $row[level];
                 $notes = $row[notes];
		}
		$lijstGebruikers = "SELECT * FROM jail WHERE whoinjail='$cookieusername'";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		while ($row = mysql_fetch_array($resultLijstGebruikers)) {
		$time_left = $row[tillwhen];
		}
		if((time() < $time_left) ) {
			} else {
				$sql = "DELETE FROM jail WHERE whoinjail='$cookieusername'";
				$result = mysql_query($sql);
				if ($result) {

					} else {
					$melding = "An Error in the database occured, please contact the Admin about this.";	
					}
			}
//Getting user's information
$protection_2 = SetProtection($protection,$cookieusername);
$gun_2 = SetGun($gun,$cookieusername);
$rank_value = SetRank($rank,$cookieusername);
$health_color = SetHealthColor($health,$cookieusername);
if ($crew == 0) {
	$crew2 = "Not part of a gang";
}
//Including _setall.php for giving the gun and protection string names
		$lijstGebruikers2 = "SELECT * FROM crews WHERE boss='$cookieusername'";
		$resultLijstGebruikers2 = mysql_query($lijstGebruikers2);
		while ($row2 = mysql_fetch_array($resultLijstGebruikers2)) {
			$boss = $row2[id];
		}
//Reading crew table to see if You are boss
	$lijstGebruikers = "SELECT * FROM crews WHERE id='$crew'";
	$resultLijstGebruikers = mysql_query($lijstGebruikers);
	while ($row = mysql_fetch_array($resultLijstGebruikers)) {
		$crew_name = $row[name];
		$crew_boss = $row[boss];
		$crew_bank = $row[bank];
		$crew_recruiter = $row[recruiter];
		$crew_cleaner = $row[cleaner];
	}		
	include "_ip_block.php";
	if ($ip_check == "neg") {
		$melding = "You are blocked for the reason: $reason";	
	}
if(! ($nomessage == 1))	{
if($health == 0) {
print <<<ENDHTML
<title>Mafioso.ca - You've been Murdered!</title>
<link rel="stylesheet" type="text/css" href="src/standard.css" />
<center>
<div class="window">
<div class="mainTitle">You've been Murdered!</div>
<div class="mainText">
As soon as you walked out your house, you heard a car driving fast by the corner of your street. You had a slight
feeling that the car was coming for you so you started to walk a bit faster.<BR><BR>
As soon as you started to walk faster, the car burst into a sudden speed and blasted a few hundred rounds at you..<BR><BR>

You got shot over <b>56</b> times. You were against a wall sitting down and you screamed; "You little pricks!! I will get you motherfuckers!! .."
<BR><BR>
There it ends .. you got murdered.

<BR><BR><BR>Click <a href="register.php">here</a> to take revenge on the prick who shot you!<BR><BR><BR><BR>

This message might be by accident, try to <a href="index.php">login</a> again.<BR>
If you have any problems, please contact <b>Support@Mafioso.ca</B>
</div>
</div>
</div>
</center>
ENDHTML;
exit;
}
}		

?>

 

drug_org.php THIS IS WHERE I WANT THE SCRIPT

<?
// bezoekers statistieken
$pagename = "Drug Organizer";
include("./counter.inc.php");
?>
<?	
include "header2.php";
include "_menu.php";
if ($message) {
	echo "<div class=\"window\">";
	echo "<div class=\"mainTitle\">Drug Organizer</div>";
	echo "<div class=\"mainText\">";
	echo "</div></div>";
}
?>
<BR>
<div class="window">
<div class="mainTitle">Drug Organizer</div>
<div class="mainText">
<table>

<center><img src="images/o24h.gif"></center>

<BR><BR>

The Drug Organizer is an electronic that will enable you to save the current drug prices in all countries.
<BR>
This tool is very useful to know all drug prices in all countries and also to make the best profit!
<BR><BR>
You will not have the current prices loaded. You'll have to input it yourself by travelling in different countries
or by discussing it with your friends. Saved files can be sent through the game at any time. 
<BR><BR>

Screenshots: <a href="images/ss/do_ss1.jpg" target="_blank"><img src="images/ss/do_ss1.jpg" height="200 width="200""></a>
<BR><BR>


<font color="Red">Important:</font> Only press on the 'Buy!' button once. Multiple clicks can cause you to lose alot money which <B>cannot</B> be reimbursed.



<BR><BR>


<center>
<table border="1"  width="100%">
  <tr><!-- Row 1 -->
     <td><b>Method</b></td><!-- Col 1 -->
     <td><b>Price</b></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 2 -->
     <td><center>Personal Mafioso Money <BR>(Game Money)<BR>
<!-- Buy Script -->




<?PHP
if (isset($_POST['buy'])){
mysql_query("UPDATE `users` SET `geld`=`geld`-'750000' WHERE `username`='$cookieusername'");
        echo '<script>location.href = "http://mafioso.ca/electronics/Mafioso%20Drug%20Organizer.rar"</script>';
        exit;
}


$english_format_number = number_format($geld);
echo "<b>You have:</b> $" . $english_format_number;
?>
</center></td><!-- Col 1 -->
<td>
$750,000
<BR><BR>
<form method="post">
<input type='submit' name='buy' value='Buy!'></a>
</form>




<!-- End Buy Script -->


</td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 3 -->
     <td><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<center>
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but01.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</center>
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIH0QYJKoZIhvcNAQcEoIIHwjCCB74CAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYAcSXTPA9QTZaucC3qg35B7Rx7UaljmPrZbrn0ZZMDK9jZNdKfY3+YR8Cm1RPTEK/sC3cYS2I45hMaACvOQPwU2oOQj6ulqWrIkW1Ngmq1S2baUMgfCZQG6zqntt/MQt0qE8MXxMHFlkgo1QKbpan7U6fgD0w0JIgXj1DDP8NF/2zELMAkGBSsOAwIaBQAwggFNBgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECCzo8UjhWr65gIIBKMWT5UEZfI2r9aM2lOSI6ONhmTU9iUysLtG09UfjBeTqAIjxXnpWdCp1LJ1Kgbdc28SsDco8NBuUa98o0Ue5V1jqNbndVYuFD2OQDuiD8kzPKDlPkPHAI5SjiH5i+obQVE7hq6jTaQ+q0ITeH7hekoYObRtxOALBd8OcRu66B58UD+gUU3yBEVRlNNdlg5OZuwKUMfuYqfVs8rMzb2bIcnV+IJLt5XWCq0et5KayRGNCs6FEkvbjn4qpkIq38/8JgQB1gHJzsLBCG/h+TmKf6lLBVbGekX4p7C81blnvi27g7kZW3ArqPfnLApZX7R5jBDSg9mBSgKRhmZ5dKFqbiEDkdiPZU3NPg6H6sLCeWm+jMlZoKx3TjaWDNsvVm75bdAjU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6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMDcxMTE2MDY1NjEwWjAjBgkqhkiG9w0BCQQxFgQUosLHJnDEZ69zK4OLJEqlMkkk2ZwwDQYJKoZIhvcNAQEBBQAEgYABcRbM865YwaE4SJCsxeqnPbpZzccZSjB6/K2+x5Ch/zob2e2xZMwjAicnoM23Qa3qmbIIR7HzbLffZOPTrdvljIDC0IP5zle60AWYRaablERwQJT7Of52VKuf1Ae99jE0cKcJtIHuPOCBYBuHW0ZYhGkJSABKP12bzRab5wvN0w==-----END PKCS7-----
">
</form><center>(Real Money)<BR>			

            <?PHP
		$english_format_number = number_format($realmoney);
		echo "<b>You have:</b> $" . $english_format_number;
		?>

<!-- Col 1 -->
     <td>$2,00</td>


<!-- Col 2 -->
  </tr>
</table>

<BR><BR>

<font color="Red"><b>NOTICE:</b></font> Sharing the Drug Organizer tool with other members will get you permanently banned. This tool can only be used by it's respective owner.

</center>


</table>
</div>

 

Anything missing? So far, I can do everything except telling a user they don't have enough money.

 

Would it be helpful if I posted another file that does this? If so, here is my _hitlist.php file which has the message if you don't have enough money.

<?php

//kijken of bedrag boven 0 is.
$controle = 0;
if ($_POST['money'] < 0) {
$controle = 1;
}

if (($_POST['player_name']) AND ($_POST['money']) AND ($_POST['reason'])) {
$player_name = $_POST['player_name'];
$money = $_POST['money'];
$reason = $_POST['reason'];
if ($controle == 1) {
$melding = "You have entered a negative number. Go back and try again.";
} else {
$lijstGebruikers = "SELECT * FROM users WHERE username='$player_name'";
$resultLijstGebruikers = mysql_query($lijstGebruikers);
if (mysql_num_rows($resultLijstGebruikers) == 1) {
	if (settype($money, integer)) {
		if ($money !== 0) {
			$geld2 = $money + 1000;
			if ($geld > $geld2) {
				if (($player_name == "jimmykroon")) {
					$melding = "You can't add the programmer from this game.";
				} else {
					$opdracht = "insert INTO hitlist values('0','$player_name','$cookieusername','$money','$reason')";
					$resultaat = mysql_query($opdracht);
					$nieuw_geld = $geld - $geld2;
					$opdracht2 = "UPDATE users SET geld = '$nieuw_geld' WHERE username = '$cookieusername' LIMIT 1 ";
					$resultaat2 = mysql_query($opdracht2);
					if ($resultaat AND $resultaat2) {
						$melding = "You've successfully added <b>$player_name</b> to the hitlist for <b>$$money</b>";	
					}
				}
			} else {
				$melding = "You don't have enough money.";	
			}
		} else {
			$melding = "No valid number imported.";
		}	
	} 		
} else {
	$melding = "Mobster doesn't match.";	
}
}
}
if ($_GET['id']){
$id = $_GET['id'];
$lijstGebruikers = "SELECT * FROM hitlist WHERE id = '$id'";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		while ($row = mysql_fetch_array($resultLijstGebruikers)) {
			$melding = "Are you sure you want to buy '{$row['target']}' from the hitlist?<BR><a href=\"hitlist.php?BID={$id}\">Yes, I do.</a>";
		}
}
if ($_GET['BID']){
$id = $_GET['BID'];
$lijstGebruikers = "SELECT * FROM hitlist WHERE id = '$id'";
		$resultLijstGebruikers = mysql_query($lijstGebruikers);
		while ($row = mysql_fetch_array($resultLijstGebruikers)) {
			$payer = $row['payer'];
			$amount = $row['ammount'];
			if ($geld < $amount) {
				$melding = "You don't have enough money.";
			} else {
			mysql_query("UPDATE `users` SET `geld`=`geld`+'$amount' WHERE `username`='$payer'");
			mysql_query("DELETE FROM `hitlist` WHERE `id`='$id'");
			mysql_query("UPDATE `users` SET `geld`=`geld`-'$amount' WHERE `username`='$cookieusername'");
			$melding = "You bought '{$row['target']}' from the hitlist!";
			}
		}
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.