Location: PHPKode > projects > Simple SMS Site Software > simple-sms-site-software/confirm_send.php
<?php
/******************************************************************************
************** Simple SMS Site Software *********************************
************** SSSSv1.0*****************************************************
************** by (aq) limited http://aql.com *******************************
************** All Rights Reserved ******************************************
************** Please read COPYRIGHT file prior to modification********
********************************************************************************/
	
session_start();

$_SESSION['wap'] = $_POST['theWapAddress'];
$_SESSION['orig'] = $_POST['theOriginator'];
$_SESSION['contents'] = $_POST['theMessage'];
$_SESSION['flash'] = $_POST['theFlash'];
$_SESSION['reps'] = $_POST['theRep'];
$_SESSION['sendto'] = $_POST['theRecipients'];
$_SESSION['type'] = $_POST['theType'];
$_SESSION['security'] = $_POST['secure'];
$_SESSION['max'] = $_POST['max_char'];
$_SESSION['con'] = $_POST['concat_use'];

$user = $_SESSION['user'];
$pass = $_SESSION['pass'];
$max = $_SESSION['max'];
$length = strlen($_SESSION['contents']);

include("inc/header.inc.php");

if ($access == "forbidden") {
	include("inc/restricted.inc.php");
}
elseif ($access == "locked") {
	include("inc/restricted.inc.php");
}
else {

	$query = "SELECT credits FROM users WHERE username = '$user'"; 
	$result = mysql_query($query);
	
	if (!$result) {
	   echo 'Could not run query: ' . mysql_error();
	   exit;
	}
	$credits = mysql_fetch_row($result);

	if ($length > 160) {
		$no_of_sms = ceil($length/151);
	}
	else { 
		$no_of_sms = 1;
	}

	$_SESSION['required_creds'] = $no_of_sms;
	
	if ($credits[0] >= 0) {
		if ($credits[0] < $no_of_sms) {
			$enough_creds = 'no';
		}
		else {
			$enough_creds = 'yes';
		}
	}
	elseif ($credits[0] == '-1') {
		$enough_creds = 'yes';
	}
	else {
		$enough_creds = 'no';
	}
	
	if ($enough_creds == 'yes') {		
?>
	<html>
		<p align="center">Are you sure you wish to send this message?</p>
		<form method="POST" name="sender_form" action="do_send.php">
		<p align="center"><input type="submit" value="Send Messages" name="B1"></p>
		</form>	
		<form method="POST" name="sender_form" action="user_send.php">
		<p align="center"><input type="submit" value="Cancel" name="B1"></p>
		</form>	
	</html>
	<? 
	}
	else {
		echo "There are not enough credits remaining on your account, please top up and try again";
	}
}
include("inc/footer.inc.php");
?>
Return current item: Simple SMS Site Software