Re: [PHP] hello everybody

2012-03-22 Thread Midhun Girish
I think this would be an ideal resource for beginners
http://www.w3schools.com/php/php_forms.asp. I used it when i began php. I
would suggest doing the entire course in there. Really helpful.

Regards
Midhun Girish



On Sun, Mar 18, 2012 at 10:05 PM, Jeremy Wei shuimuqing...@gmail.comwrote:

 you can read the content about form dealing in php manual:
 http://us.php.net/manual/en/tutorial.forms.php

 On Sun, Mar 18, 2012 at 7:34 PM, saeed ahmed mycomputerbo...@gmail.com
 wrote:
  i am a full time warehouse worker and do not have time.i hardly can spend
  2/3 hours a week on internet(at work we do not use internet but only
  computer)i am learning php and have xampp installed on my computer and i
  think i am learning slowly slowly.i want ot ask one favor to someone,who
 is
  capable of doing this small work.i have learned that when visitor fill a
  form after visitor get message with his name.how this function is added
 and
  where?
 
  can anyon give me a example like giving a example to a child of 10
 years.i
  would like if someone explain me.



 --
 JeremyWei(魏志锋,字静之)
 Mob: 18914495716
 新浪微博:@JeremyWei
 QQ: 327493482
 Home: www.weizhifeng.net
 Less is more

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




Re: [PHP] Newbie security database connection question

2011-08-19 Thread Midhun Girish
On Sat, Aug 20, 2011 at 6:22 AM, DealTek deal...@gmail.com wrote:

 Hello,

 NEWBIE: I have a security question:

 When working with PHP and MySQL, it seems that a one method is to create a
 connection.php page to the database that will store the connection
 parameters such as username, password and URL ip in clear text and include
 this on various pages.

 Since hackers seem to be getting better and better every day:

 -  Is this common practice to store this security data in the clear on the
 PHP webpage?

 - Wouldn't it be possible for a hacker to SNIFF around and pick up this
 sensitive clear text security data?

 - Is there some better, more secure way to communicate from the website to
 the MySQL data source that is somehow sending encrypted information rather
 than clear text back and forth?

 Thanks in advance for your help.


You can encrypt the access credentails using some public key encryption
technique like RSA and then decode it inside php before connecting to db...
But still you have to store the private key in plain text somewere...

OR may be you can use 'hard to guess substitution ciphers' [i dunno if tht
exists] or create an encryption logic of your own and then use it to encrypt
the  dataabse uname and pass.

Regards
Midhun Girish


Re: [PHP] saving sessions

2011-08-04 Thread Midhun Girish
On Sat, Aug 6, 2011 at 7:56 AM, wil prim wilp...@me.com wrote:

 Hello, im new to the whole storing sessions thing and I really dont know
 how to ask this question, but here it goes.  So on my site when someone logs
 in the login.php file checks for a the username and password in the table i
 created, then if it finds a match it will store a $_SESSION [] variable. To
 be exact the code is as follows:
 if ($count=='1')
 {
 session_start();
 $_SESSION['user']=$user;   // $user is the $_POST['user'] from the login
 form
 header('location: login_success.php');
 }

 Now what i would like to know is how do i make my website save new changes
 the user made while in their account?

 thanks!



You will have to store the user account related data in the database for
persistence Or if the site not having a 'user account system'  you may
use cookies to store the settings...



Midhun Girish


Re: [PHP] Fwd: ezmlm warning

2011-07-20 Thread Midhun Girish
On Wed, Jul 20, 2011 at 2:41 PM, Lester Caine les...@lsces.co.uk wrote:

 Tamara Temple wrote:

 Um... what's going on here? Why would google mail be bouncing??

 Happens quite often ... just means that an email server has hickupped
 somewhere so an email addressed to you has not got through '76.75.200.58'
 which I think is the same machine address on the message a deleted this
 morning for my email address

 --


I too got this message once today. Is it a problem with the list?


Midhun Girish


[PHP] Report generation as pdf and csv in php application for huge record set

2011-07-13 Thread Midhun Girish
Hi all,

