You are missing our premiere tool bar navigation system! Register and use it for FREE!

•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
· Home
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 508 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - You can't access this file directly... SMS-Module [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message

Joined: Feb 21, 2004
Posts: 180

Location: Gloucestershire

PostPosted: Tue May 25, 2004 7:44 am Reply with quoteBack to top

I have Installed SMS web sender on my server.

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


if (!eregi("modules.php", $PHP_SELF)) {
   die ("You can't access this file directly...");

$module_name = basename(dirname(__FILE__));
$index = 0;
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/').'/');

// set debug level

// 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)
        // attempt send
        // rewrite message here
        $msg = $_POST['message'];
        $msg = 'Sent via '.$msg;
        if ($sws->send($_POST['ccode'], $_POST['number'], $msg)) {
            $message = "Sent!";
        } else {
            $message = "Sorry, couldn't send :(";
        //$debug = ob_get_contents();
        //$debug = '<textarea name="textfield" cols="50" rows="7">'.htmlspecialchars($debug).'</textarea>';


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<title> - SMS Web Sender</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<div align="center">
  <h2> SMS Web Sender</h2>

    <p><b><?php echo $message; ?></b></p>

    <?php if (isset($debug)) echo '<p>',$debug,'</p>'; ?>

  <form name="form" method="post" action="modules/sms_web_sender/index.php">
    <table border="0" cellspacing="2" cellpadding="4">
        <td align="right">Select a site</td>
        <td align="left"><select name="site" id="site">
            foreach ($sites as $site) {
                $selected = (($site == @$_POST['site']) ? ' selected="selected"' : '');
                echo '<option value="',$site,'"',$selected,'>',$site,'</option>';
        <td align="right">Username for site</td>
        <td align="left"><input name="username" type="text" id="username" value="<?php echo @$_POST['username']; ?>" /></td>
        <td align="right">Password for site</td>
        <td align="left"><input name="password" type="password" id="password" /></td>
        <td align="right">Country code</td>
        <td align="left">+
          <input name="ccode" type="text" id="ccode" value="44" size="4" maxlength="4" value="<?php echo @$_POST['ccode']; ?>" /></td>
        <td align="right">Number (including initial '0')</td>
        <td align="left"><input name="number" type="text" id="number" value="<?php echo @$_POST['number']; ?>" /></td>
        <td align="right">Message</td>
        <td align="left"><textarea name="message" cols="50" rows="7"><?php echo htmlspecialchars(@$_POST['message']); ?></textarea></td>
        <td align="left"><input type="submit" name="Submit" value="Send!" /></td>


As you can see I have had to change this line of code to make it go back to index.php

<form name="form" method="post" action="modules/sms_web_sender/index.php">

This is when I get the error, as it won't allow anything to access the file directly.

Anyone know how to get round this for PHP-Nuke?

Free Dating
Courier Service Foook It!
Find all posts by djaleccView user's profileSend private messageVisit poster's website
Nuke Soldier
Nuke Soldier

Joined: May 28, 2003
Posts: 22

PostPosted: Wed Jul 28, 2004 1:01 pm Reply with quoteBack to top

Did you get this worked out yet - I thinl I see the problem, but won't go into it - if you have fixed or abandoned. Laughing
Find all posts by ShepView user's profileSend private message
Site Admin
Site Admin

Joined: Aug 17, 2003
Posts: 12482

PostPosted: Wed Jul 28, 2004 7:34 pm Reply with quoteBack to top


Helping those that help themselves
Read FIRST or DIE!

"Fighting is terrible, but not as terrible as losing the will to fight."
Star Wars Rebellion Network - Need Help? Evaders Squadron Coding
Find all posts by Evaders99View user's profileSend private messageVisit poster's websiteAIM Address
Nuke Cadet
Nuke Cadet

Joined: Jun 17, 2006
Posts: 2

PostPosted: Sat Jun 17, 2006 5:48 am Reply with quoteBack to top

Has any one got this module to work with PHP Nuke ???
Find all posts by youdownloaditView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
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

Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003
:: FI Theme :: PHP-Nuke theme by coldblooded ( ::
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.135 Seconds - 197 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded ( ::