[PHP] MySQL, MD5 and SHA1

2009-04-21 Thread Grega Leskovsek
provided I want to store hash of a password in MySQL ... Using MySQL, the whole check can be achieved with a SQL query, since the MD5 function is provided as part of the database query language ... Can I use also SHA1 or must I use MD5? Thanks in advance, -- When the sun rises I receive and when

[PHP] how to write element in textarea?

2009-05-01 Thread Grega Leskovsek
I am writing CMS, that will be able to edit files. For editing I put file inside textarea, but when I open file that has textarea element inside it I lose (read: don't show data in the textarea element.) the data after the inside element. Any suggestions how can I fix this? Thanks in advance, --

[PHP] how to delete part of string

2009-05-23 Thread Grega Leskovsek
I have a POST string field and I want to skip some & fields before &id= How do I simply delete operation=nekaj&price=fddf&id=de&id=ta ... into &id=de&id=ta ... Thanks in advance, -- When the sun rises I receive and when it sets I forgive -> http://users.skavt.net/~gleskovs/ All the Love, Grega Le

Re: [PHP] how to delete part of string

2009-05-23 Thread Grega Leskovsek
e Love, Grega from Slovenia 2009/5/23 Marc Steinert : > I guess you mean GET parameters instead of POST. > > $string = preg_replace('/^(.*?)&id=/', '&id=', $_SERVER['QUERY_STRING']); > > Don't know, if that's exactly what you wanted. >

[PHP] getting file location

2009-05-27 Thread Grega Leskovsek
I have made a CMS with editing files. When I display the file name it shows something like "../subdir/filename.php" How can I display the actual filename that's on the web: like http://localhost/subdir/filename.php or even better if it is possible: http://domainname/subdir/filename.php ? Thanks in

[PHP] mysql create table with date or timestamp

2009-05-28 Thread Grega Leskovsek
CREATE TABLE diary(iddiary int auto_increment not null, imepriimek varchar(50), when date("%T%W%e%c%y"), action varchar(30), onfile varchar(100) unique id(iddiary)); I tried the above and it didn't work. What must I do to create a table with full time and date. If I should use timestamp how do I c

Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Grega Leskovsek
u should use: > > select date_format(when, "%T%W%e%c%y") from diary; > > To put data in this field you can use: > > insert into diary (when) values (str_to_date("10:55:14Thursday28509", > "%T%W%e%c%y")); > > > > -- > João Cândido de So

Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Grega Leskovsek
NT NOT NULL > AUTO_INCREMENT. > > 2009/5/28 João Cândido de Souza Neto : >> It´s not auto_increment, it´s auto increment. >> >> -- >> João Cândido de Souza Neto >> SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS >> Fone: (0XX41) 3033-3636 - JS >> www.sien

[PHP] mysql connections

2009-06-01 Thread Grega Leskovsek
how do I make a permanent connection to mysql database and what is difference between mysql_connect() and permanent one? If I make connections in one file and redirect it to another file do I keep connection (permanent / standard)? Do I lose connection only when I type mysql_close (permanent/ st

[PHP] mail and mysql confirmation of that [double-opt in]

2009-06-29 Thread Grega Leskovsek
how is the best way to check if email address is valid: is this preg_match() OK? preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/', $email); How can I make double opt-in mail system? My idea: 1.) I remember the email entered and user data and the sha1($email); i

[PHP] setting cookie doesn't work

2009-08-03 Thread Grega Leskovsek
Here is one of my final objectives at PHP introductory course ot O'Reilly. The strange thing that setting a cookie in that program les13uadownload.php doesn't work. I don't have a clue - sometimes in other programs when I run them they set cookies and sometimes not. To see the full functionality of

[PHP] Re: setting cookie doesn't work

2009-08-03 Thread Grega Leskovsek
cookies to detect whether the user has already registered, and to ensure that the user downloads the file only once within 7 days of registering. As always, validate the forms, comment your code, and explain your results! 2009/8/3 Grega Leskovsek : > Here is one of my final objectives at

[PHP] Re: setting cookie doesn't work

2009-08-03 Thread Grega Leskovsek
ks in advance, Grega from Slovenia 2009/8/3 Grega Leskovsek : > And here is the objective: > Alter your Acme, Inc. download interface from the previous lesson(I > had to not to allow users on computers straing IP with 202 and allow > only IE for Win and FF for Mac to download file)