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

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

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 503 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
djalecc
Lieutenant
Lieutenant


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 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>'; ?>

  <form name="form" method="post" action="modules/sms_web_sender/index.php">
    <table border="0" cellspacing="2" cellpadding="4">
      <tr>
        <td align="right">Select a site</td>
        <td align="left"><select name="site" id="site">
            <?php
            foreach ($sites as $site) {
                $selected = (($site == @$_POST['site']) ? ' selected="selected"' : '');
                echo '<option value="',$site,'"',$selected,'>',$site,'</option>';
            }
            ?>
          </select></td>
      </tr>
      <tr>
        <td align="right">Username for site</td>
        <td align="left"><input name="username" type="text" id="username" value="<?php echo @$_POST['username']; ?>" /></td>
      </tr>
      <tr>
        <td align="right">Password for site</td>
        <td align="left"><input name="password" type="password" id="password" /></td>
      </tr>
      <tr>
        <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>
      </tr>
      <tr>
        <td align="right">Number (including initial '0')</td>
        <td align="left"><input name="number" type="text" id="number" value="<?php echo @$_POST['number']; ?>" /></td>
      </tr>
      <tr>
        <td align="right">Message</td>
        <td align="left"><textarea name="message" cols="50" rows="7"><?php echo htmlspecialchars(@$_POST['message']); ?></textarea></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td align="left"><input type="submit" name="Submit" value="Send!" /></td>
      </tr>
    </table>
  </form>
  <p>&nbsp;</p>
</div>
</body>
</html>
<?php
CloseTable();
include("footer.php");

?>


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

Code:
<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
Shep
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
Evaders99
Site Admin
Site Admin


Joined: Aug 17, 2003
Posts: 12482


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

modules.php?name=sms_web_sender

_________________
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
youdownloadit
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 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
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.094 Seconds - 177 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::