I can get everything to work fine if I'm running it from my root dir, however, as I am inserting it in to my PHP-Nuke 6.8 site at www.foook.com I have a few problems.
I have managed to get it almost working, but when I hit SEND, it comes back with "You can't access this file directly...", I have re-named web_send.php to index.php in the sms_web_sender dir and wraped the script in a module for php-nuke.
Below is the code
Code:
<?php
if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
//get_lang($module_name);
include("header.php");
$index = 0;
OpenTable();
/*
This file demonstrates SMS message and site details being submitted through HTML
form and then passed to SMS Web Sender.
*/
// for debugging reasons we enable all error reporting
error_reporting (E_ALL);
// include required classes
// SMS Web Sender requires HTTP Navigator 2.2 or later, you must define
// HTTPNAV_ROOT as SMS_Web_Sender will use it to find the relevant classes
define('HTTPNAV_ROOT', realpath('../http_navigator/classes/').'/');
require_once('classes/SMS_Web_Sender.php');
// set debug level
// Debug::level(DEBUG_OUTPUT_FILENAME);
// Debug::level(DEBUG_OUTPUT_FILENAME | DEBUG_OUTPUT_LINE);
// create instance of SMS_Web_Sender
$sws =& new SMS_Web_Sender();
// smssend sites
// by default smssend sites found in the smssend_sites folder can be used
// to disable smssend sites you can call set_allow_smssend()
// $sws->set_allow_smssend(false);
// get_site_names() returns an indexed array of site names which can be used
// in a form select field.
$sites = $sws->get_site_names();
// message we display on our page
$message = 'To Send a SMS Message just Select the Network from the drop down list, enter your Mobile Phones Web Site User Name and Passowrd (the user name and password you would use to log into your Networks Web Site) and the Number you wish the message to go to. This will use 1 of your texts from your Networks Web Site, on O2 for example, you get 30 FREE Texts each month.';
// check if form submitted
if (isset($_POST['site'])) {
if (!$sws->add_site($_POST['site'], $_POST['username'], $_POST['password'])) {
$message = 'Error trying to use site, please try a different site';
} else {
// lets grab debug info, obviously you wouldn't want this on your own
// site as it reveals a lot (including login details)
ob_start();
// attempt send
// rewrite message here
$msg = $_POST['message'];
$msg = 'Sent via foook.com: '.$msg;
if ($sws->send($_POST['ccode'], $_POST['number'], $msg)) {
$message = "Sent!";
} else {
$message = "Sorry, couldn't send :(";
}
//$debug = ob_get_contents();
ob_end_clean();
//$debug = '<textarea name="textfield" cols="50" rows="7">'.htmlspecialchars($debug).'</textarea>';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Foook.com - SMS Web Sender</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<div align="center">
<h2>Foook.com SMS Web Sender</h2>
<p><b><?php echo $message; ?></b></p>
<?php if (isset($debug)) echo '<p>',$debug,'</p>'; ?>
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum