Re: [PHP] How to delete 3 months old records in my database?

2013-08-02 Thread Dušan Novaković
$query = DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() -
INTERVAL 3 MONTH AND NOW()


On Fri, Aug 2, 2013 at 12:58 PM, Karl-Arne Gjersøyen karlar...@gmail.comwrote:

 Hello again, folks!
 I wish to delete records in my database that is older than 3 months.

 $todays_date = date('Y-m-d');
 $old_records_to_delete =  ???

 if($old_records_to_delete){
 include(connect.php);
 $sql = DELETE FROM table WHERE date = '$old_records_to_delete';
 mysql_query($sql, $connect_db) or die(mysql_error());
 }

 Thank you very much for your help to understand also this question :)

 Karl




-- 
mob:   + 46 7 230 230 19
web:   http://novakovicdusan.com

Please consider the environment before printing this email.


Re: [PHP] How to delete 3 months old records in my database?

2013-08-02 Thread Dušan Novaković
Yeah, just spelling mistake :-)
And yes, it should be:

$query = DELETE FROM `__table_name__` WHERE `__date__` = NOW() - INTERVAL
3 MONTH


Cheers ;-)


On Fri, Aug 2, 2013 at 2:35 PM, Simon Schick simonsimc...@gmail.com wrote:

 On Fri, Aug 2, 2013 at 2:02 PM, Karl-Arne Gjersøyen karlar...@gmail.com
 wrote:
 
  2013/8/2 Dušan Novaković ndu...@gmail.com
 
   $query = DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() -
   INTERVAL 3 MONTH AND NOW()
  
 
  This delete everything from now and 3months backwards. I want to store 3
  months from now and delete OLDER than 3 months old records.
 
  Karl

 Hi, Karl

 You're right, but restructuring, to get it the way you want, isn't be
 that hard, is it? :)

 $query = DELETE FROM `__table_name__` WHERE `__date__`  NOW() -
 INTERVAL 3 MONTH

 @Dusan,
 Btw: What is DELECT? I assume it should've been DELETE, right?

 Bye
 Simon

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




-- 
mob:   + 46 7 230 230 19
web:   http://novakovicdusan.com

Please consider the environment before printing this email.


[PHP] Chat

2010-11-09 Thread Dušan Novaković
Hello there,

I have to make chat for website that has around 10 000 users (small
social network). So before I start, I would like to hear different
opinions. Important thing is to have in mind that in one moment you
can have over 1 000 users using chat.
So, if you have time fill free to write you experience in this field,
suggestions, etc.

Thnx,
Dusan



-- 


Please consider the environment before printing this email.

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



Re: [PHP] Re: Text editor for Ubuntu with FTP

2010-08-02 Thread Dušan Novaković
True :-) But, in my opinion if you plan to get really serious, then
you should consider using Eclipse or NetBeans :-) There you have
everything you'll ever need (but of course you have to say goodbye to
Designer mode from Dreamweaver :-) )

Dusan

On Sun, Aug 1, 2010 at 6:32 AM, David Robley robl...@aapt.net.au wrote:
 Jordan Jovanov wrote:

 Hello to All,

 I only whant to star discussion for who is the best programm to write
 php and html script. I use dreamweaver, but now I change my OS to ubuntu
 and I want some suggestions for some Text editor for FTP for Ubuntu


 Thanks A lot
 Jordan Jovanov

 Ah, it's the time of year for an editor thread again :-) Have a look at
 http://www.php-editors.com/ or
 http://en.wikipedia.org/wiki/List_of_PHP_editors or even google php
 editor

 As for best that can be very subjective depending on what _you_ want the
 editor to do.


 Cheers
 --
 David Robley

 System going down at 1:45 p.m. for disk crashing.
 Today is Pungenday, the 67th day of Confusion in the YOLD 3176.


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





-- 
mob:   + 46 70 044 9432
web:   http://novakovicdusan.com

Please consider the environment before printing this email.

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



Re: [PHP] storing files in database and retriving them

2010-07-28 Thread Dušan Novaković
Hi,

Here are headers:

Response Headers


DateWed, 28 Jul 2010 06:41:33 GMT
Server  Apache/2.2.14 (Ubuntu)
X-Powered-ByPHP/5.3.2-1ubuntu4.1
Expires 0
Cache-Control   must-revalidate, post-check=0, pre-check=0
Pragma  no-cache
Content-Length  1849
Accept-Ranges   bytes
Content-Disposition attachment; filename='10_file.pdf'
Content-Transfer-Encoding   binary
Content-Encodinggzip
VaryAccept-Encoding
Content-Type   application/pdf
X-Cache
X-Cache-Lookup 
Via
Connection keep-alive
Proxy-Connection   keep-alive


Request Headers