I have an erp application developed in php (zend framework actually). There
are many reports which the admin level users can take from the application.
Some reports have more than 600,000 records. The viewing of reports in the
browser is fine as i have paginated the result. But when it comes to
exporting the entire report as pdf and in excel format, im in trouble. I use
fpdf for pdf generation and  a custom class for converting result to excel.
Both these fails when the number of records exceeds 500. Now i have
pagianted the report generation and users can download the pdf page wise.
But that is not the exact requirement. Im in need of a tool to generate pdf
and excel(or csv) for large data set. I came across
http://www.htmldoc.org/when i googled for one. Has anyone in the list
has faced a similar problem.
How exactly is report generation possible when the number of records is
extremely huge? Is there a good solution which can be implemented in php?
Please help.


Midhun Girish


Re: [PHP] Report generation as pdf and csv in php application for huge record set

2011-07-13 Thread Midhun Girish
Hi,


 - Browsers generally have a 5 minute time-out. If you send the PDF directly
 to the browser and reach the limit, it will be lost. It is therefore advised
 for very big documents to generate them in a file, and to send some data to
 the browser from time to time (with a call to flush() to force the output).
 When the document is finished, you can send a redirection to it or create a
 link.
 Remark: even if the browser times out, the script may continue to run on
 the server.
  http://www.php.net/unsub.php


When it comes to the user end, they wont wait for more than 1 min. So
redirection after generating the report is not possible. But creating link
may be a good idea. How can it be done? I mean shouldn't there be a service
running in the server to process these request after the execution of the
php script is completed? Also shouldn't we post all the report generation
request to a database so that serial processing can be done?


Re: [PHP] Zend Framework - getParam() Question

2011-03-11 Thread Midhun Girish
You can also try routing in zend..
http://codeutopia.net/blog/2007/11/16/routing-and-complex-urls-in-zend-framework/

Midhun Girish



On Sat, Mar 12, 2011 at 11:16 AM, NetEmp net.ser...@gmail.com wrote:

 Hi Dan

 One method for this is to use URL Rewriting (which can be implemented on
 Apache using htaccess).

 Through URL Rewriting you can first make the following URL:

 http://www.website.com/article-clean-url

 http://www.website.com/article-clean-urlto internally behave as the
 following:

 http://www.website.com/index/user/ http://www.website.com/index/user/11

 http://www.website.com/index/user/1and then you can use the same
 getParam
 method to grab the value and carry out further processing.

 Hope this helps.

 Cheers

 NetEmp

 On Sat, Mar 12, 2011 at 10:04 AM, Dan Joseph dmjos...@gmail.com wrote:

  Hi Everyone,
 
  Zend Framework getParam question
 
  I'm trying to get a value from the url...
 
  I know how to grab:
 
  http;//www.website.com/index/user/1
 
  that's the index controller, $this-_getParam('user'); (value = 1)..
 
  What I'd like to be able to grab is just off one thing from the url...
  example..  I want to give an article a unique/clean url... so, when I go
  to:
 
  http://www.website.com/article-clean-url
 
  I can somehow grab that 'article-clean-url' as a value and use it for a
  lookup in the database.
 
  I've tried everything and search all over the place.  I can't find the
  answer.  Can someone tell me how this is done?  Thanks...
 
  --
  -Dan Joseph
 



Re: [PHP] My truth comes out [1]

2010-10-21 Thread Midhun Girish
Really interesting thread :D . Why go for other methods when you can
do it easily using if Is this an exercise or something?


Midhun Girish
Development Lead
MobAlive Technologies
Trivandrum


[PHP] A mysql question...

2010-10-21 Thread Midhun Girish
hai all,

I have two tables a and b as follows to implement a simple block list where
users can block other users.
Table A

++--+--+

| Name | phone |userid|

++--+--+

| Mr Sasi | 01225 708225 | 1 |

| Miss Brown | 01225 899360 | 2 |

| Mr Black | 01380 724040 | 3 |

++--+--+
Table B

++--+

| blockedbyid| blockedid |

++--+

| 1  | 2 |

| 2 | 3 |

| 1 | 3 |

++--+

blockedbyid is id of user who has blocked the user in blockedid.

