SMS/E-Mail Ticker

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikymoon
Forum Newbie
Posts: 5
Joined: Wed Apr 07, 2004 4:14 am

SMS/E-Mail Ticker

Post by mikymoon »

Hi,
I have put the SMS/E-Mail Ticker classes in a subdirectory wwww.mallorca.com/mesages/
class.Ticker.inc.php
class.TickerBase.inc.php
class.TickerMessage.inc.php
index.php

But when I try to acces to the index.php it ahows an error that says :No page found.
I post the beggining of the index.php becouse im sure the rest is ok.

<?php

ob_start();
session_start();
include_once('class.Ticker.inc.php');
$t = new Ticker(20);
$list = $t->getMessageList();

echo '<?xml version="1.0" encoding="iso-8859-1"?>'; ?>
<!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>Dinos si hace viento !!!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="doc.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
<!--
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

include('messages/class.Ticker.inc.php') should do it
mikymoon
Forum Newbie
Posts: 5
Joined: Wed Apr 07, 2004 4:14 am

Post by mikymoon »

Thanks, but it does not work.
If i include('messages/class.Ticker.inc.php') it shows that the path is incorrect. :cry:
mikymoon
Forum Newbie
Posts: 5
Joined: Wed Apr 07, 2004 4:14 am

Post by mikymoon »

Thanks but it does not work. :cry:

I dont know what is happening¡¡¡¡¡
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

Oh, it says page not found? Well then there's something wrong with your server. Is it locally served? If so, are you sure you have it in the right folder?
mikymoon
Forum Newbie
Posts: 5
Joined: Wed Apr 07, 2004 4:14 am

Post by mikymoon »

yes , becouse the other php classes works ok.

only this one :twisted: :twisted:
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

can you elaborate on the error - is it an IE error or a PHP error and so on
mikymoon
Forum Newbie
Posts: 5
Joined: Wed Apr 07, 2004 4:14 am

Post by mikymoon »

The error is on IE ,it sais , (I transate from Spanish)

at the very top says: the server cannot be found-IE
then into the page:the page cannot be found.

MOD EDIT: Please enlcose your code with the BBCode PHP tags

As I told you Is the sms-e-mail triker : the config is in ticker_settings.php


<?php die(); // DO NOT REMOVE THIS LINE ?>
; Default settings for the ticker classes
;
; This ini file + all classes should be placed OUTSIDE the www directory!
; You can change the path in the TickerBase class.

[Mailbox]
; Mailserver informations
mail_server = "mail.mallorcaviento.com"
; "IMAP" or "POP3"
mail_server_type = "POP3"
; POP3 normally 110, for IMAP 143
mail_server_port = 110
mail_server_ssl = FALSE
; self-signed certificate
mail_server_sc = FALSE
; normally INBOX
folder = INBOX
email = "mensajes@myserver.com"
password = "xxxx"

[Settings]
; delete the mail which are beyond the listsize when creating a new ticker object
delete_old_mails = TRUE
; delete the mail if the start string isn't correct or it it is from a user NOT on the whiltelist (if set)
delete_false_mails = FALSE
; maximum length of a single ticker message (maximum limit is 255)
max_length = 250
; string the message body or subject of the mail/sms has to start with, otherwise will be deleted (spam protection)
start_string = "MV "
; All text after this string will be deleted from the message body (to prevent displaying the ads most carriers add to the message)
end_string = "+-+"
; if you want to restrict the list of possible authors to write ticker messages, add their e-mail address or parts of it to the whilelist. example: "@domain.com,me@you.com". leave empty if everybody is allowed to post
whitelist = ""
; backup the mails to the database which are beyond the listsize when creating a new ticker object
db_backup = FALSE
; how long should the cookie be set in seconds if the message is added though the addTickerMessage method
spamprotection = 120

[DB]
; following options are only important if you use modus mysql, change them to fit your database
host = "localhost"
user = "root"
password = ""
database = "ticker"
translation_table = "ticker_backup"




Then it has the index.php


<?php

ob_start();
session_start();
include_once('class.Ticker.inc.php');
$t = new Ticker(20);
$list = $t->getMessageList();

echo '<?xml version="1.0" encoding="iso-8859-1"?>'; ?>
<!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>Dinos si hace viento !!!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="doc.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">

function Ticker(name, id, shiftBy, interval) {
this.name = name;
this.id = id;
this.shiftBy = shiftBy ? shiftBy : 1;
this.interval = interval ? interval : 100;
this.runId = null;
this.div = document.getElementById(id);
var node = this.div.firstChild;
var next;

while (node) {
next = node.nextSibling;
if (node.nodeType == 3)
this.div.removeChild(node);
node = next;
}

this.left = 0;
this.shiftLeftAt = this.div.firstChild.offsetWidth;
this.div.style.height = this.div.firstChild.offsetHeight;
this.div.style.width = 2 * screen.availWidth;
this.div.style.visibility = 'visible';
}

function startTicker() {
this.stop();
this.left -= this.shiftBy;

if (this.left <= -this.shiftLeftAt) {
this.left = 0;
this.div.appendChild(this.div.firstChild);
this.shiftLeftAt = this.div.firstChild.offsetWidth;
}

this.div.style.left = (this.left + 'px');
this.runId = setTimeout(this.name + '.start()', this.interval);
}

function stopTicker() {
if (this.runId)
clearTimeout(this.runId);

this.runId = null;
}

