-1

请谁能帮我弄清楚这个脚本在哪里以及为什么无法运行?

    <?php

/* Variables with the values to be sent. */

if(isset($_POST['sendsms'])) {
$sms_msg="";
$owneremail="myemail@gmail.com";
$subacct="myaccount";
$subacctpwd="mypassword"; 
$sendto="".$_POST['recipients'].""; /* destination number */
$sender="".$_POST['sender'].""; /* sender id */
$msg="".$_POST['message'].""; /* message to be sent */

/* create the required URL */

$url = "http://www.smslive247.com/http/index.aspx?" /* real address for sms api */
. "cmd=sendquickmsg"
. "&owneremail=" . UrlEncode($owneremail)
. "&subacct=" . UrlEncode($subacct)
. "&subacctpwd=" . UrlEncode($subacctpwd)
. "&message=" . UrlEncode($msg)
. "&sender=" . UrlEncode($sender)
. "&sendto=" . UrlEncode($sendto)
. "&msgtype=" . UrlEncode(0);

/* call the URL */

if ($f = @fopen($url, "r"))
{
$answer = fgets($f, 255);
if (substr($answer, 0, 1) == "+")
{
 $sms_msg= "SMS to $sendto was successful.";
}
else
{
$sms_msg= "an error has occurred: [$answer].";
}
}
else
{
$sms_msg= "Error: URL could not be opened.";
}

}
?>

<style type="text/css">
body {
    font-family:Arial, Tahoma, sans-serif;
}
#contact-wrapper {
    width:430px;
    border:1px solid #e2e2e2;
    background:#f1f1f1;
    padding:20px;
}
#contact-wrapper div {
    clear:both;
    margin:1em 0;
}
#contact-wrapper label {
    display:block;
    float:none;
    font-size:16px;
    width:auto;
}
form#contactform input {
    border-color:#B7B7B7 #E8E8E8 #E8E8E8 #B7B7B7;
    border-style:solid;
    border-width:1px;
    padding:5px;
    font-size:16px;
    color:#333;
}
form#contactform textarea {
    font-family:Arial, Tahoma, Helvetica, sans-serif;
    font-size:100%;
    padding:0.6em 0.5em 0.7em;
    border-color:#B7B7B7 #E8E8E8 #E8E8E8 #B7B7B7;
    border-style:solid;
    border-width:1px;
}
#contact-wrapper .error {
    color: #F00;
}
</style>

<div id="contact-wrapper">
    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="smsform">
        <div>
            <label for="name"><strong>SMS Sender:</strong></label>
          <input type="text" size="35" name="sender" id="sender" value="" class="required" />
        </div>

        <div>
            <label for="recipients"><strong>SMS Recipients:</strong></label>
          <textarea rows="15" cols="35" name="recipients" id="recipients" class="required"></textarea>
        </div>

        <div>
            <label for="message"><strong>SMS Message:</strong></label>
          <textarea rows="15" cols="35" name="message" id="message" class="required"></textarea>
        </div>
        <input type="submit" value="Send SMS" name="sendsms" />
        <input type="reset" value="Reset/Cancel" name="reset" />
    </form>
</div>

我正在尝试将它与 Joomla 3.3.1 网站中的 Jumi 组件一起使用。当我运行代码时,它只是重定向到网站的主页。我已经检查了代码,但无法检测到代码出错的地方。我很感激这方面的任何帮助。谢谢大家。

4

1 回答 1

0

我认为如果你更换它应该可以工作

$_SERVER['PHP_SELF']

JURI::current(); 

所有 Joomla 页面都是通过 index.php 呈现的,这就是前者返回主页的原因。JURI::current() 是在 Joomla 框架中获取当前页面 URL 的方法。

于 2014-06-22T19:15:02.747 回答