I need to join the two tables and fetch all records from table A such that
the result has all users who are not blocked by a particular user [ie
blockedbyid='XXX'].. Can you guys give the SQL query so that i can fetch the
records as a recordset??? I dont want to fetch two different rowsets and
compare it in php Correct me if my db structure is wrong.
regards,
Midhun Girish


Re: [PHP] What is app.php?ph=cusid=4?

2010-06-04 Thread Midhun Girish
Depends on the server side language u intend to use...
In php u can get those data via the super global array $_GET.. And u can
use it anyway u want...


Midhun Girish
Development Lead
MobAlive Technologies


On Fri, Jun 4, 2010 at 7:45 PM, Michael Calkins michaelcalk...@live.comwrote:


 How is it used for a website then?

 From,Michael Calkins



  From: a...@ashleysheridan.co.uk
  To: michaelcalk...@live.com
  CC: php-general@lists.php.net
  Date: Fri, 4 Jun 2010 14:59:15 +0100
  Subject: Re: [PHP] What is app.php?ph=cusid=4?
 
  On Fri, 2010-06-04 at 06:54 -0700, Michael Calkins wrote:
 
   I would google this but I have no idea what this method is or how it
 works.
   app.php?ph=cusid=4
   Can some tell me what this either called or how it works?Can I get a
 tutorial for it please?
   Thank you!
  
   From,Michael Calkins
  
  
 elementFontfont-familyfont-sizefont-stylefont-variantfont-weightletter-spacingline-heighttext-decorationtext-aligntext-indenttext-transformwhite-spaceword-spacingcolorBackgroundbg-attachmentbg-colorbg-imagebg-positionbg-repeatBoxwidthheightborder-topborder-rightborder-bottomborder-leftmarginpaddingmax-heightmin-heightmax-widthmin-widthoutline-coloroutline-styleoutline-widthPositioningpositiontopbottomrightleftfloatdisplayclearz-indexListlist-style-imagelist-style-typelist-style-positionTablevertical-alignborder-collapseborder-spacingcaption-sideempty-cellstable-layoutEffectstext-shadow-webkit-box-shadowborder-radiusOtheroverflowcursorvisibility
   _
   The New Busy think 9 to 5 is a cute idea. Combine multiple calendars
 with Hotmail.
  
 http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
 
 
  That's a URL with GET data. It's not anything special to PHP, it's just
  the way data can be passed around in the URL.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 

 elementFontfont-familyfont-sizefont-stylefont-variantfont-weightletter-spacingline-heighttext-decorationtext-aligntext-indenttext-transformwhite-spaceword-spacingcolorBackgroundbg-attachmentbg-colorbg-imagebg-positionbg-repeatBoxwidthheightborder-topborder-rightborder-bottomborder-leftmarginpaddingmax-heightmin-heightmax-widthmin-widthoutline-coloroutline-styleoutline-widthPositioningpositiontopbottomrightleftfloatdisplayclearz-indexListlist-style-imagelist-style-typelist-style-positionTablevertical-alignborder-collapseborder-spacingcaption-sideempty-cellstable-layoutEffectstext-shadow-webkit-box-shadowborder-radiusOtheroverflowcursorvisibility
 _
 Hotmail is redefining busy with tools for the New Busy. Get more from your
 inbox.

 http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2


Re: [PHP] Beginner's question: How to run a PHP web application locally?

2010-04-08 Thread Midhun Girish
The best option in windows would be xampp or wamp same goes true
with linux.


Midhun Girish



On Thu, Apr 8, 2010 at 5:12 PM, Bastien Helders eldroskan...@gmail.com wrote:
 Hi List,

 The other day, I read an article that mentioned about a tool that would
 permit to simulate a web environment for PHP, so that testing could be made
 before uploading the page on the server. Unfortunately, I don't seem to find
 the article again.

 So here am I with this question: What should I need to set my test
 environment? I'm working on Windows, but I'm all ears for solution on Linux
 systems.

 Best Regards,
 Bastien


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



Re: [PHP] str_replace help

2010-04-02 Thread Midhun Girish
well david actually $var = str_replace(chr(13),\n,$value) will replace
char(13) with \n... but \n wont come up in html unless u give a pre tag..
u need to put

$var = str_replace(chr(13),br/,$value) in order to got the required
output


Midhun Girish


