membuat tabel data polling

CREATE TABLE `data_polling` (
`pilihan` varchar(25) NOT NULL,
`vote` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT
CHARSET=utf8;
– Data pilihan voting
INSERT INTO `data_polling`
VALUES (‘glenn’, 0);
INSERT INTO `data_polling`
VALUES (‘afghan’, 0);
INSERT INTO `data_polling`
VALUES (‘rossa’, 0);
INSERT INTO `data_polling`
VALUES (‘krisdayanti’, 0);

6 April 2011 at 9:49 AM Tinggalkan komentar

scripts lihatvote.php

**********************lihatvote.php
*************************

<!–
*{
font-family:Arial, Helvetica, sans-
serif;}
table{
border-width: 1px 1px 1px 1px;
border-style: dashed dashed
dashed dashed;
border-color: gray gray gray
gray;}
td{
background-color:#CCFFCC;}

<?
$mysql_host = "localhost";
$mysql_database = "polling";
$mysql_user = "root";
$mysql_password = "root";
$dblink=mysql_connect
($mysql_host,$mysql_user,
$mysql_password);
mysql_select_db
($mysql_database,$dblink)
$qsum="select sum(vote) from
data_polling";
$execsum=mysql_query($qsum);
$dsum=mysql_fetch_row
($execsum);
$totvote=$dsum[0];
$qvote="select * from
data_polling";
$execvote=mysql_query
($qvote);
while($dvote=mysql_fetch_row
($execvote)){
$vote=$dvote[1];
$precent=round(($vote/
$totvote)*100,2);
echo"

“;
echo”

“;
}
?>

DATA POLLING
SEMENTARA
$dvote[0]
$precent %

**********************lihatvote.php
*************************

6 April 2011 at 9:46 AM Tinggalkan komentar

web interface nowsms

<?php

function SendSMS ($host, $port, $username, $password, $phoneNoRecip, $msgText) {

/* Parameters:
$host – IP address or host name of the NowSMS server
$port – “Port number for the web interface” of the NowSMS Server
$username – “SMS Users” account on the NowSMS server
$password – Password defined for the “SMS Users” account on the NowSMS Server
$phoneNoRecip – One or more phone numbers (comma delimited) to receive the text message
$msgText – Text of the message
*/

$fp = fsockopen($host, $port, $errno, $errstr);
if (!$fp) {
echo “errno: $errno \n”;
echo “errstr: $errstr\n”;
return $result;
}

fwrite($fp, “GET /?Phone=” . rawurlencode($phoneNoRecip) . “&Text=” . rawurlencode($msgText) . ” HTTP/1.0\n”);
if ($username != “”) {
$auth = $username . “:” . $password;
$auth = base64_encode($auth);
fwrite($fp, “Authorization: Basic ” . $auth . “\n”);
}
fwrite($fp, “\n”);

$res = “”;

while(!feof($fp)) {
$res .= fread($fp,1);
}
fclose($fp);

return $res;
}

/* This code provides an example of how you would call the SendSMS function from within
a PHP script to send a message. The response from the NowSMS server is echoed back from the script.

$x = SendSMS(“127.0.0.1″, 8800, “username”, “password”, “+44999999999″, “Test Message”);
echo $x;

*/

/* This code provides an example of sending a message via NowSMS as the result of a web form posting.

First, here’s a very simple HTML web form that provides an example of what you need in your
web form.

Mobile Number:
Text Message:

Second, here’s the PHP script that would parse the parameters from the form posting, and then call
the SendSMS function to submit the message.

if (isset($_REQUEST['phone'])) {
if (isset($_REQUEST['text'])) {
$x = SendSMS(“127.0.0.1″, 8800, “username”, “password”, $_REQUEST['phone'], $_REQUEST['text']);
echo $x;
}
else {
echo “ERROR : Message not sent — Text parameter is missing!\r\n”;
}
}
else {
echo “ERROR : Message not sent — Phone parameter is missing!\r\n”;
}

*2/

?>

31 Maret 2011 at 6:38 PM Tinggalkan komentar


Selamat Datang di
www.siwenarea.wordpress.com

Posting Terbaru

RSS Berita terkini

  • Sebuah galat telah terjadi; umpan tersebut kemungkinan sedang anjlok. Coba lagi nanti.

Statistik

  • 1,499 Pengunjung

0nline counter

Kritik dan saran

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Terima kasih telah berkunjung. O ya.. jangan lupa untuk meninggalkan komentarnya

siwen° ©2010


Ikuti

Get every new post delivered to your Inbox.