|
This should work
#!/usr/bin/perl
# date calculator
use Date::Calc qw(Delta_Days check_date);
open (DATEFILE, "date.txt")|| die "couldn't open the file!";
@date2=<DATEFILE>;
close DATEFILE;
open (TODAYFILE, "today.txt") || die "couldn't open the file";
@today;
@today=<TODAYFILE>;
print @today;
print "\n";
print @date2;
print "\n";
$difference = Delta_Days(@today, @date2);
print "There are $difference days before password expires\n";
close TODAYFILE;
date.txt
2010
01
20
today.txt
2010
01
15
|
|
|
|
|
Thanks that works great.
Here is what i came up with.
#!/usr/bin/perl
use Date::Calc qw(Delta_Days);
use Time::Piece;
($sec, $min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
open (MYDATA, "data.txt") or die ("Error: cannot open file 'ARGV[0]'\n");
my @lines1 = <MYDATA>;
# chomp @lines1;
my $t = Time::Piece->strptime("@lines1",
"%b %d,%Y");
$year1 = $year + 1900;
$mon1 = $mon + 1;
$mday1 = $mday;
$year2 = ( $t->strftime("%Y"));
$mon2 = ( $t->strftime("%m"));
$mday2 = ( $t->strftime("%d"));
$difference = Delta_Days($year1, $mon1, $mday , $year2, $mon2, $mday2);
print "There were $difference days between Nat and Bree\n";
print "email user\n" if $difference <= 15;
data.txt
Jan 24, 2010
|
|
|
|
|
I need a program in PHP which can extract the hidden biders from ebay.I will have to insert the item number and the program must show me all bidders of the auction and their emails.
Also the same program must extract the registered contact information for any specified bidder specially the email address
I will pay for this
If someone can help please contact me at totos_back@yahoo.com
Thanks
|
|
|
|
|
I am using the imap_search function to return an array of unseen messages but all the messages are returned. I only want to show unread messages but the code returns all the messages (numbers) in the mailbox.
Thanks in advance for your help.
Below is the code.
$result = imap_search($imap,'UNSEEN');
foreach ($result as $value) {
echo " the unseen message number is";
echo " ";
echo $value;
echo " ";
}
|
|
|
|
|
Your code looks OK - could it be something strange about the server configuration?
I just tried this code to get IMAP unread numbers from our exchange server and it worked fine.
<?php
$himap = imap_open ('{some.server.ac.uk:143}INBOX', 'username', 'password');
$result = imap_search ($himap, 'UNSEEN');
if(is_array($result))
{
foreach ($result as $value)
{
echo "Unseen message number $value<br/>";
}
}
else
echo 'No unseen messages';
?>
|
|
|
|
|
Thanks for the help Niall.
I tried yours as well it returned all the messages. In case you might have an idea, what possible server configuration could be causing this.
Regards
Nath
|
|
|
|
|
I'm afraid I don't know much about IMAP servers, so can't help there.
Niall
|
|
|
|
|
Could there problem be because I am using pop3 driver to access the emails. I am using the code below:
$MAILSRV="mail.somewhere.com:110/pop3/notls";
$imap = imap_open ("{".$MAILSRV."}INBOX", "someemail@somewhere.com", "password");
|
|
|
|
|
I'm surprised that works at all - POP3 and IMAP are quite different.
I don't think a POP3 server keeps any information on which messages are read however, so unless you have IMAP mailboxes configured on the server you will just get a list of all messages.
|
|
|
|
|
hi,
I am a non-technical person.A software developer of my company (Mindfire Solutions) has designed a tips section relating to PHP. There various tips are provided.U can go through them and have a look.It will solve your problem.
http://www.mindfiresolutions.com/PHP-85.php[^]
Cheers,
Eliza
Mindfire: India's Only Company to be both Apple Premier & Microsoft Gold certified.
|
|
|
|
|
|
Thanks.You are Welcome.
Cheers,
Eliza
Mindfire: India's Only Company to be both Apple Premier & Microsoft Gold certified.
|
|
|
|
|
|
|
You are Welcome!!
Cheers,
Eliza
|
|
|
|
|
I am working with Wordpress right now and it is written in PHP. Let me tell you that your information is just what I was looking for. It is quite intimidating at first, but you present the information in a way that is truly easy to follow. Thank you so much for this. I am learning so much. Deficiency Judgment
|
|
|
|
|
I am seriously considering abandoning VC++ and switching to Linux based development.
Since I have an extesive and unfinished development in VC++ I would like to pick an open IDE friendly to VC++.
I have Eclipse and Code::Block on radar.
Eclipse seems to be too universal and complex for a begginer.
I also looked at Geany and it seems to be OK as editor.
It would be nice if it integrated with IDE, but I may be ahead of myself here. ( Baby steps!)
Last question - is this OK forum to ask linux distribution specific questions? I find Linux users group too much "how to work in Linux OS" and not programming oriented.
Thanks for reading, any constructive comments are as always appreciated.
Cheers Vaclav
PS I did read the IDE thread here.
|
|
|
|
|
I don't know if it will be any help, but KDevelop is one of the main C/C++ IDE's for Linux.
Heres a screenshot of KDevelop's GUI. Click
|
|
|
|
|
hello , i have been trying to sort this out for hours , and there are probably 2000 other people who have asked this but when i try and send form results to an email adress from the local host which i set up i get this :
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Apache2.2\htdocs\websites\test\process.php on line 6
here is my code in php.ini
[mail function]
STMP = localhost
sendmail_from = me@whatever.com
here is my code in the form process.php
<?php
$name = $_REQUEST['name'];
$message = $_REQUEST['msg'];
mail('me@whatever.com', $message,$name);
?>
i have also downloaded a SMTP piece of software to try and overcome the problem but no result yet ... Thnaks for all your help :P
|
|
|
|
|
You need to add a custom header as a fourth parameter to the mail function, to add your From header. Example:
mail('me@whatever.com', $message, $name, 'From: webmaster@example.com' . "\r\n");
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
Thanks that worked perfectly , by any chance do you know how i can fix this error ?
It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting
or the date_default_timezone_set() function. In case you used any of those methods and you are still
getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for '0.0/no DST'
instead in C:\Apache2.2\htdocs\websites\test\process.php on line 6
Thanks again
|
|
|
|
|
You shouldn't rely on the default timezone of the server. It needs to be explicitly set to the required timezone.
Eg:
date_default_timezone_set( 'Europe/London' );
So put that line before line 6, process.php.
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
Thanks !!!
|
|
|
|
|
hi all,
I am having the problem with arrays in php.
I created two single dimensional array contains some data.
Now i want to compare those arrays and print the values i.e., some items which are common to printed in one color and the rest of the items in other.
Thanks in advance.
|
|
|
|
|
if both arrays are the same size...
$arr1 = array(1,2,3,4,5);
$arr2 = array('a',2,'b','c','d');
$cnt = count($arr1);
echo "<table>";
for($i=0;$i<$cnt;$i++)
{
echo "<tr";
if($arr1[$i]==$arr2[$i])
{
echo " class='match_color'>";
}
else
{
echo " class='nomatch_color'>";
}
echo "<td>".arr1[$i]."</td>";
echo "<td>".arr2[$i]."</td>";
echo "</tr>";
}
echo "</table>";
|
|
|
|