Host   ...
User-Agent Mozilla/5.0 (X11; U; Linux i686; sv-SE;
rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3
Accept text/html, */*
Accept-Languagesv-se,sv;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encodinggzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Proxy-Connection   keep-alive
Content-Type   application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With   XMLHttpRequest
Refererhttp://../user/queue/
Content-Length 5
Cookie PHPSESSID=67bf56153fb3b9c69ed214114c8154dd




Dusan


2010/7/27 Richard Quadling rquadl...@gmail.com:
 2010/7/27 Dušan Novaković ndu...@gmail.com:
 I don't think that it will help :-( I've tried to set different
 headers but still I end up with some strange response, like:

 %PDF-1.3
 3 0 obj
 /Type /Page
 /Parent 1 0 R
 /Resources 2 0 R
 /Contents 4 0 R
 endobj
 4 0 obj
 /Filter /FlateDecode /Length 1214
 stream
 

 So, if we try to look into this problem as basic. For example, I'm
 trying to store file test.pdf from some location on server into my db
 like this:

 $fp = fopen(PATH_TO_PDF_FILE.'test.pdf', r);
 $size = filesize(PATH_TO_PDF_FILE.'test.pdf');
 $type = mime_content_type(PATH_TO_PDF_FILE.'test.pdf');

 $file = fread($fp, $size);

 Here if I do : var_dump($file) how the content should look like?

 $file = base64_encode($file);
 close($fp);

 $query = sprintf(INSERT INTO `table` SET `file`='%s', `name`='%s',
 `size`='%s', `type`='%s',
                        mysql_real_escape_string($file),
                        mysql_real_escape_string('test.pdf'),
                        mysql_real_escape_string($size),
                        mysql_real_escape_string($type)
 );
 mysql_query($query);



 And lets try to retrive data now and show them on page:

 $query  = sprintf(SELECT * FROM `table` WHERE `id`='something');
 $res= mysql_query($query);
 $row = mysql_fetch_assoc($res);

  header({$_SERVER['SERVER_PROTOCOL']} 200 OK, True, 200);
  header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  header('Content-Length: ' . $row['size']);
  header('Content-Type: ' . $row['type']);
  header('Expires: 0');
  header('Pragma: public');

 header('Content-Description: File Transfer');
 header('Content-Disposition: attachment; filename= . $row['name']);
 header('Content-Transfer-Encoding: binary');

  readfile(base64_decode($row['file']));


 And here I should get PDF file, but instead I get the same symbols on
 the top of page :-(

 Any suggestion? Some different header or ... ?


 2010/7/27 Richard Quadling rquadl...@gmail.com:
 2010/7/27 Dušan Novaković ndu...@gmail.com:
 hello,

 I have some problems with storing files in db and retriving them, so
 probably I'm doing something wrong :-)
 Here is the case:
 I have on one of the pages request to generate some PDF files and
 store them in database. So, I use FPDF to create files, and that's
 working perfect. Then my system is collecting generated file(s) and
 storing them in DB. On the other side (page)  I have to show stored
 files from database.

 So, when file (in this case PDF) is created and stored in some dir
 (ex. tmp/file.pdf), by using function: fopen(filename, 'r'); $file =
 fread(); I put file(s) in array $tmpArray = array('file' =
 base64_encode($file) ) and send it to model (db). There I have
 table for files, (column type for file is BLOB). So, first I do the
 $fileThatWillBeStored = base64_decode($file); and than store it. After
 that I'm able to see that in DB there is one row with file, so that
 part is also ok.
 On the other side when I have to show that file, I just fetch it from
 DB and again pack it in array, but first do the
 base64_encode($fileFromDB) and send it to controller, where after
 doing $file = base64_decode($fileFromDB

Re: [PHP] storing files in database and retriving them

2010-07-28 Thread Dušan Novaković
Ok,

I found the problem :-) There was nothing wrong with storing or
sending files, it's just that I tried to load file with jQuery on
wrong way :-(

Sorry once more to everyone :-(

Dusan

2010/7/28 Dušan Novaković ndu...@gmail.com:
 Hi,

 Here are headers:

 Response Headers
 

 Date                                Wed, 28 Jul 2010 06:41:33 GMT
 Server                      Apache/2.2.14 (Ubuntu)
 X-Powered-By                PHP/5.3.2-1ubuntu4.1
 Expires                     0
 Cache-Control               must-revalidate, post-check=0, pre-check=0
 Pragma                      no-cache
 Content-Length              1849
 Accept-Ranges               bytes
 Content-Disposition         attachment; filename='10_file.pdf'
 Content-Transfer-Encoding       binary
 Content-Encoding            gzip
 Vary                                Accept-Encoding
 Content-Type               application/pdf
 X-Cache                    
 X-Cache-Lookup             
 Via                                
 Connection                 keep-alive
 Proxy-Connection           keep-alive


 Request Headers
 

 Host                               ...
 User-Agent                 Mozilla/5.0 (X11; U; Linux i686; sv-SE;
 rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3
 Accept                     text/html, */*
 Accept-Language    sv-se,sv;q=0.8,en-us;q=0.5,en;q=0.3
 Accept-Encoding    gzip,deflate
 Accept-Charset             ISO-8859-1,utf-8;q=0.7,*;q=0.7
 Keep-Alive                         115
 Proxy-Connection           keep-alive
 Content-Type               application/x-www-form-urlencoded; charset=UTF-8
 X-Requested-With           XMLHttpRequest
 Referer                    http://../user/queue/
 Content-Length             5
 Cookie                     PHPSESSID=67bf56153fb3b9c69ed214114c8154dd




 Dusan


 2010/7/27 Richard Quadling rquadl...@gmail.com:
 2010/7/27 Dušan Novaković ndu...@gmail.com:
 I don't think that it will help :-( I've tried to set different
 headers but still I end up with some strange response, like:

 %PDF-1.3
 3 0 obj
 /Type /Page
 /Parent 1 0 R
 /Resources 2 0 R
 /Contents 4 0 R
 endobj
 4 0 obj
 /Filter /FlateDecode /Length 1214
 stream
 

 So, if we try to look into this problem as basic. For example, I'm
 trying to store file test.pdf from some location on server into my db
 like this:

 $fp = fopen(PATH_TO_PDF_FILE.'test.pdf', r);
 $size = filesize(PATH_TO_PDF_FILE.'test.pdf');
 $type = mime_content_type(PATH_TO_PDF_FILE.'test.pdf');

 $file = fread($fp, $size);

 Here if I do : var_dump($file) how the content should look like?

 $file = base64_encode($file);
 close($fp);

 $query = sprintf(INSERT INTO `table` SET `file`='%s', `name`='%s',
 `size`='%s', `type`='%s',
                        mysql_real_escape_string($file),
                        mysql_real_escape_string('test.pdf'),
                        mysql_real_escape_string($size),
                        mysql_real_escape_string($type)
 );
 mysql_query($query);



 And lets try to retrive data now and show them on page:

 $query  = sprintf(SELECT * FROM `table` WHERE `id`='something');
 $res= mysql_query($query);
 $row = mysql_fetch_assoc($res);

  header({$_SERVER['SERVER_PROTOCOL']} 200 OK, True, 200);
  header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  header('Content-Length: ' . $row['size']);
  header('Content-Type: ' . $row['type']);
  header('Expires: 0');
  header('Pragma: public');

 header('Content-Description: File Transfer');
 header('Content-Disposition: attachment; filename= . $row['name']);
 header('Content-Transfer-Encoding: binary');

  readfile(base64_decode($row['file']));


 And here I should get PDF file, but instead I get the same symbols on
 the top of page :-(

 Any suggestion? Some different header or ... ?


 2010/7/27 Richard Quadling rquadl...@gmail.com:
 2010/7/27 Dušan Novaković ndu...@gmail.com:
 hello,

 I have some problems with storing files in db and retriving them, so
 probably I'm doing something wrong :-)
 Here is the case:
 I have on one of the pages request to generate some PDF files and
 store them in database. So, I use FPDF to create files, and that's
 working perfect. Then my system is collecting generated file(s) and
 storing them in DB. On the other side (page)  I have to show stored
 files from database.

 So, when file (in this case PDF) is created and stored in some dir
 (ex. tmp/file.pdf), by using function: fopen(filename, 'r'); $file =
 fread(); I put file(s) in array $tmpArray = array('file' =
 base64_encode($file) ) and send it to model (db). There I have
 table for files, (column type for file is BLOB). So, first I do the
 $fileThatWillBeStored = base64_decode($file); and than store it. After
 that I'm able to see that in DB

[PHP] storing files in database and retriving them

2010-07-27 Thread Dušan Novaković
hello,

I have some problems with storing files in db and retriving them, so
probably I'm doing something wrong :-)
Here is the case:
I have on one of the pages request to generate some PDF files and
store them in database. So, I use FPDF to create files, and that's
working perfect. Then my system is collecting generated file(s) and
storing them in DB. On the other side (page)  I have to show stored
files from database.

So, when file (in this case PDF) is created and stored in some dir
(ex. tmp/file.pdf), by using function: fopen(filename, 'r'); $file =
fread(); I put file(s) in array $tmpArray = array('file' =
base64_encode($file) ) and send it to model (db). There I have
table for files, (column type for file is BLOB). So, first I do the
$fileThatWillBeStored = base64_decode($file); and than store it. After
that I'm able to see that in DB there is one row with file, so that
part is also ok.
On the other side when I have to show that file, I just fetch it from
DB and again pack it in array, but first do the
base64_encode($fileFromDB) and send it to controller, where after
doing $file = base64_decode($fileFromDB); I just show it like this:
header(Content-length: .$file['file_size']);
header(Content-type: .$file['file_type']);
header(Content-Disposition: attachment; filename= .$file['file_name']);
echo $file['file'];

And final result is something like:

%PDF-1.3
3 0 obj
/Type /Page
/Parent 1 0 R
/Resources 2 0 R
/Contents 4 0 R
endobj
4 0 obj
/Filter /FlateDecode /Length 1214
stream
x��W�v�F �� �L ��[�� N ��`'
�,{�� $�H�g� �/x�R?$� �Y� ��n=�U0t9X ��h �O�)�  ��5���  � � �Q:��2B!U��( I)0

.


So, I hope you get the picture :-) Of course, I've skiped lot of
steps, because the code is huge.

Any suggestions? additional questions?

P.S.
I can't read on the other side file from directory, so it has to be in
the way I just described ( Generate PDF with FPDF = pack in array,
but first base64_encode = send it to model = get from array and
unpack it with base64_decode on DB side = store in DB, and then
reverse: get from DB = pack in array, but first base64_encode = send
it to controller = get it from array and unpack with base 64_decode
= show in view with headers)

Thnx,
Dusan


-- 
mob: + 46 70 044 9432
web: http://novakovicdusan.com

Please consider the environment before printing this email.

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



Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Dušan Novaković
Hello,

so when I'm sending the array to model it's like this:

$fp = fopen(INVOICE_PATH.date('Y-m-d').DS.$pdfName, r);
$pdfContent = array(
'file'  =  base64_encode(fread($fp,
filesize(INVOICE_PATH.date('Y-m-d').DS.$pdfName))),
'name'  =  $pdfName,
'size'  =  
filesize(INVOICE_PATH.date('Y-m-d').DS.$pdfName),
'type'  =  
mime_content_type(INVOICE_PATH.date('Y-m-d').DS.$pdfName)
);
fclose($fp);

so the data in db are ok, and this type is application/pdf.

And when I'm getting data, I get the array like this:

$file = Array
(
[id] = 2
[file] =VBERi0xLjM... = here file is base64_encode()
[file_size] = 2204
[file_type] = application/pdf
[file_name] = 2_file.pdf
)

Headers:

header(Content-length: .$file['file_size']);
header(Content-type: .$file['file_type']);
header(Content-Disposition: attachment; filename= .$file['file_name']);
echo base64_decode($file['file']);


So, mime looks ok, but still... not working :-(

2010/7/27 Nilesh Govindarajan li...@itech7.com:
 Have you checked the headers? Its mostly a mime time issue I feel.
 What do you see in Content-Type? It should be application/pdf (or
 application/x-pdf, unsure) for PDF files.

 --
 Regards,
 Nilesh Govindarajan
 Facebook: http://www.facebook.com/nilesh.gr
 Twitter: http://twitter.com/nileshgr
 Website: http://www.itech7.com
 VPS Hosting: http://www.itech7.com/a/vps




-- 
mob: + 46 70 044 9432
web: http://novakovicdusan.com

Please consider the environment before printing this email.

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



Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Dušan Novaković
Hello Peter,

I can't use files from filesystem. Let's say that they are not on the
some mashine where is application that has to show files :-) So it has
to be in exact order as I wrote :-(

2010/7/27 Peter Lind peter.e.l...@gmail.com:
 2010/7/27 Dušan Novaković ndu...@gmail.com:
 Hello,

 so when I'm sending the array to model it's like this:

 $fp = fopen(INVOICE_PATH.date('Y-m-d').DS.$pdfName, r);
 $pdfContent             = array(
                                        'file'  =      
 base64_encode(fread($fp,
 filesize(INVOICE_PATH.date('Y-m-d').DS.$pdfName))),
                                        'name'  =      $pdfName,
                                        'size'  =      
 filesize(INVOICE_PATH.date('Y-m-d').DS.$pdfName),
                                        'type'  =      
 mime_content_type(INVOICE_PATH.date('Y-m-d').DS.$pdfName)
                                        );
 fclose($fp);

 so the data in db are ok, and this type is application/pdf.

 And when I'm getting data, I get the array like this:

 $file = Array
 (
    [id] = 2
    [file] =VBERi0xLjM... = here file is base64_encode()
    [file_size] = 2204
    [file_type] = application/pdf
    [file_name] = 2_file.pdf
 )

 Headers:

 header(Content-length: .$file['file_size']);
 header(Content-type: .$file['file_type']);
 header(Content-Disposition: attachment; filename= .$file['file_name']);
 echo base64_decode($file['file']);


 So, mime looks ok, but still... not working :-(

 2010/7/27 Nilesh Govindarajan li...@itech7.com:
 Have you checked the headers? Its mostly a mime time issue I feel.
 What do you see in Content-Type? It should be application/pdf (or
 application/x-pdf, unsure) for PDF files.

 --
 Regards,
 Nilesh Govindarajan
 Facebook: http://www.facebook.com/nilesh.gr
 Twitter: http://twitter.com/nileshgr
 Website: http://www.itech7.com
 VPS Hosting: http://www.itech7.com/a/vps




 --
 mob: + 46 70 044 9432
 web: http://novakovicdusan.com

 Please consider the environment before printing this email.

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



 Why are you storing files in the db in the first place? If they're
 files why not use the filesystem?

 Regards
 Peter

 --
 hype
 WWW: http://plphp.dk / http://plind.dk
 LinkedIn: http://www.linkedin.com/in/plind
 BeWelcome/Couchsurfing: Fake51
 Twitter: http://twitter.com/kafe15
 /hype




-- 
mob: + 46 70 044 9432
web: http://novakovicdusan.com

Please consider the environment before printing this email.

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



Re: [PHP] Text editor

2010-07-27 Thread Dušan Novaković
You can use TinyMCE. It's really easy to integrate in system. Check on
official website.

Dusan

On Tue, Jul 27, 2010 at 12:10 PM, Jordan Jovanov jovanovj...@gmail.com wrote:
 Hello All

 I need me to add form for comment to one web site, but i want to use some
 taxt edtior. Simething similar of this editor
 http://www.seekcodes.com/text-editor.php , but i can not find the code.
 Do you somebody know some simple text editor with buttons for bold italic
 etc.

 Thanks a lot.
 Jordan

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





-- 
mob: + 46 70 044 9432
web: http://novakovicdusan.com

Please consider the environment before printing this email.

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



Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Dušan Novaković
I don't think that it will help :-( I've tried to set different
headers but still I end up with some strange response, like:

%PDF-1.3
3 0 obj
/Type /Page
/Parent 1 0 R
/Resources 2 0 R
/Contents 4 0 R
endobj
4 0 obj
/Filter /FlateDecode /Length 1214
stream


So, if we try to look into this problem as basic. For example, I'm
trying to store file test.pdf from some location on server into my db
like this:

$fp = fopen(PATH_TO_PDF_FILE.'test.pdf', r);
$size = filesize(PATH_TO_PDF_FILE.'test.pdf');
$type = mime_content_type(PATH_TO_PDF_FILE.'test.pdf');

$file = fread($fp, $size);

Here if I do : var_dump($file) how the content should look like?

$file = base64_encode($file);
close($fp);

$query = sprintf(INSERT INTO `table` SET `file`='%s', `name`='%s',
`size`='%s', `type`='%s',
mysql_real_escape_string($file),
mysql_real_escape_string('test.pdf'),
mysql_real_escape_string($size),
mysql_real_escape_string($type)
);
mysql_query($query);



And lets try to retrive data now and show them on page:

$query  = sprintf(SELECT * FROM `table` WHERE `id`='something');
$res= mysql_query($query);
$row = mysql_fetch_assoc($res);

 header({$_SERVER['SERVER_PROTOCOL']} 200 OK, True, 200);
 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
 header('Content-Length: ' . $row['size']);
 header('Content-Type: ' . $row['type']);
 header('Expires: 0');
 header('Pragma: public');

header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename= . $row['name']);
header('Content-Transfer-Encoding: binary');

 readfile(base64_decode($row['file']));


And here I should get PDF file, but instead I get the same symbols on
the top of page :-(

Any suggestion? Some different header or ... ?


2010/7/27 Richard Quadling rquadl...@gmail.com:
 2010/7/27 Dušan Novaković ndu...@gmail.com:
 hello,

 I have some problems with storing files in db and retriving them, so
 probably I'm doing something wrong :-)
 Here is the case:
 I have on one of the pages request to generate some PDF files and
 store them in database. So, I use FPDF to create files, and that's
 working perfect. Then my system is collecting generated file(s) and
 storing them in DB. On the other side (page)  I have to show stored
 files from database.

 So, when file (in this case PDF) is created and stored in some dir
 (ex. tmp/file.pdf), by using function: fopen(filename, 'r'); $file =
 fread(); I put file(s) in array $tmpArray = array('file' =
 base64_encode($file) ) and send it to model (db). There I have
 table for files, (column type for file is BLOB). So, first I do the
 $fileThatWillBeStored = base64_decode($file); and than store it. After
 that I'm able to see that in DB there is one row with file, so that
 part is also ok.
 On the other side when I have to show that file, I just fetch it from
 DB and again pack it in array, but first do the
 base64_encode($fileFromDB) and send it to controller, where after
 doing $file = base64_decode($fileFromDB); I just show it like this:
 header(Content-length: .$file['file_size']);
 header(Content-type: .$file['file_type']);
 header(Content-Disposition: attachment; filename= .$file['file_name']);
 echo $file['file'];

 And final result is something like:

 %PDF-1.3
 3 0 obj
 /Type /Page
 /Parent 1 0 R
 /Resources 2 0 R
 /Contents 4 0 R
 endobj
 4 0 obj
 /Filter /FlateDecode /Length 1214
 stream
 x��W�v�F �� �L ��[�� N ��`'
 �,{�� $�H�g� �/x�R?$� �Y� ��n=�U0t9X ��h �O�)�  ��5���  � � �Q:��2B!U��( I)0

 .


 So, I hope you get the picture :-) Of course, I've skiped lot of
 steps, because the code is huge.

 Any suggestions? additional questions?

 P.S.
 I can't read on the other side file from directory, so it has to be in
 the way I just described ( Generate PDF with FPDF = pack in array,
 but first base64_encode = send it to model = get from array and
 unpack it with base64_decode on DB side = store in DB, and then
 reverse: get from DB = pack in array, but first base64_encode = send
 it to controller = get it from array and unpack with base 64_decode
 = show in view with headers)

 Thnx,
 Dusan


 --
 mob: + 46 70 044 9432
 web: http://novakovicdusan.com

 Please consider the environment before printing this email.

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



 As soon as you've got the data, create a hash of the file (sha1(),
 md5(), etc.) and store that in the database.

 When you restore the file, generate a new hash and compare it with the
 stored one to make sure you've got the right data.

 Assuming that the hashes match, then the next thing is to use a tool
 like FireBug to see EXACTLY what is being received by the client. This
 seems to be different to what you are sending.

 The headers I use for a PDF file download (as compared to a PDF online
 view) are ...

        header({$_SERVER['SERVER_PROTOCOL

[PHP] set different .htaccess rules

2010-07-15 Thread Dušan Novaković
Hello all,

I have problem with protecting files inside of folder. So, I have one
folder with files inside and the idea is to be able to see those files
(format is not important) only when you are logged in system.
I can't use solutions like to set some wierd name so that actually
user is hardly able to guess the real path to that file, something
like http://site.com/files/we23h4hk234hjksdjrjkl23jfasdf
Is there some trick with .htaccess to check some php value and set
different rules if some another value in php is set or not. I know
that you are able to set some php values in .htaccess, but as I said,
is it possible to manipulate with them inside of .htaccess. Or if
someone has some better solution, you are welcome to write it down :-)

Regards,
Dusan

-- 
mob: + 46 70 044 9432
web: http://novakovicdusan.com

Please consider the environment before printing this email.

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



Re: [PHP] NetBeans Question

2010-05-31 Thread Dušan Novaković
Hi, I've been using NetBeans for some time and I found that there are
some issues like for Web applications if you write html tag
incorrectlly, you wont be informed about that, for stand alone
applications in Java there were also some stupid errors, etc. So, I
strongly suggest to check out Eclipse(http://www.eclipse.org/)! You
can easily download Eclipse for PHP on Windows, Linux and MAC, and the
best part is that you can also easily find and add different plugins
like SVN, JS, etc. Just check it out... ;-)

Regards,
Dusan

On Mon, May 31, 2010 at 4:13 AM, Mark Kelly p...@wastedtimes.net wrote:
 Hi.

 On Monday 31 May 2010 at 02:50 Ashley Sheridan wrote:
 Yeah, like I mentioned earlier, Dreamweaver is known for having issues
 with include files, can be slow when working on large projects with lots
 of files, and is only available for Mac and Windows, which limits it
 somewhat.

 Indeed. I can't stand the thing myself - I was just being polite :)

 I use netbeans on Linux and Windows, so its cross-platform nature is quite
 important to me. I also appreciate the Subversion integration, which is very
 nicely done.

 Tedd: I'm no expert, but I'll chime in if I have any answers for you.

 Cheers,

 Mark

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





-- 
made by ndusan

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



[PHP] How to write specification

2010-01-08 Thread Dušan Novaković
Hi,

I've been programing for some time, but I never tried to write code
for two different application in same way. How when I work with more
programmers it's even worse. Everyone is forcing it's way of writing
functions inside classes or writing variables, etc. My idea is to code
according to the standard protocol so that in future it would be
easier to make applications. Is there some specification (or standard)
how to write code for web application, but which describes all
possibilities(writing css, JS, php, etc.)?

Thanks in advance,
Dusan

-- 
made by ndusan

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



[PHP] Validation XHTML code and repairing broken one

2009-09-17 Thread Dušan Novaković
Hello,

I have few questions about validation XHTML and repairing if it's
broken. The problem is that I have some, for example HTML code (simple
web page) and want to load that page to DOMDocument and than make
something of it. That part works perfect, but if there is unclosed tag
or something like that when I try to load that page I get an error
because now that code is not valid. So my question would be, is there
some way that I could build some script in php that would run thought
that page and check if it's valid or not, and if it's not than try to
repair it. Something that you have in all tools, for example Eclipse,
NetBeans, etc. If anyone have any idea, please help me, because I'm
stuck in here :-(

Regards,
Dusan

-- 
made by Dusan

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



[PHP] Notification system

2009-08-02 Thread Dušan Novaković
Hi,

Does anyone has any idea how to create notification system with
combination of php, mysql and javascript. It should be something
similar to facebook notification system (when someone make some action
it should be automatically reported to other people on system through
pop-up menu or something like that). I just need some basic idea how
to start or if someone has some example it would be perfect.

Thanks,
Dusan

-- 
made by Dusan

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



[PHP] Font problem

2009-07-28 Thread Dušan Novaković
Hi,

Is there a possibility that if there is no font installed on client
side somehow browser finds it and redirect that font form server to
client machine. For example: I have site that use Microsoft font and
that font is not available on Linux distributions. So when u open page
in FF on some Linux u get some default font (because browser doesn't
recognize that font). I hope that I've managed to explane a problem
:-) Does anyone has any solution for this problem??? Please it's very
urgent

Thanks,
Dusan

-- 
made by Dusan

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



[PHP] Validation data - question

2009-06-24 Thread Dušan Novaković
Hi guys,

Does anyone know how to write validation for data witch contains
letters such as šđčćž (those are Serbian letters)?
Here is part of my code where it does validation:

$admins_validation = array('name'=
'/^[[:alnum:][:punct:][:space:]]{1,50}$/',
'surname'   = 
'/^[[:alnum:][:punct:][:space:]]{1,50}$/',
'email'  =
'/^[A-Za-z0-9]+((\.|-|_)[A-Za-z0-9]+)*...@[a-za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/',
..
   );

So, for example if someone enters name Dušan it won't except  it.



-- 
made by Dusan

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



[PHP] move_uploaded_file() problem

2009-02-07 Thread Dušan Novaković
Hi,

I'm having problem with function move_uploaded_file() under Linux
(Slackware 12.2). It  simply want execute only that function in php
file. So maybe I should add something to http.config file or  ? I
tried to execute that php file under Windows and it's working just
fine (I've copied whole project to xampp's htdocs folder and run it
normally).

And also I have question, does anyone knows how to configure apache
(also under same Linux) so that in future I wouldn't have to write
?php but only ? every time I start php code?

Thnx, Dusan

-- 
made by Dusan

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



[PHP] Re: move_uploaded_file() problem

2009-02-07 Thread Dušan Novaković
Hi,

I'm having problem with function move_uploaded_file() under Linux
(Slackware 12.2). It  simply won't execute only that function in php
file. So maybe I should add something to http.config file or  ? I
tried to execute that php file under Windows and it's working just
fine (I've copied whole project to xampp's htdocs folder and run it
normally).

And also I have question, does anyone knows how to configure apache
(also under same Linux) so that in future I wouldn't have to write
?php but only ? every time I start php code?

Thnx, Dusan

On Sat, Feb 7, 2009 at 11:53 AM, Dušan Novaković ndu...@gmail.com wrote:
 Hi,

 I'm having problem with function move_uploaded_file() under Linux
 (Slackware 12.2). It  simply want execute only that function in php
 file. So maybe I should add something to http.config file or  ? I
 tried to execute that php file under Windows and it's working just
 fine (I've copied whole project to xampp's htdocs folder and run it
 normally).

 And also I have question, does anyone knows how to configure apache
 (also under same Linux) so that in future I wouldn't have to write
 ?php but only ? every time I start php code?

 Thnx, Dusan

 --
 made by Dusan




-- 
made by Dusan

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



Re: [PHP] Re: move_uploaded_file() problem

2009-02-07 Thread Dušan Novaković
On Sat, Feb 7, 2009 at 12:29 PM, Alpár Török torokal...@gmail.com wrote:


 2009/2/7 Dušan Novaković ndu...@gmail.com

 Hi,

 I'm having problem with function move_uploaded_file() under Linux
 (Slackware 12.2). It  simply won't execute only that function in php
 file. So maybe I should add something to http.config file or  ? I
 tried to execute that php file under Windows and it's working just
 fine (I've copied whole project to xampp's htdocs folder and run it
 normally).

 Can you show some code?

This is part where I use function move_uploaded_file()

if($_FILES['file']['name']  $_FILES['file']['size']55){

$file_name = 
news_.$_FILES['file']['name'];

$image=../_img/news/.$file_name;  
//Upload file

move_uploaded_file($_FILES['file']['tmp_name'], $image);


}


And normaly HTML code:



form action=?php $_SERVER['PHP_SELF']; ? method=post
enctype=multipart/form-data name=form id=form

...

pbr
  Slika [max 500kB; formati: gif, jpg, jpeg]:
input name=file type=file size=50 
  /p
.



 And also I have question, does anyone knows how to configure apache
 (also under same Linux) so that in future I woul

 dn't have to write
 ?php but only ? every time I start php code?

 You need to change the enable_short_tags  directive. It is probably more
 simple to do it in the php.ini configuration file and not in the apache
 configuration file, but you should know that short tags are off by default
 because they conflict with xml.

 Thnx, Dusan

 On Sat, Feb 7, 2009 at 11:53 AM, Dušan Novaković ndu...@gmail.com wrote:
  Hi,
 
  I'm having problem with function move_uploaded_file() under Linux
  (Slackware 12.2). It  simply want execute only that function in php
  file. So maybe I should add something to http.config file or  ? I
  tried to execute that php file under Windows and it's working just
  fine (I've copied whole project to xampp's htdocs folder and run it
  normally).
 
  And also I have question, does anyone knows how to configure apache
  (also under same Linux) so that in future I wouldn't have to write
  ?php but only ? every time I start php code?
 
  Thnx, Dusan
 
  --
  made by Dusan
 



 --
 made by Dusan

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




 --
 Alpar Torok




-- 
made by Dusan

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



[PHP] Redirecting from unreachable page on website

2009-01-21 Thread Dušan Novaković
Hi,

Is there some elegant solution how to redirect if someone try to open
some non existing page (e.g www.domain.com/nonexistingpage.php) to
main page www.domain.com on website?

thnx, Dusan

-- 
made by Dusan

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



Re: [PHP] Redirecting from unreachable page on website

2009-01-21 Thread Dušan Novaković
apache :-)

2009/1/21 Kyle Terry k...@kyleterry.com:
 2009/1/21 Kyle Terry k...@kyleterry.com:
 On Wed, Jan 21, 2009 at 10:12 AM, Dušan Novaković ndu...@gmail.com wrote:
 Hi,

 Is there some elegant solution how to redirect if someone try to open
 some non existing page (e.g www.domain.com/nonexistingpage.php) to
 main page www.domain.com on website?

 thnx, Dusan

 --
 made by Dusan

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



 Google for apache 404 redirect and read around a bit. Checkout the
 documentation on apache.org as well.

 --
 Kyle Terry | www.kyleterry.com


 That was assuming you are using apache by the way. What web server are
 you using?

 --
 Kyle Terry | www.kyleterry.com




-- 
made by Dusan

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



[PHP] Output to matrix printer

2008-10-14 Thread Dušan Novaković
I have some request to sent text to matrix printer to print ticket for
theater. Is it possible to do that whit some php functions? Main point
is how to control length of paper that will be drawn inside and to
print text on a specific place. It would be nice if somebody can write
the code about this as example.

Thnx, Dusan

-- 
made by Dusan

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



Re: [PHP] Session problem

2007-09-30 Thread Dušan Novaković
Does no one have some solution or suggestion?

Dušan


On 9/29/07, Dušan Novaković [EMAIL PROTECTED] wrote:
 Hm..

 I don't know that. I have also another application on the same server,
 and I haven't encountered problems of the same kind. I don't know
 whether these problems don't happend at all on this other application,
 or I just haven't come across one. :-(

 Dušan


 On 9/28/07, Jim Lucas [EMAIL PROTECTED] wrote:
  Dušan Novaković wrote:
   Hi,
  
   I have two problems with sessions.
  
   Firstly, even though session limit is set on default value on server,
   which is about 5 hours, if I don't take any action for about 15 mins I
   am thrown out and I have to log in again. Are there any addition
   functions which I can use in order to explicitly specify session
   lifetime?
  
   Secondly, after a certain period of time, while I am logged in, page
   just freezes and it indicates that it is trying to load. Page stays
   frozen all the time. At that moment, the only solution is to clear
   private data in the browser. After that, I am logged out and I can
   regulary log in and procede to work normally. It doesn't happend evry
   time I log in, but once in while.
  
   I have only used functions such as session_start()  and session_destroy.
  
   Thanks for your help,
   Dušan
  
   - -
   made by Dusan
 
  sounds like a problem with the hosting provider.
 
  Is this a single server that you have your web site on, or is it a farm of 
  servers?
 
  --
  Jim Lucas
 
  Some men are born to greatness, some achieve greatness,
  and some have greatness thrust upon them.
 
  Twelfth Night, Act II, Scene V
   by William Shakespeare
 
 


 --
 made by Dusan



-- 
made by Dusan


[PHP] Session problem

2007-09-28 Thread Dušan Novaković
Hi,

I have two problems with sessions.

Firstly, even though session limit is set on default value on server,
which is about 5 hours, if I don't take any action for about 15 mins I
am thrown out and I have to log in again. Are there any addition
functions which I can use in order to explicitly specify session
lifetime?

Secondly, after a certain period of time, while I am logged in, page
just freezes and it indicates that it is trying to load. Page stays
frozen all the time. At that moment, the only solution is to clear
private data in the browser. After that, I am logged out and I can
regulary log in and procede to work normally. It doesn't happend evry
time I log in, but once in while.

I have only used functions such as session_start()  and session_destroy.

Thanks for your help,
Dušan

- -
made by Dusan