On Fri, Apr 2, 2010 at 7:03 PM, Ashley Sheridan 
a...@ashleysheridan.co.ukwrote:

 On Fri, 2010-04-02 at 09:28 -0400, David Stoltz wrote:

  Hi folks,
 
  In ASP, I would commonly replace string line feeds for HTML output like
  this:
 
  Var = replace(value,vbcrlf,br)
 
  In PHP, the following doesn't seem to work:
  $var = str_replace(chr(13),\n,$value)
 
  Neither does:
  $var = str_replace(chr(10),\n,$value)
 
  What am I doing wrong?
 
  Thanks!


 I see no reason why it shouldn't work other than maybe the string
 doesn't contain what you think it does.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk





Re: [PHP] image upload keeps file name ?

2010-04-01 Thread Midhun Girish
  I use the follwing function for moving files:


public function moveFile($file,$targetdir=../uploads/images/)
  {
$fileName = $file['name'];
$ext = substr($fileName, strrpos($fileName, '.') + 1);
do
{

$targetfilename=md5(date(m.d.y.h.i.s).basename($fileName)).'.'.$ext;
  $fullname=$targetdir.$targetfilename;
}while(file_exists($fullname));
move_uploaded_file($file[tmp_name],$fullname);
return $fullname;
  }


Call the fn as :

foreach($_FILES as $file_name = $filearray)
{
if( $filearray['error']=='')
{
   $filenametobestored=moveFile($filearray);
   /*Enter name into db here*/
}
}


this will make sure you never over write anyfiles..


Midhun Girish

On Thu, Apr 1, 2010 at 3:25 PM, Ashley Sheridan 
a...@ashleysheridan.co.ukwrote:

 of the web
 root, which will prevent people from maliciously uploadi



Re: [PHP] MySQL query not working!

2010-03-31 Thread Midhun Girish
Yes ash.. me too think the same... @ will supress any error which would have
lead to die()... so die() wont come ever

Midhun Girish



