Re: [PHP-DB] PHP Shell Script

2002-11-26 Thread Matt Vos
The exec command, if passed a variable as a second argument, will output the
retun of the command to that array, one object per line.
In its default use, it will retun only the last line.

You may instead wnat to use the cURL functions within PHP to request pages
from a server. You may find more functionality in that.

Matt
- Original Message -
From: Afif <[EMAIL PROTECTED]>
To: PHP DB <[EMAIL PROTECTED]>
Sent: Monday, November 25, 2002 8:51 PM
Subject: [PHP-DB] PHP Shell Script


> Dear All,
>
> I  have  question  about  syntax  to  make http request and send email
> through CLI command
>
> I have script while the sender [Mobile Phone] send sms to my gateway and
then if
> their  request have right result, the gateway will reply back to their
> mobile  phone, but if the result is nothing, the sms gateway will send
> an email to webmaster
> here  is  my php script, pls revise if my script have some thing wrong
> or missing
>
>
> #!/usr/local/bin/php -q
>  // file name : pickup.php
> // Ambil data last row di table sms_store
>
> include "setup.php";
>
> $query = "SELECT * from sms_store where smsc='Receive SMS' ORDER BY
sms_number DESC LIMIT 0,1";
> $result = mysql_query($query);
> if (!$result) error_message(sql_error());
>
>   // show field for current row
>   while($show = mysql_fetch_array($result)) {
>   $sms_time=$show["sms_time"];
>   $smsc=$show["smsc"];
>   $org_sms=$show["org_sms"];
>   $dest_sms=$show["dest_sms"];
>   $msg_content=$show["msg_content"];
>
>   // pemisahan char di msg_content berdasarkab rule
>   // 1 untuk Menampilkan Summary dari IP,IPK dan IP sem kermarin dari
sender
>   // 2 untuk menampilkan nila per KODE mata kuliah sender pada current
semester
>   // kemudian baru di ikuti nomor NBI dari sender
>   // Sementara ini coba langusung ke NBI aja ya...
>
>   //  $rule = substr($show["msg_content"],0,1);   //nah ini belum di
berlakukan
>   // sementara pake ini dulu --> Langsung tulis NBI nya aja
>   $matang=substr($show["msg_content"],0,9);
>
>   $sms_time = substr($show["sms_time"],6,2).'-'.
>   substr($show["sms_time"],4,2).'-'.
>   substr($show["sms_time"],0,4).' - '.
>   substr($show["sms_time"],8,2).':'.
>   substr($show["sms_time"],10,2).':'.
>   substr($show["sms_time"],12,2);
>
>   echo "Waktu : $sms_time ";
>   echo "Action : $smsc ";
>   echo "Dari : $org_sms ";
>   echo "Ke : $dest_sms ";
>   echo "Isi SMS : $msg_content ";
>   echo "";
>
>   echo "Isi MSG Content : $matang ";
>   echo "";
>
>   //Sekarang query ke DB MHS
>   $cari_nbi= "SELECT * FROM m_mhs where nbi = $matang";
>   $ketemu = mysql_query ($cari_nbi);
>
>   if (!$ketemu) then
>   {
>$receipent ="[EMAIL PROTECTED]";
>$subject ="Failed to pickup DATA for $matang";
>$body_mail ="Some on try to get information about IPK by $org_sms
for $nbi";
>
>//Sending email for every failed pickup data to webmaster
>//ini  juga  saya  tanyakan bener tdk untuk kirim email through
>//CLI
>
>mail ($receipent,$subject,$body_mail);
>}
>else
>{  while($tampil = mysql_fetch_array($ketemu)) {
>
>   $nbi=$tampil["nbi"];
>   $nama_mhs=$tampil["nama_mhs"];
>   $current_ip=$tampil["current_ip"];
>   $old_ip=$tampil["old_ip"];
>   $ipk=$tampil["ipk"];
>
>   //tampakan hasil query ke layar;
>
>   echo "Nama = $nama_mhs ";
>   echo "NBI  = $nbi ";
>   echo "IP Sekarang = $current_ip ";
>   echo "IP Lalu = $old_ip ";
>   echo "IPK = $ipk ";
>   }
>
>   // nah ini yg saya tanyakan benerkah syntax nya demikian ..???
>   exec "lynx --dump
>
http://sms.untag-sby.ac.id/cgi-bin/sendsms?username=untag&password=nginden&t
o=$org_sms&text=$nama_mhs+&$nbi+$current_ip+$old_ip+&ipk";
>
> }
> }
> ?>
>
> highly appreciate for yr help
>
> --
> Warm regards,
> Afif
> mailto:[EMAIL PROTECTED]
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Formatting txt from a database

2002-12-12 Thread Matt Vos
$select="select fields from table...";
$sres=mysql_query($select);
echo mysql_error();
while ($srow=mysql_fetch_row($sres))
{
$string=$srow[0];
$no_html=strip_tags($string);
if (strlen($no_html) > 30) $no_html=substr($no_html,0,30)."...";
echo("$no_html");
}

Matt
- Original Message -
From: Lisi <[EMAIL PROTECTED]>
To: PHP-DB <[EMAIL PROTECTED]>
Sent: Thursday, December 12, 2002 3:55 AM
Subject: [PHP-DB] Formatting txt from a database


> I am retrieving text stored in a database, and I want to strip out any
HTML
> tags and then only display the first 30 characters with "..." to show the
> user that there is more text to view.
>
> My problem is with stripping out HTML tags, the code is stripping out the
> text enclosed within the HTML tags as well.
>
> Here is the code I am using:
>
> $pat = "<{1}.+>{1}";
>
> if (ereg("text", $type)){  //if the field type is text look for HTML
> tags to remove
>$content_array[$c] = ereg_replace($pat, '', $content_array[$c]);
>$content_array[$c] = substr($content_array[$c], 1, 30);
>$content_array[$c] = $content_array[$c]."...";
> }
>
> echo $content_array[$c];
>
>
> What should the correct $pat be?
>
> Thanks,
>
> -Lisi
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Question on the port PHP uses to connect to remote MySQL

2003-01-29 Thread Matt Vos
In a default setup, I believe the port is 3306.
Check your MySQL config files, as this can be changed.

Matt
- Original Message - 
From: Louis Feng <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 28, 2003 10:34 PM
Subject: [PHP-DB] Question on the port PHP uses to connect to remote MySQL


> Here is my problem. I have PHP running on one machine, mysql on another 
> one. Everything works fine till I put a firewall on the PHP machine, 
> which blocks pretty much every port there is except port 80. Now, PHP 
> can't connect to the mysql database anymore. If I disable the firewall 
> on the PHP machine it works again. So I eliminate the reasons down to 
> that PHP must uses some port for mysql return the query. The question is 
> which port does PHP use for the connection? I'm NOT talking about 3306 
> which is used by Mysql. Anyone could help? Thanks in advance.
> 
> Louis
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php