function changeTickerInterval(newinterval) {

if (typeof(newinterval) == 'string')
newinterval = parseInt('0' + newinterval, 10);

if (typeof(newinterval) == 'number' && newinterval > 0)
this.interval = newinterval;

this.stop();
this.start();
}

/* Prototypes for Ticker */
Ticker.prototype.start = startTicker;
Ticker.prototype.stop = stopTicker;
Ticker.prototype.changeInterval = changeTickerInterval;

var ticker = null;

function setTickerSpeed() {
ticker.changeInterval(document.forms.frmTickerSpeed.speed.value);
}

function startticker() {
ticker = new Ticker('ticker', 'tickerID', 1, document.forms.frmTickerSpeed.speed.value);
ticker.start();
}
// -->
</script>
<style type="text/css">
<!--
.ticker {
padding: 2px 0px;
background-color: white;
position: relative;
visibility: hidden;
left: 0px;
top: 0px;
border-width: 1px;
border-style: solid;
font-size: 12px;
font-weight: bold;
width: 100%;
}
-->
</style>
</head>
<body>
<h1><font color="#0000CC" size="6"><u>&iquest;Estas en un spot y ves que hace
viento?</u></font></h1>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Anda, s&eacute;
buen chico y avisa a la pe&ntilde;a :) ... <br />
Envia un <acronym title="Short Message Service" lang="en" xml:lang="en">SMS</acronym>
o email a <strong><font size="3">sms@mallorca.us</font></strong> . El mensaje
ha de empezar con <strong><font size="3">"<?php echo $t->getStartString(); ?>"</font></strong>
. Solo se mostrar&aacute;n los 160 primeros car&aacute;cteres. Para mandar un
SMS a una cuenta de correo electr&oacute;nico desde tu operador de telefon&iacute;a
m&oacute;vil consulta esta p&aacute;gina (TODAVIA HE DE HACERLA ... o a ver
si encuentro un lugar donde ya est&eacute; hecha .. jeje).<br />
<br />
- <strong>Ejemplo usando un movil vodafone/airtel (<a href="http://www.vodafone.es/Vodafone/PSParti ... m&aacute;s
info aqu&iacute;</a>):</strong><br />
Redactas un SMS con este contenido y lo mandas al n&uacute;mero 178: <br />
<font color="#FF0000">sms@mallorca.us#ASUNTO#<strong>mv</strong> Hace fuerza
4 de SW en Can Pastilla. Est&aacute; Racheado pero va subiendo.<br />
</font></font></p>
<h2>&Uacute;ltimos <?php echo $t->getListSize(); ?> Mensajes</h2>
<?php
// to add a message though a form for example use this method.
if ($t->hasMessageWritten() === FALSE && isset($_POST['Submit'])) {
$t->addTickerMessage($_POST['t_message'],$_POST['t_name']);
} // end if

$singlestring = '';
foreach ($list as $id) {
$m = $t->getMessage($id);
echo '<p style="font-size:0.6em;border-bottom: 1px solid #333;"><b>ID:</b> ' . $m->getID() . '<br />';
echo '<b>Date:</b> ' . date('Y-m-d H:i:s',$m->getTimestamp()) . '<br />';
echo '<b>Message:</b> ' . htmlentities(strip_tags($m->getText())) . '</p>';
$singlestring .= '<span>' . htmlentities(strip_tags($m->getText())) . ' <span style="color:red">+++</span> </span>' . "\n";
} // end foreach
?>
<h2>&nbsp;</h2>
<div style="position: relative; height: 20px; width: 100%; overflow: hidden;">
<div name="tickerspace" id="tickerID" class="ticker">
<?php echo $singlestring; ?>
</div>
</div>
<form name="frmTickerSpeed">
<input type="hidden" id="speed" name="speed" value="20" size="4" />
<!--Ticker Speed <input type="text" id="speed" name="speed" value="20" size="4" /> ms&nbsp;
<button type="button" onclick="ticker.stop();" style="color:red; font-weight:bold">Stop</button>
<button type="button" onclick="setTickerSpeed();ticker.start();" style="color:green; font-weight:bold">Play</button>
<button type="button" onclick="setTickerSpeed()">Set Ticker Speed</button>-->
</form>
<hr />
<p> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">Si no tienes movil
ni email (hay alguien que todavia no tenga? ) ... pero tienes una vista privilegiada
sobre el mar en alg&uacute;n spot, usa el siguiente formulario para enviar tu
mensaje (m&aacute;ximo 160 caracteres). <font size="3"><strong>El mensaje puede
se tardar unos minutos en aparecer. </strong></font></font></p>
<?php if ($t->hasMessageWritten() === FALSE) { ?>
<form name="ticker" id="ticker" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

<p>
<fieldset>
<strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<legend>A&ntilde;ade el mensaje aqu&iacute;:</legend>
</font></strong><font size="2"> </font>
<label for="t_message"></label>
<br />
<textarea name="t_message" id="t_message" cols="50" rows="3"></textarea>
<br />

<label for="t_name">Tu nombre</label>
<input type="text" name="t_name" id="t_name" />
<br />
<input type="submit" name="Submit" id="Submit" value="Enviar" />
</fieldset>&nbsp;
</p>
</form>
<?php } ?>
<hr />
<script language="javascript" type="text/javascript">
<!--
startticker();
// -->
</script>
</body>
</html>
<?php
ob_end_flush();
?>


Then the other classes.

I have it all in the same directory. http://www.mallorcaviento.com/mensajes/

It is possible that some one will try it ?
Thanks a lot
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

I think there's something wrong with your permissions - is this php file in the same folder as all the other ones that work?
Post Reply