On Wed, Mar 31, 2010 at 6:16 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Wed, 2010-03-31 at 16:50 +0430, Parham Doustdar wrote:

  Andre,
  The @ operator is used for error catching statements. When you put:
 
  @mysql_connect('localhost', 'username', 'password') or die('Could not
  connect.');
 
  If PHP fails to make a connection, the script execution is stopped, and
 the
  error message between the apostrophes is given.
 
  And, I found out what the problem was; I should have put:
 
  if (mysql_num_rows($result))
 
  rather than just
 
  if ($result)
 
  Thanks!
  - Original Message -
  From: Andre Polykanine an...@oire.org
  To: Parham Doustdar parha...@gmail.com
  Cc: php-general@lists.php.net
  Sent: Wednesday, March 31, 2010 4:41 PM
  Subject: Re: [PHP] MySQL query not working!
 
 
   Hello Parham,
  
   Adding to Ash's question, why to use the @ operator before
   mysql_query?
   --
   With best regards from Ukraine,
   Andre
   Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon
 @
   jabber.org
   Yahoo! messenger: andre.polykanine; ICQ: 191749952
   Twitter: m_elensule
  
   - Original message -
   From: Parham Doustdar parha...@gmail.com
   To: php-general@lists.php.net php-general@lists.php.net
   Date: Wednesday, March 31, 2010, 2:50:07 PM
   Subject: [PHP] MySQL query not working!
  
   Hi there,
   Here is a snippet of code... that doesn't work for some reason. Please
   note
   that I have put some
  
   @mysql_query($query) or die(mysql_error());
  
   statements, to see if MySQL gives an error. I receive nothing other
 than
   the
   file starting to download. This is supposed to be a file download
 counter:
  
   [code]
   ?php
   //connect to the DB
   mysql_connect() //There is no problem with the connection so I didn't
   include the complete code.
  
   //The table where the hits are stored.
   $table = files;
  
   $query = select * from  . $table .  where filename = ' .
 $_GET['file']
   .
   ';
   $result = mysql_query($query);
  
   if ($result) //Has the file previously been added?
   {
   $query = update  . $table .  set hits = hits + 1 where filename = '
 .
   $_GET['file'] . ';
   @mysql_query($query) or die(mysql_error());
   header('location:http://www.qwitter-client.net/' . $_GET['file']);
   }
   else //it's the first time we're adding this file to the DB.
   {
   $query = insert into  . $table .  (filename, hits) values (' .
   $_GET['file'] . ', 1);
   @mysql_query($query) or die(mysql_error());
   header('location:http://www.qwitter-client.net/' . $_GET['file']);
   }
   ?
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 


 My understanding of the @ here would be that PHP won't register the
 error, so it won't ever die()

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk





Re: [PHP] MySQL query not working!

2010-03-31 Thread Midhun Girish
hey Andrew ,
you are correct thanks for pointing tht.. i should have checked it
before so @ just prevents the warnings and errors from showing up

Midhun Girish


On Wed, Mar 31, 2010 at 6:38 PM, Andrew Ballard aball...@gmail.com wrote:

 On Wed, Mar 31, 2010 at 8:46 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
  On Wed, 2010-03-31 at 16:50 +0430, Parham Doustdar wrote:
 
  Andre,
  The @ operator is used for error catching statements. When you put:
 
  @mysql_connect('localhost', 'username', 'password') or die('Could not
  connect.');
 
  If PHP fails to make a connection, the script execution is stopped, and
 the
  error message between the apostrophes is given.
 
  And, I found out what the problem was; I should have put:
 
  if (mysql_num_rows($result))
 
  rather than just
 
  if ($result)
 
  Thanks!
  - Original Message -
  From: Andre Polykanine an...@oire.org
  To: Parham Doustdar parha...@gmail.com
  Cc: php-general@lists.php.net
  Sent: Wednesday, March 31, 2010 4:41 PM
  Subject: Re: [PHP] MySQL query not working!
 
 
   Hello Parham,
  
   Adding to Ash's question, why to use the @ operator before
   mysql_query?
   --
   With best regards from Ukraine,
   Andre
   Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon
 @
   jabber.org
   Yahoo! messenger: andre.polykanine; ICQ: 191749952
   Twitter: m_elensule
  
   - Original message -
   From: Parham Doustdar parha...@gmail.com
   To: php-general@lists.php.net php-general@lists.php.net
   Date: Wednesday, March 31, 2010, 2:50:07 PM
   Subject: [PHP] MySQL query not working!
  
   Hi there,
   Here is a snippet of code... that doesn't work for some reason. Please
   note
   that I have put some
  
   @mysql_query($query) or die(mysql_error());
  
   statements, to see if MySQL gives an error. I receive nothing other
 than
   the
   file starting to download. This is supposed to be a file download
 counter:
  
   [code]
   ?php
   //connect to the DB
   mysql_connect() //There is no problem with the connection so I didn't
   include the complete code.
  
   //The table where the hits are stored.
   $table = files;
  
   $query = select * from  . $table .  where filename = ' .
 $_GET['file']
   .
   ';
   $result = mysql_query($query);
  
   if ($result) //Has the file previously been added?
   {
   $query = update  . $table .  set hits = hits + 1 where filename =
 ' .
   $_GET['file'] . ';
   @mysql_query($query) or die(mysql_error());
   header('location:http://www.qwitter-client.net/' . $_GET['file']);
   }
   else //it's the first time we're adding this file to the DB.
   {
   $query = insert into  . $table .  (filename, hits) values (' .
   $_GET['file'] . ', 1);
   @mysql_query($query) or die(mysql_error());
   header('location:http://www.qwitter-client.net/' . $_GET['file']);
   }
   ?
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
 
 
  My understanding of the @ here would be that PHP won't register the
  error, so it won't ever die()
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 

 Nope. All it does is suppress the error message. Just try it:

 ?php

 @mysql_connect('localhost', 'baduser', 'badpassword') or die('Could
 not connect');

 ?

 Output:
 Could not connect
 ?php

 @mysql_connect('localhost', 'baduser', 'badpassword') or die('Could
 not connect');

 ?

 Output:
 br /
 bWarning/b:  mysql_connect() [a
 href='function.mysql-connect'function.mysql-connect/a]: Can't
 connect to MySQL server on 'localhost' (10061) in bPHPDocument1/b
 on line b3/bbr /
 Could not connect

 Andrew

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




Re: [PHP] Event Handling

2010-03-15 Thread Midhun Girish
Hi ,
Just as David Hutto has said,What you need is the cronjob... Make a script
say check.php which checks the db to see if any new entries are made...
and if yes send the mail ...

now using the cronjob feature in linux os(which will be provided as a
service in your linux hosting cpanel), set a cronjob which calls the 
http://www.yoursite.com/check.php; URL every minute now a trigger will
be there every minute to the script and the emails will be send irrespective
of whether anyone is browsing the site or not hope it is clear...

Midhun Girish
Development Lead
MobAlive Technologies



On Mon, Mar 15, 2010 at 1:10 PM, David Hutto smokefl...@gmail.com wrote:

 --- On *Mon, 3/15/10, David Hutto dwightdhu...@yahoo.com* wrote:

 From: David Hutto dwightdhu...@yahoo.com
 Subject: Re: [PHP] Event Handling
 To: php-general@lists.php.net, Alex Major p...@allydm.co.uk
 Date: Monday, March 15, 2010, 3:34 AM



 --- On Mon, 3/15/10, Alex Major
 p...@allydm.co.uk
http://us.mc453.mail.yahoo.com/mc/compose?to=...@allydm.co.uk
 wrote:

  From: Alex Major p...@allydm.co.uk
http://us.mc453.mail.yahoo.com/mc/compose?to=...@allydm.co.uk
 
  Subject: [PHP] Event Handling
  To: php-general@lists.php.net
http://us.mc453.mail.yahoo.com/mc/compose?to=php-gene...@lists.php.net
  Date: Monday, March 15, 2010, 2:59 AM
  Greetings all,
 
  I'm currently looking at building a web application,
  however I've run into
  an area of development I've not come across before. The web
  site in its
  basic form allows users to send cars from a point and then
  the car will
  arrive at another point. When the car is set on its way,
  the start time,
  travel duration and end time are all known and stored in a
  MySQL database,
  what I would like to happen is that an event is triggered
  on the server at
  the end time and then an e-mail is sent to the user. This
  should happen
  regardless of whether someone is browsing the website or
  not.
 
  I don't believe that I'll be able to solely use PHP, I have
  spent the
  afternoon trying to look at potential solutions but I have
  to admit I've
  drawn a blank. Google hasn't been helpful (64 pages so
  far), as any searches
  related to event handling bring up a load of JavaScript
  tutorials/help for
  'onclick' events etc. I have searched through the PHP
  documentation and
  found libevent (http://www.php.net/manual/en/book.libevent.php ), I
  don't
  believe that is what I require (although in all honesty the
  lack of
  documentation on it means I'm quite in the dark as to its
  purpose). Another
  potential candidate I came across was a PHP/Java bridge
  (http://php-java-bridge.sourceforge.net/pjb/ ), whereby
  I could use the java
  virtual machine, register events with it and then callback
  PHP scripts,
  although this seems extremely long winded.
 
  I was hoping that someone might have some experience with
  this kind of issue
  and could point me in the right direction. I'm sure I've
  missed something
  right in front of me.
 
  Alex.
 
 

 I'm a noob at php myself, but what you might want to look at is cron jobs
 and autoresponders. Here's an address to one I've messed with before:
 infinite.ibasics.biz/ I believe it uses cron jobs, I've messed with a lot
so
 it's hard to recall.

 You might want to have the web app insert the new info in the tables, and
 have the cron job and script do the rest.

 David


Re: [PHP] Re: Event Handling

2010-03-15 Thread Midhun Girish
hey ash,

do we need both of those checks ? ie the time and the flag? i think they
both do the same thing ie prevent duplicates.. am i right? and i think flag
would be a more reliable method coz it will ensure that the email will be
send even if the cron fails to execute for some time,

Midhun Girish
Development Lead
MobAlive Technologies
Trivandrum


On Mon, Mar 15, 2010 at 2:13 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Mon, 2010-03-15 at 18:07 +1030, David Robley wrote:

  Alex Major wrote:
 
   Greetings all,
  
   I'm currently looking at building a web application, however I've run
 into
   an area of development I've not come across before. The web site in its
   basic form allows users to send cars from a point and then the car will
   arrive at another point. When the car is set on its way, the start
 time,
   travel duration and end time are all known and stored in a MySQL
 database,
   what I would like to happen is that an event is triggered on the server
 at
   the end time and then an e-mail is sent to the user. This should happen
   regardless of whether someone is browsing the website or not.
  
   I don't believe that I'll be able to solely use PHP, I have spent the
   afternoon trying to look at potential solutions but I have to admit
 I've
   drawn a blank. Google hasn't been helpful (64 pages so far), as any
   searches related to event handling bring up a load of JavaScript
   tutorials/help for 'onclick' events etc. I have searched through the
 PHP
   documentation and found libevent
   (http://www.php.net/manual/en/book.libevent.php ), I don't believe
 that is
   what I require (although in all honesty the lack of documentation on it
   means I'm quite in the dark as to its purpose). Another potential
   candidate I came across was a PHP/Java bridge
   (http://php-java-bridge.sourceforge.net/pjb/ ), whereby I could use
 the
   java virtual machine, register events with it and then callback PHP
   scripts, although this seems extremely long winded.
  
   I was hoping that someone might have some experience with this kind of
   issue and could point me in the right direction. I'm sure I've missed
   something right in front of me.
  
   Alex.
 
  I think what you want is something to trigger a php script every
  $period-of-time; if your host supports it, cron is the means of executing
  an application at regular intervals down to a minute granularity. There
 are
  some web-based cron services also, but they may not have the same
  granularity as a locally based cron.
 
 
  Cheers
  --
  David Robley
 
  Wow! barked Tom, with a bow.
  Today is Prickle-Prickle, the 1st day of Discord in the YOLD 3176.
 
 


 You could store the end times in the database, and cron can run a script
 that will check each of these times to find any that are within x
 minutes that an email hasn't been sent out for. You'll need an extra
 field to indicate whether an email has been sent or not.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk





Re: [PHP] Re: Event Handling

2010-03-15 Thread Midhun Girish
ok so we have a script which checks if any cars have arrived within last 10
minutes... if yes, a mail will be send. suppose the server fails for 30
minutes so when the cron comes next time, we will have to check for cars
which arrived within last 40 minutes and not 10.. right...  so how will we
set a time limit in the script? its variable na.. but the flag is ok.. you
can send a mail to all db entries which have flag 0 and then update the flag
to 1.


Midhun Girish
Development Lead
MobAlive Technologies


On Mon, Mar 15, 2010 at 2:29 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

  On Mon, 2010-03-15 at 14:28 +0530, Midhun Girish wrote:

 hey ash,

 do we need both of those checks ? ie the time and the flag? i think they
 both do the same thing ie prevent duplicates.. am i right? and i think flag
 would be a more reliable method coz it will ensure that the email will be
 send even if the cron fails to execute for some time,

 Midhun Girish
 Development Lead
 MobAlive Technologies
 Trivandrum


 On Mon, Mar 15, 2010 at 2:13 PM, Ashley Sheridan
 a...@ashleysheridan.co.ukwrote:

  On Mon, 2010-03-15 at 18:07 +1030, David Robley wrote:
 
   Alex Major wrote:
  
Greetings all,
   
I'm currently looking at building a web application, however I've run
  into
an area of development I've not come across before. The web site in its
basic form allows users to send cars from a point and then the car will
arrive at another point. When the car is set on its way, the start
  time,
travel duration and end time are all known and stored in a MySQL
  database,
what I would like to happen is that an event is triggered on the server
  at
the end time and then an e-mail is sent to the user. This should happen
regardless of whether someone is browsing the website or not.
   
I don't believe that I'll be able to solely use PHP, I have spent the
afternoon trying to look at potential solutions but I have to admit
  I've
drawn a blank. Google hasn't been helpful (64 pages so far), as any
searches related to event handling bring up a load of JavaScript
tutorials/help for 'onclick' events etc. I have searched through the
  PHP
documentation and found libevent
(http://www.php.net/manual/en/book.libevent.php ), I don't believe
  that is
what I require (although in all honesty the lack of documentation on it
means I'm quite in the dark as to its purpose). Another potential
candidate I came across was a PHP/Java bridge
(http://php-java-bridge.sourceforge.net/pjb/ ), whereby I could use
  the
java virtual machine, register events with it and then callback PHP
scripts, although this seems extremely long winded.
   
I was hoping that someone might have some experience with this kind of
issue and could point me in the right direction. I'm sure I've missed
something right in front of me.
   
Alex.
  
   I think what you want is something to trigger a php script every
   $period-of-time; if your host supports it, cron is the means of executing
   an application at regular intervals down to a minute granularity. There
  are
   some web-based cron services also, but they may not have the same
   granularity as a locally based cron.
  
  
   Cheers
   --
   David Robley
  
   Wow! barked Tom, with a bow.
   Today is Prickle-Prickle, the 1st day of Discord in the YOLD 3176.
  
  
 
 
  You could store the end times in the database, and cron can run a script
  that will check each of these times to find any that are within x
  minutes that an email hasn't been sent out for. You'll need an extra
  field to indicate whether an email has been sent or not.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 


 Consider a cron script that runs every 10 minutes. You'll want to check the
 db for cars that are due to arrive within just over 10 minutes. The flag is
 there more for you own clarification that the email has been sent. What if
 the cron fails, or you restart your server, or the script your cron calls is
 just running a little slowly?


   Thanks,
 Ash
 http://www.ashleysheridan.co.uk





Re: [PHP] Event Handling

2010-03-15 Thread Midhun Girish
rene a page with an ajax script that kicks off the check-for-recent-events
script on the server.. but that method is highly non reliable i dont
think anyone will take that risk especially for an important web app
cron or any equivalent which runs on the server must be used instead of
that..


Midhun Girish
Development Lead
MobAlive Technologies



On Mon, Mar 15, 2010 at 6:08 PM, Jochem Maas joc...@iamjochem.com wrote:

 Op 3/15/10 12:00 PM, David Hutto schreef:
  On Mon, Mar 15, 2010 at 7:31 AM, Jochem Maas joc...@iamjochem.com
 wrote:
 
  Op 3/15/10 8:24 AM, Midhun Girish schreef:
  Hi ,
  Just as David Hutto has said,What you need is the cronjob... Make a
  script
  say check.php which checks the db to see if any new entries are
 made...
  and if yes send the mail ...
 
  now using the cronjob feature in linux os(which will be provided as a
  service in your linux hosting cpanel), set a cronjob which calls the 
  http://www.yoursite.com/check.php; URL every minute now a trigger
  will
  be there every minute to the script and the emails will be send
  irrespective
  of whether anyone is browsing the site or not hope it is clear...
 
 
  use cron - yes
  have cron call a web URL - no, instead just call the script via the php
 CLI
  sapi,
  e.g. a cmdline as follows in cron:
 
  /usr/env php /path/to/your/check.php  /dev/null
 
 
 
  I do believe removing the /dev/null will send error messages during the
  building of the script, correct?
 

 the ' /dev/null' redirects all output - I kind of make the assumption
 that the
 script would be logging stuff to a file or something when in production.

 so, yes, remove the redirection when your developing/testing the script.





Re: [PHP] Form validation issue

2009-12-20 Thread Midhun Girish
then the page gets reloaded and clears all the javascript error messages
and does the PHP validation.
That is because the form is getting submitted... make sure you js code
prevents form submit if errors are found



Midhun Girish


On Mon, Dec 21, 2009 at 8:13 AM, Ernie Kemp ernie.k...@sympatico.ca wrote:

   Good Day,



 I need help in in validating a form.

 The for is valdated be a javascript frist then if all the
 fields are filled in its valaded be PHP.



 The Form starts with:

 form name=myForm action=?php echo
 $_SERVER['PHP_SELF'];? method=post onsubmit='return formValidator()' 



 The “formValidator()” goes to a javascript and does display the missing
 information in this case BUT then the page gets reloaded and clears all the
 javascript error messages and does the PHP validation.



 The PHP only runs if the fields are set by testing using ‘isset”.



 Without puting on numeric lines of go can you suggest things I must have
 overlooked. Silly request but there must be something I’m overlooking.I
 have simular code on other programs but this one is casuing me trouble.



 Thanks every so much..



 ../Ernie