|
The user name will be a text string, so you need to enclose it in quotes:
$sql = mysql_query("UPDATE members SET lastactive=NOW() WHERE username='$username'");
I've also replaced the DBNAME and TABLENAME with the actual name of your table, and replaced the single quotes around the SQL string with double quotes so that $username will be expanded.
Also, instead of:
$password = trim(md5($_POST['password']));
you probably want:
$password = md5(trim($_POST['password']));
- an MD5 hash won't have any spaces in it, but the password you pass to it might.
|
|
|
|
|
You are still not sanitizing your data inputs, to protect you from SQL Injection Attacks[^]. Use: mysql_real_escape_string[^]
thebiostyle wrote: "".$get_user_data['username'].""
That does nothing useful. You don't need the empty strings either side, they do nothing, just have the variable.
thebiostyle wrote: $start_passsess = $_SESSION['password'] = "".$get_user_data['password']."";
Are you sure you want to keep the hashed password as a session variable?
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
I need to determine, for an events scheduling app, what days in the future are... As an example, someone may want to schedule an event for Sat, Jan. 30th, 2010, and every Saturday for the following 8 weeks... Got the rest of it working, just need a way to take an input field of "20100130", feed it into "perl date routine" and add to/loop thru to get my dates...
I've looked around, seems like date::manip has what I want, but I'm not sure I'll be able to get that installed... does anyone know of a way to do this with "localtime"? I have searched extensively, can't find any instances of parms fed to localtime EXCEPT when it's adding time to today, etc... I need to first establish my date, by converting it from an input field, then adding to the result... sounds pretty simple, but I am not getting anywhere...
and I'd be fine with a reference to read, if I've missed something... please forgive the clutter to this great board if I missed this somewhere....
thanks
M. Holliday
|
|
|
|
|
Try POSIX::mktime() - you can use that to turn dates and times into a time_t , then add N weeks worth of seconds and turn it back using localtime() .
|
|
|
|
|
I have to do program, that must do something like this: you enter position of sector as argument and result of this must be info of this sector and it must show if any file is part of it, if yes, which file/s? This could be solved with bash right? And i must do this for Reiserfs which is probably similar as bash-programming for ext2/3? Please can you give me few hints how to make this?
Thanks in advance
|
|
|
|
|
Aljaz111 wrote: This could be solved with bash right
I doubt it, I'd guess that you need something kernel level to find out this sort of information. You can still look for some command to do it (here[^] or here[^]) but I doubt you'll find one.
Aljaz111 wrote: bash-programming for ext2/3
Bash is file system agnostic. It works the same on all FSs.
|
|
|
|
|
Hi,
I am trying to create a perl date difference script. I would like to put the date2 from a file and put it
into an array. Then find the difference between that day and today. Here is what i got (it dont work). Please help.
#!/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 DATAFILE;
open (TODAYFILE, "today.txt") || die "couldn't open the file";
@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;
|
|
|
|
|
Do you have to read in today's date from a file?
iirc if you do
$date = Date::EzDate->new();
it would be able to give you today's date
|
|
|
|
|
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.
|
|
|
|