Re: [PHP] How to handle the POST data
"There are many solutions. My favorite:" That is, my favourite aswell! :) Works like a charm, not to say the benefits. You get all the processing detail inside 1 single file, which makes development easier in my opinion. Kim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Share Folder...
Do you mean like windows shared folders? What do you mean ? kim "D. Jame" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I have three machine 1, 2, 3. all online & have unique IP. one of them (no. 3) running web server which configured with PHP, now my problem is I want to show share directory on Web page to my users. when they enter IP of machine 1 or 2... anyone to know...plz help me.. jame -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Delete Temporary Internet Files
Hmm.. This shouldnt be a problem from what I know. Though it woldt be a perfect system, all you would need to do, is have a script that does : 1: Read the IE cache directory and puts all the entries into an array (all the files), 2: unlink all the files in the array. This would in my opinion work nice, except that alot of the files you cant delete at a given time, just try doing it manually. But itll clean the most. I wouldnt recommend this way of doing it, but it should work. As for other files on the windows system, just be sure that hey arnt write protected, as PHP cant unlink / delete them then. Kim "Joe Mack" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am trying to use PHP to delete temporary internet files in IE6. I would > also like to access other "Internet Options" functions. Any assistance > would be appreciated. > > Thanks. > > Joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Share Folder...
You wrote in email : > How to find the Drive letters and Drive Types of remote system WNT, i have > system administrator password too.. > this all work done by PHP, when my client give IP, user /password then > my PHP scirpt show him system drive/ folders... how it possible > > > Plz help... > > thnx Using the EXEC command and parsing the output from this, it should be possible given the fact that your internal network has opened up for filesharing, and U are running win2000, you then have access to the tools that hackers love to use, but in Ur case solves the problem. By issuing this command into EXEC and pulling the output, and the IP is the name of the machine your locating, youll get what U want. nbtstat -a 1.2.3.4 This will tell you the share names of that computer, and you will be able to know the names of the shared drives to access. This would have to be done to all the IPs in order to gain access to all the shares. After this you have to parse each line from the output, and look for the <20> folders, which indicate an open share. Be aware that you should not open for this type of networking outbound to the internet, as hackers easilly can access your machines as well. I preferr installing 2 network cards in the machine, one for local network and 1 for internet, where the internet network card is blocked for NETBIOS over TCP/IP, and the local network connection is opened. If U only have 1 network card in each machine, I suggest U get a router with hardware firewall, where U insert the internet connection directly into the router, this will prevent NETBIOS over TCP/IP from the Internet. Kim >> Do you mean like windows shared folders? >> >> What do you mean ? >> >> kim >> > Hi, > > I have three machine 1, 2, 3. all online & have unique IP. one of them (no. > 3) running web server which configured with PHP, > now my problem is > I want to show share directory on Web page to my users. when they enter IP > of machine 1 or 2... > anyone to know...plz help me.. > > > jame -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to find the Drive letters
Check my reply under "Share folder". >From what I know you cant get hold of the accuall drive letter on a remote machine without hacking it, and therefore my short answer will be that U cant do it. U can get the shares, and access them as explained in the other post -> but not the physical drive letters. Kim "D. Jame" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] hi, How to find the Drive letters and Drive Types of remote system WNT, i have system administrator password too.. this all work done with PHP pages, when my client give IP, user /password then my PHP scirpt show him that system drive/ folders... Plz help... thnx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with scripts to add records to a database
Important to mention, that the reason why the $variable probably doesnt work is that your service provider has turned off the globals. In this case you would need, as Zhuravlev mentions, use $_POST["variable"] to insert the records. All in all, since the factory setting in the new versions of PHP are Globals off, using POST and GET is much better practise, so just start using it, :) And ofcourse : If U are using GET method in your form, then you use the $_GET["variable"] instead. You probably also know, that the way U are writing your code isnt very handy in the long run, if you alter your database you will need to recode all the pages that inserts anything. You probably know the names of your table, so I would recommend you do this instead : Say the table is like this, and to quicken my typing I assume globals is on, :) id first last phone You would write : insert into contacts values ('','$first','$last','$phpne'); You should write this : insert into contacts (first,last,phone) VALUES ('$first','$last','$phone'); WHY? If you alter your table, insert a new row or remove one, your example will fail mySQL and result in an error since the query doesnt match the table. In my example it will have no difference, aslong as first,last and phone are still in the table. The autoincrement value will still be updated as intended, aslong as the table is correctly formatted (and it is, since your first example works). Kim "Zhuravlev Alexander" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, Nov 11, 2003 at 07:44:58PM -0800, Mark wrote: > > I am following the tutorial at > > http://www.freewebmasterhelp.com/tutorials/phpmysql/ > > The source code is on the website on the left hand side > > http://www.freewebmasterhelp.com/static/tutorials/phpmysql/example.zip > > > > > > My software: > > PHP version 4.3.4 on Windows 2000 > > MYSQL version 4.0.16 on Windows 2000 > > Apache version 1.3.29 on Windows 2000 > > > > The problem is I cannot get the database to add a new records aside from > > the auto-increment field. All the other fields are left blank when the > > add.html is subitted. > > > > I have the add.html with the following code exactly the same as the > > source code. > > > > > > First Name: > > Last Name: > > Phone: > > Mobile: > > Fax: > > E-mail: > > Web: > > > > > > > > > > The insert.php > > > include("dbinfo.inc.php"); > > mysql_connect(localhost,$username,$password); > > @mysql_select_db($database) or die( "Unable to select database"); > > > > $query = "INSERT INTO contacts VALUES > > ('','$first','$last','$phone','$mobile','$fax','$email','$web')"; > > http://ru3.php.net/manual/en/security.registerglobals.php > > try > $query = "insert into contacts values ('',".$_POST['first'].",".$_POST['last'].",".$_POST['phone'].",".$_POST['mob ile'],",".$_POST['fax'].",".$_POST['email'].",".$_POST['web'].")"; > > and so on ... > > > mysql_query($query); > > > > mysql_close(); > > ?> > > > > > > > > Any help would be much appreciated. > > > > Regards, > > Mark > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- zhuravlev alexander >u l s t u n o c > ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sorting files by date
U wouldnt need to timestamp it, split the filename insert into 2 dimensional array, and use the sort() command and you have it. Se examples her, theres also examples of sorting into more levels, meaning you can sort first by date, then by filename aslong as you do your splitting right, :) http://se.php.net/sort Kim "Justin French" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I have a dir of files saved in the following format: -MM-DD.mp4. I > know how to get the file names into an array, but I don't know how to > sort the array so that the files appear in date order. My guess was to > use strtotime() to get the date into a timestamp, then sort on the > timestamp, but there MUST be an easier way :) > > I've read through most of the array part of the manual, but can't see > what I need. > > > Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Time problem
Well, If your into your programming, have a look at this one : http://www.phpclasses.org/browse.html/package/1199.html It does something else, but the same approach can be used to format your readable dates. This wheel has surely been invented already, so you probably should do some googling to find a finnished class og function that does this for you. Kim "Erin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi All, > Sorry if this has been asked a 1000 times and if its easy to find in the > php manual but i cant seam to solve this. > > How do i convert a timestamp in to a normal readable time & date ie > > 2003155023 > > into > > 11th November 2003 @ 15:50:23 > > > Many thanks, thought id ask someone is bound to have a snippet for this. > > > > Regards > > All > > > > Erin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Delete Temporary Internet Files
The original question didnt consert the OS, or where the user was at. Concerning cleaning the IE directory I would assume that he's installed PHP and IIS / Apache on his local machine. Using a webpage online on the internet to fix your local machine doesnt sound logical to me, therefore I assume local innstallation on local machine. And when your on your local machine there are no problems accessing your files, even if they belong to the windows environment. Overwriting them can be problematic at times, since processed may use the file. Kim "Mark" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > --- Kim Steinhaug <[EMAIL PROTECTED]> wrote: > > Hmm.. > > > > This shouldnt be a problem from what I know. Though it woldt be a > > perfect > > system, > > > > all you would need to do, is have a script that does : > > > > 1: Read the IE cache directory and puts all the entries into an > > array (all > > the files), > > How do you propose to read the files from the client? You can read > any files you like (and have permission to) on the server, but you > can't read the client files with PHP. > > > 2: unlink all the files in the array. > > > > Just as you can't read files on a client, you can't unlink a file on > a client with PHP either. unlink() works on files on the server, not > a client. > > > This would in my opinion work nice, except that alot of the files > > you cant > > delete > > at a given time, just try doing it manually. But itll clean the > > most. I > > wouldnt recommend > > this way of doing it, but it should work. > > > > As for other files on the windows system, just be sure that hey > > arnt write > > protected, as > > PHP cant unlink / delete them then. > > > > Kim > > > > "Joe Mack" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > I am trying to use PHP to delete temporary internet files in IE6. > > I would > > > also like to access other "Internet Options" functions. Any > > assistance > > > would be appreciated. > > > > > > Thanks. > > > > > > Joe > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > = > Mark Weinstock > [EMAIL PROTECTED] > *** > You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. > *** > > __ > Do you Yahoo!? > Protect your identity with Yahoo! Mail AddressGuard > http://antispam.yahoo.com/whatsnewfree -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Delete Temporary Internet Files
hehe, To me it I could say the same, why on earth would you want a script to alter the internet options when its up under Tools/Internet Options anyways? The sane sollution would be that some people have strange ideas, some people like to do things their own way. I myself often create PHP scripts that does alot of filework on my PC, since I know PHP and dont know Visual Basic. Therefore PHP is the "naturural" choice of programming language for me, and therefor probably for alot of other PHP people. The question regarding the Internet Options does boggle me aswell, :) I feel that me and U arguing about this is plain silly, until we get some more input from the OP comes with some more "feedback" on excactly what he wanted, :) On the other hand, if (And I think not), that the internet options (And I have to believe that we are talking Internet Explorer, based on the fact he earlier mentioned cache files, could be Opera however) are controlled from an .INI file, this also should be no problem on the windows machine. But I think we have long passed the topic here. Kim "Mark" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > --- Kim Steinhaug <[EMAIL PROTECTED]> wrote: > > The original question didnt consert the OS, or where the user was > > at. > > Concerning cleaning the IE directory I would assume that he's > > installed > > PHP and IIS / Apache on his local machine. > > > > Using a webpage online on the internet to fix your local machine > > doesnt > > sound logical to me, therefore I assume local innstallation on > > local > > machine. > > > > And when your on your local machine there are no problems accessing > > your > > files, > > even if they belong to the windows environment. Overwriting them > > can be > > problematic at times, since processed may use the file. > > But why in the world would you want to edit other "Internet Options" > for a PC that is acting as a web server? I stand by my assumption > that the OP wanted to change the client machine's settings (and > delete the client temp files), and not the settings on the server. Of > course, I could be wrong. It happens daily. > > > = > Mark Weinstock > [EMAIL PROTECTED] > *** > You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. > *** > > __ > Do you Yahoo!? > Protect your identity with Yahoo! Mail AddressGuard > http://antispam.yahoo.com/whatsnewfree -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling PHP functions from within javascript
"First thing is, it's possible" First of all PHP is server-side and has nothing to do with client side. If you have managed to do this, you must have some concepts screwed up! Lets not believe that PHP is client side all of a sudden! Sorry mac -> But you havnt done this in the past! a) On the other hand, there is a way you can do what U want -> thanks to the fact that Javascript is able to load a datafile. If this file is a PHP file that is processed serverside you will accomplish your goals. b) Latest addons from Microsoft into Internet explorer makes the loading of ekstra files through XML modules very flexible and easy. Ive done this myself and it works like a breeze. If you here load the XML data, instead the data is your DB data and use this in your JS as the XML parser has loaded it into variable... You have accomplished your goal. That was 2 sollutions you could use, were noone are any good really. Ive made some sites myself that are interactive in many ways earlier, and come to the conclusion that the pages just have to become bigger. An example, a webstore sollution I have developed has an interactive menu selector buildt in javascript, which stores all possible category combinations. To keep it short here -> This javascript after its buildt by my PHP is 120KB, and makes the HTML very large, it ends up in like 150 KB. Point is, if there were a sollution you are talking about -> I could have shrinked the 120KB kode down to 10KB instead, just pulling out the data from the DB that the customer aquired. Ive spent hours looking for this sollution, and above you got the ones Ive come about, where the XML is the one accually working. (Point out that the XML model doesnt handle ØÆÅÄÖ characters -> which resulted in me not using this. If it could handle this, XML would be my sollution! Kim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST bug?
My system (win2000 IIS) also handles 0, and webserver (redhat apache) also handles 0. Your system sounds faulty in some way, what browser are U using and what version of PHP. I know from earlier experience that some versions of Netscape behaves strange on the elements, meaning when posting / "getting" the data back to the server. I remember this as one of my "domain search" utilities always came "emtpy" in netscape, and not in Opera and Explorer. So it could be this, but if youre not on Netscape -> Its not this. :) Kim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling PHP functions from within javascript
"scripting techniques and a hidden iframe" Ahh... Nice one! This accually didnt come to mind at all for me, probably because this sort of scripting soon gets very complicated given that such applications are supposed to work flawlessy for the end user. And to many loading windows (hidden frames), and scripts waiting for pages to load is - atleast in my experience - not the way of doing things, as there has to be alot of "what if the data doesnt arrive..." scenarios. But hey, the author didt accually say what he was supposed to use this for, so I should be thinking to much application here.. But nice, we now have 3 ways of "doing" this. 1. Javascript, and loading external files. Bad sollution. 2. XML, loading the data. My favourite as you nicely pass GET variables into the URL you get, 3. And last, Javascript and iFrame/frames based loading. Again, bad move in my opinion, as in the end there is alot op PHP work here - and alot of javascript work here, and you could just do all with a little PHP. developer.irt.org has some nice articles for those of you who are interested in dwelling down into the javascript file method : http://developer.irt.org/script/file.htm also an article (havnt read it) about Javascript and DB, through data binding : http://tech.irt.org/articles/js060/index.htm Okidoki. Kist --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Extracting Source code from Binary Files(.dll,.exe.,class)
I used to think this was a very much needed tool, but now I have a different opinion. Thank god reverse engineering isnt the easiest thing to do! Why else do we accually pay licenses for products like IonCube and Zend Encoder! They would be worthless if such software were available, not to think of the gaming industry. All software can be reimported back into the source, one way or another, but in most cases all code will be obfuscated and truly, darn hard to read. But as said, the logic is still there. I will say it like this : If its your own software your going after and have lost your backup / source code : Man, I wish you luck - your gonna need it! Good luck, Kist --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: get some part of text
You could ofcourse to the "easyway out" splitting, hehe. example : $yourstring = 'job_resp errorCode="4194337" description="Originator you"'; $temp = explode('errorCode="',$yourstring); $temp2=explode('"',$temp[0]); echo $temp2[0]; Voila! Should always work, aslong as there there are always " around the text. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Qt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > dear Sirs, > > I have this string; > > job_resp errorCode="4194337" description="Originator you" > > I need to take only errorCode value from this string. I am thinking and > thinking and can not find how to to. I can split with "=" but allways > erroCode place is changing in the string. > > Any idea > > Best Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can I license a php script?
Robert has some interesting thoughts aswell here. I just wanted to complement the stuff about securing your scripts. Zend has Zend Encoder, rather expensive - and with windows GUI. IonCube also has encoder, much more affordable, CommandLine. www.zend.com The first encodes and optimizes your code, and your server has 2 have the Zend Optimizer installed on its system for it to run. This has shown in history to be complicated on some ISP, who never gets their finger out and can install this. But usually, 4/5 it goes well. www.ioncube.com / www.ioncube.co.uk This one compiles and encrypts and optimizes (I think). It requires a module installed on the server, but -> It can also run on most modern apache systems where it installs on the fly (the decoder). Ive just purchased the licence for this product myself, and it looks really promising. Benchmarks on their page also shows that this software accually beats the Zend Encoder, and the price is far better to, :) If you are developing some sort of software, you should always protect it so that : 1) Your competitors / resellers doesnt fuck you over by "selling" without you knowing it, or "fix" your code to fit their needs without you getting credit /payd for it. 2) Your customers doesnt play "developers" and try jerking your scripts, which in the long run gives you alot of extra support time as the scripts go bugging out. Happy programming! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Dan Joseph" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > Its like any program written in any language. You are licensing the > product you created with the language, the functionality, the int property, > etc.. Stick a price on it, and sell it. There are some tools for > protecting your source of the code too. Check www.zend.com, I don't > remember what it was called. > > -Dan Joseph > > > -Original Message- > > From: Chris [mailto:[EMAIL PROTECTED] > > Sent: Friday, November 14, 2003 5:28 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] can I license a php script? > > > > > > I am planning on writing a program in PHP and, hopefully sell it for a few > > dollars. Are there any licensing issues I should be concerned about when I > > distribute the program. What confuses me is, I'm not distributing PHP only > > code that uses PHP, so what am I to license, my intellectual property? > > > > Thanks > > Chris > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: get some part of text
Well, still no problem. If there are only one instance of the "job_resp errorCode" you just alter the explode() abit. Else, the clever part with array_push() Let me do some online coding here, might contain some errors though, :) $error = new array(); $yourstring = 'job_resp errorCode="4194337" description="Originator you"'; $temp = explode('errorCode="',$yourstring); $count = count($temp); if($temp>1){ for ($i = 0; $i < $count; $i++) { // Loop through the errors / exploded ones step 1/2 $temp2=explode('"',$temp[$i]); array_push($error,$temp2[0]);// Push all the errors variables into an array step 2/2 } for ($i = 0; $i < count($error); $i++) {// Print out all the errors echo $error[0]; } } else { $temp2=explode('"',$temp[0]); echo $temp2[0]; } - - - - The above example I use alot, I find pushing things into array beeing a very handy way of doing things, as its very nice and handles n occurencies. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Qt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > dear Kim, > > Thanks for your clever soltion but; > > If string will have another errorCode before 'job_resp errorCode=" > It will use first one value. > > What can we do better than this one? > > > "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > You could ofcourse to the "easyway out" splitting, hehe. > > > > example : > > $yourstring = 'job_resp errorCode="4194337" description="Originator you"'; > > $temp = explode('errorCode="',$yourstring); > > $temp2=explode('"',$temp[0]); > > echo $temp2[0]; > > > > Voila! > > > > Should always work, aslong as there there are always " around the text. > > > > -- > > Kim Steinhaug > > --- > > There are 10 types of people when it comes to binary numbers: > > those who understand them, and those who don't. > > --- > > > > > > "Qt" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > dear Sirs, > > > > > > I have this string; > > > > > > job_resp errorCode="4194337" description="Originator you" > > > > > > I need to take only errorCode value from this string. I am thinking and > > > thinking and can not find how to to. I can split with "=" but allways > > > erroCode place is changing in the string. > > > > > > Any idea > > > > > > Best Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Storing images
Well as far as I can see you have 2 options. a) Store them directly on disc b) Store them in a database (eg. mySQL) I would think that a) is the best way without doubt, since it doest use any extra processing power to serve the images to your visitors as its only the webserver doing the usuall stuff. The b) option has a better advantage regarding the backup function, as its easier backuping a database than backing up a directory with scripts anyway. (Unless you are thinking FTP, but right now im thinking automatied scripts) On the otehr hand I have succesfully installed ZIP ability with PHP, which makes backing up directories no problem. So all in all it depends on where you stand if you know what I mean. The database sollution puts extra demand on the database as it constantly has to query the database to get the images all the time. So if you are thinking about the health of your server, and how quick you want your site to accessible for your visitors I would stick to a) I dont think it good practise to store images into the database either. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Paul Marinas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Hi, i was wondering which is the best way to store images. I'm using an > upload section for my site and i'm using a script to put those images > from the upload section on a diferent section of the site. > > 10x > Paul > GnuPG Key http://sgi.rdscv.ro/~paulm/paulm.PGP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Alternet row colors
Well, first of all Ill just scrap you script since this one is so easy its better to do it from scratch. OK, somewhere in your script you have the code that accually aoutputs the tables you are working with. Im refferring to lines here, and Im meaning the bottom of this document which is the scipt you posted, and I have numbered the lines. Overview of your script. Line 5 - we print out the table header Line 11 - 23 is the loop which prints out all the lines, or rows. Line 24 closes the table. So what we have to do? First we need to declare the values we want to use as backround colours, lets use logical names : (fig a) $backcolor1="#fafafa"; $backcolor2="#c0c0c0"; $backcolor=$backcolor1;// we assign color 1 This code has to be written before the loop starts, so somewhere before line 11. In the loop (11-23) we need to switch between the colours where we write the colour of the . So we write something like : (fig b) echo ''; // continue with the rest of here // which is -> your code. This will print out the first background color, nice. Now we need it to switch color, so we need to add a little logic. This will be inserted right before the loop ends (infact, you can put it where ever you like aslong as its in the loop). (fig c) if($backcolor=backcolor1) $backcolor=$backcolor2; else $backcolor=$backcolor1; As you see above the logic is quite simple, if the color is 1 -> we set it to 2, else we set it to 1. If you think of it, if you process this logic over and over again you will infact get 1, 2, 1, 2, 1, 2, 1, 2 all the time, :) Nice! There you have it, and I hope you got the hang of it. To take your code and implement my colorswither all you need to do is, 1. On line 21 replace #00 width $backcolor 2. Insert the logic (figc), all lines, into line 19 3. Place fig a in line 4. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- The code for return the top ten result is : 1 $result = mysql_query("SELECT * FROM albums where id <15"); 2 3 $Count = @mysql_num_rows($result); 4 5 echo "\n"; 7echo "IDARTISTTITLELABELPRICE\n"; 10 11 for ($count = 0; $count < $Count; $count++) { 12 // Extract post details from database 13$myrow = mysql_fetch_array($result); 14 $id = $myrow ['id']; 15 $artist = $myrow ['artist']; 16 $title = $myrow ['title']; 17 $label = $myrow ['label']; 18 $price = $myrow ['price']; 19 20 printf("$id$artist$title$label 22£$price\n"); 23} 24 echo "\n"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Alternet row colors
Thanks for this tip, i used to use this when I programmed Perl. But I didnt know it worked here aswell, hehe. Absolutely true that this is much better code practise, and it eases up the lines in the code. Great tip! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Keith Greene" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] It's so much easier to use the mod (%) operator: using the mod operator, you can check if a variable is divisible by some other number without leaving a remainder. For this example, we want to change every other row, so we would compare our $count against 2 to see if it leaves a remainder: $bg = ($count%2==0) ? "#00" : "FF"; What this line does is FIRST, it checks to see if $count/2 leaves no remainder. If this is true, it sets the $bg var to "#00" If it is false, it sets $bg to "#FF" It only requires the addition of one line of code, and to replace your row background color with a php variable. Also, you don't need to use printf(), since you aren't specifying any formatting. See code below: code:--- $result = mysql_query("SELECT * FROM albums where id <15"); $Count = @mysql_num_rows($result); echo "\n"; echo "IDARTISTTITLELABELPRICE\n"; for ($count = 0; $count < $Count; $count++) { // Extract post details from database $myrow = mysql_fetch_array($result); $id = $myrow ['id']; $artist = $myrow ['artist']; $title = $myrow ['title']; $label = $myrow ['label']; $price = $myrow ['price']; $bg = ($count%2==0) ? "#00" : "FF"; echo "$id$artist$title$label £$price\n"; } echo "\n"; At 01:08 PM 11/15/2003, you wrote: >Well, first of all Ill just scrap you script since this one is so easy >its better to do it from scratch. > >OK, somewhere in your script you have the code that accually >aoutputs the tables you are working with. Im refferring to lines >here, and Im meaning the bottom of this document which is >the scipt you posted, and I have numbered the lines. > >Overview of your script. >Line 5 - we print out the table header >Line 11 - 23 is the loop which prints out all the lines, or rows. >Line 24 closes the table. > >So what we have to do? > >First we need to declare the values we want to use as backround >colours, lets use logical names : > >(fig a) > $backcolor1="#fafafa"; > $backcolor2="#c0c0c0"; > $backcolor=$backcolor1;// we assign color 1 > >This code has to be written before the loop starts, so somewhere >before line 11. > >In the loop (11-23) we need to switch between the colours where >we write the colour of the . So we write something like : > >(fig b) > echo ''; > // continue with the rest of here > // which is -> your code. > >This will print out the first background color, nice. Now we need it >to switch color, so we need to add a little logic. This will be inserted >right before the loop ends (infact, you can put it where ever you like >aslong as its in the loop). > >(fig c) > if($backcolor=backcolor1) > $backcolor=$backcolor2; > else > $backcolor=$backcolor1; > >As you see above the logic is quite simple, if the color is 1 -> we set it >to 2, >else we set it to 1. If you think of it, if you process this logic over and >over again >you will infact get 1, 2, 1, 2, 1, 2, 1, 2 all the time, :) Nice! > >There you have it, and I hope you got the hang of it. > >To take your code and implement my colorswither all you need to do is, > >1. On line 21 replace #00 width $backcolor >2. Insert the logic (figc), all lines, into line 19 >3. Place fig a in line 4. > >-- >Kim Steinhaug >--- >There are 10 types of people when it comes to binary numbers: >those who understand them, and those who don't. >--- > > >The code for return the top ten result is : >1 $result = mysql_query("SELECT * FROM albums where id <15"); >2 >3 $Count = @mysql_num_rows($result); >4 >5 echo "6 bordercolor='#00'>\n"; >7echo "ID8 bgcolor='#66'>ARTISTTITLE9 bgcolor='#66'>LABELPRICE\n"; >10 >11 for ($count = 0; $count < $C
[PHP] Re: Table statistics
Well, Im about to create some statistics systems myself and havnt really starter thinking of the "optimal" way of doing such calculations so this thread will be much interesting. I would suggest the following : As you have already pulled out all the data from that month, we need to prosess this. I would create a 2 dimensional array for every Screen_ Name, // Initiate array $count = array(); // Loop through your data and assign all the users like this $count[$Screen_ Name] = 0; This will give you an array of all the users, then you could loop through the data again and add 1 for each instance of the user to meassure the counts : $count[$Screen_ Name]++; Finally you sort the array and print out the first 5. (The 2 last steps should be put together since its no use going through the data twice) -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Daniel Harik" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I have table with messages, and i have users table, the are linked via PK > UserID -> UserID, what i need is to select Messages for current month and > calculate top 5 posters list for current month. > > I have create following query but it's not complete: > > SELECT Handle, Screen_Name from MBoard where Message_Date>='2003-11-00' ORDER BY Handle; > > this gets me all messages posted this month ordered by userid > > > Thank You. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Table statistics
By the way, while I write the message I forgot to correct the "2 dimentional array" to "array"... Context is everything, :) -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. ------- "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Well, Im about to create some statistics systems myself and havnt really > starter > thinking of the "optimal" way of doing such calculations so this thread will > be much > interesting. > > I would suggest the following : > > As you have already pulled out all the data from that month, we need to > prosess this. > I would create a 2 dimensional array for every Screen_ Name, > > // Initiate array > $count = array(); > > // Loop through your data and assign all the users like this > $count[$Screen_ Name] = 0; > > This will give you an array of all the users, then you could loop through > the data again and > add 1 for each instance of the user to meassure the counts : > $count[$Screen_ Name]++; > > Finally you sort the array and print out the first 5. > > (The 2 last steps should be put together since its no use going through the > data twice) > > -- > Kim Steinhaug > --- > There are 10 types of people when it comes to binary numbers: > those who understand them, and those who don't. > --- > > > "Daniel Harik" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hello, > > > > I have table with messages, and i have users table, the are linked via PK > > UserID -> UserID, what i need is to select Messages for current month and > > calculate top 5 posters list for current month. > > > > I have create following query but it's not complete: > > > > SELECT Handle, Screen_Name from MBoard where Message_Date>='2003-11-00' > ORDER BY Handle; > > > > this gets me all messages posted this month ordered by userid > > > > > > Thank You. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unzip a file.
on phpclasses.org there is a ZIP class that does all you need to do. Havnt got the time to give you the url right now, but look there. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "John Nichel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Vincent M. wrote: > > > Hello, > > > > Is there an easy way to unzip a zipped file which contains files > > (images), using a function from the zlib or any. > > To something like that: > > > > exec("unzip zipfile.zip -d /path/to/images") ; > > > > But without using the exec function. > > > > Thanks, > > Vincent. > > > > You may want to check here > > http://www.php.net/manual/en/ref.zip.php > > The functions are read only. I don't know if this will do it, but it > seems that if you can /read/ an entry in the zip file, you should be > able to write it somewhere. > > However, if you just want to execute the command line app on the OS and > not use exec(), just enclose your statement in backticks > > `unzip zipfile.zip -d /path/to/images`; > > -- > By-Tor.com > It's all about the Rush > http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unzip a file.
Hello! This one : http://www.phpclasses.org/browse.html/package/870.html I remember doing the "zip" research a while ago and tested several classes and methods, but this class was the one that worked flawlessly! Ive installed and used this class myself, and it works on both linux and windows. This can zip down a directory of 1GB of data (tested), and depack it to another directory (tested). You can also extract single files out of the directory. If you havnt found a sollution you should try this one. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Vincent M." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Kim Steinhaug wrote: > > on phpclasses.org there is a ZIP class that does all you need to do. > > Havnt got the time to give you the url right now, but look there. > > > All I found are classes to extract tar/gzip files: > http://www.phpclasses.org/search.html?words=zip&go_search=1&restrict=&method=and&sort=score > > Is there any I couldn't see ? > > Thanks, > Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing images for photo album?
Yes, What system are you using for generating the thumbs for your images? ImageMagick or GD? If you are able to choose you should by all means choose ImageMagick since its much more powerfull than GD. Ive been using both (meaning, I use GD as a second sollution where Image Magick isnt available, for extra compability) and never run into memory problems. Only thing to remember when batching many Hi-Res images that the default timeout is 30 seconds, but aslong as you are processing 1 image into several others this should never be a problem. Give us some specs and we might be able to help you! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "David T-G" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't fetch HTTP POST data in PHP?
I dont see the problem here at all, here is my test : CutNpaste into your own environment ans save as .php file . All I did was remove the php_info() so that variables dont get messed up (apparently), and removed the error_reporting. Result gives this : array(3) { ["username"]=> string(3) "123" ["email"]=> string(3) "123" ["submit"]=> string(10) "Submit me!" } - Untitled \n"; //phpinfo(); echo "\n"; var_dump($_POST); ?> Your name: Email: -- -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "David T-G" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: thanks for the summary (was "Re: [PHP] Can't fetch ...")
Alrighty! That sheds some more light on this. How exactly can I replicate this scenario then, using my mobile phone? I have a Nokia 3610i i think, with MMS capabilituies and GPRS WAP. Ive never accually thought of expanding website possibilities with this use, how excatly do I post from my mobile? It might be a dumb question, but when I know this I might be able to look further into the problem. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "David T-G" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Arrays and performance
Something Ive wondered about as I started working with XML. Importing huge XML files, and converting theese to arrays works indeed very well. But I am wondering if there are any limits to how many arrays the PHP can handle when performance is accounted for. Say I create an array from a XML with lots of childs, say we are talking of upto 10 childs, which would give 10 dimensional arrays. Say we then have 10.000 records, or even 100.000 records. Will this be a problem for PHP to handle, or should I break such a prosess into lesser workloads (meaning lesser depth in the array)? Anyone with some experience on this? -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Arrays and performance
Thanks for your reply! Im going to use this for a backup system for our webstore system, where some of our customers have *alot* of products. Given the structure of the database with categories and images 5000 unique products quickly gives 3x = 15000 arrays. But again, how often would the client need to revert the backup? Ive never needed to do it for now, but I still want to do this backup system in XML (Looks kinda up to date, :), and at the same time know that it will eventually work -> even for the customers that infact has alot of products in their system. The alternative, would be that customers with >x products would only have access to mySQL dump. Or to have a script that evaluates the XML file and prompts the user that this file is to large for automatic import / revert. a) >From what I understand of your answer you're telling me that PHP itself will not have any "problems" working with 1.000.000.000 arrays, aslong as there are enough ram and processing power available, and that the timeout is extended. Or would the PHP die a painfull death as soon as it gets "to much" data? Could we coclude the follwing, XMLfile > 200 MB = No PHP! b) I should do some benchmarking, to find the "magic" marker for how much XML data that is "affordable" to grab when done on a webserver with other clients to prevent angry customers or failures due to factory timeout setting to 30 secs. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Raditha Dissanayake" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I belive PHP should be able to handle it but it's a bad idea. The reason > being your app will not scale. Because if you script consumes 2mb of > memory on average, 100 users accesing it at the same time will be 200Mb. > Of course if you expect only a small number of users it does not matter. > > The biggest XML job i have handled with PHP is parsing the ODP RDF dump > which is around 700MB. Obviously arrays are out of the question in such > a scenario, even though only one user will be accessing the script at a > given moment. the ODP dump has a couple of million records > > > > Kim Steinhaug wrote: > > >Something Ive wondered about as I started working with XML. > >Importing huge XML files, and converting theese to arrays works > >indeed very well. But I am wondering if there are any limits to > >how many arrays the PHP can handle when performance is accounted for. > > > >Say I create an array from a XML with lots of childs, say we are > >talking of upto 10 childs, which would give 10 dimensional arrays. > >Say we then have 10.000 records, or even 100.000 records. > > > >Will this be a problem for PHP to handle, or should I break such > >a prosess into lesser workloads (meaning lesser depth in the array)? > > > >Anyone with some experience on this? > > > > > > > > > -- > Raditha Dissanayake. > > http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload > Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader > Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Max File Size exceeded
You are probably referring to >2mb filesize. The default setting in php.ini for uploads are 2 MB. As far as I know there isnt any good way of checking the filesize client-side. You could however use some sort of java-applet I would think for the upload system - this would be able to validate the filesize I guess. The other, and probably the only sollution, would be to modify php.ini on the server to handle larger files. If your on a server with other customers you will probably have a hard time getting your provider to do this as most people have no use for larger files. On the other hand he most likely would love to sell you a dedicated server (so would I, :). -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Unknown Sender" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Hi All, > > I've written a script that accepts an uploaded image, it sets the > MAX_FILE_SIZE hidden variable as specified. However, when a file that is > too large is uploaded the script doesn't get a chance to show its own > error message, instead the warning outputed: > > Warning: Max file size exceeded - file [form_data] not saved in Unknown on > line 0 > > How can I prevent this error occuring and handle the condition myself? > > Thanks, > Shaun > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing vars w/refresh w/register globals off?
Well first off all it is possible to post and get at the same time. Dont know why you want to, but its kinda easy really : Example : You can submit this form several ways, with ordinary submit button, or with javascrip submit. If you really want to keep serving variables that shouldnt be visble in the browser or in the html kode I guess the only way would be using cookies. But if the variables are defined by the users input / behavior there is surely the need of showing the variables one place or another. You mentioned that there were up to a 100 variables to be passed here. Was that pr user or in total? Sending like a 100 variables with GET would be a bad idea all together, since there are limits on how many caracters the URL can hold. Some years ago alot of browsers had a limit on 128 characters, this is imporved by the years but still the only way to feed long sets of data is through post. If all your variables can be stored on the server, assigning a unique ID to the session would make you able to store everything in the database as someone mentioned earlier. This wasy all you need is pass the ID within the browser. By checking the ID against the unique session on the server you will also eliminate tampering with the data. Webpages that has like a 100 hidden fields doesnt look very "professional", but hey - it works. The other thing is that forms can also talk with eachother nicely, what I mean is that you can share the informastion with the help of javascript. Storing all the information you need for later in a form somewhere in the html page, then when you build the refresh url you just pick out the data you want to use from the different form elements (document.form.variable.value). I still havnt quite understood what you are accually asking for here, but hey, it seems like you dont know yourself, hehe -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Floyd Baker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Fri, 18 Jan 2002 18:13:50 +0800, you wrote: > > >On Friday 18 January 2002 04:11, Floyd Baker wrote: > > > >> Yes. I was using the url to pass variables without a form. > >> > >> It looks like the javascript idea would cover that now that you remind > >> me. I've used it before to refresh two frames at once. > >> > >> But even so I'd rather not go that way if at all possible. I'd like > >> to stay within php's ability. > > > >Not being able to POST and GET is a 'limitation' of HTTP not PHP. > > > >> Not knowing what I'm talking about for sure but is there no way of > >> putting a variable into the 'post' status or condition, prior to being > >> redirected, without actually using a form? > > > >Only be using a form will you be able to POST. > > > >> Thanks for the idea though. It'll work if nothing else. :-) > > > > > >Up to now we (I?) still don't know exactly what you're trying to do. Maybe if > >you could tell us what you're doing and if appropriate post some code, then > >we could see if there is another solution to your problem. > > > > > >-- > >Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > > >/* > >I am just a nice, clean-cut Mongolian boy. > > -- Yul Brynner, 1956 > >*/ > > This should be fairly standard. Filling out a form and using a > recursive call and if/then, to bring the variables around to a case > switch for routing to desired pages according to form input data. > > if 'completed = y > ( > > switch > case > get to go here > case > get go there > > ) > else > ( > post to /this page > > submit > ) > > > This draft does work but I don't like the visible url variables. > > Of course in addition we have all the fields passed by the form post > that were used as required on switch case and receiving pages... Now > we need to REQUEST every one. That's fine for the sake of the > security but now it's beneficial to get into arrays, etc. to keep > script shorter and easier to maintain. More learning. Always good. > 4.1 is pushing me. :-) > > The solutions look more involved than my poor coding has been til now. > We need to put more things into function form maybe, instead of > passing between separate pages. > > I'm probably still out in left field with a lot of this *visualizing* > but it's coming. And always good to talk it out. > > Can you tell me if it's possible to run 4.03 and 4.1 *both* on the > same machine? I'm thinking the old script would be php3 and the new > stuff php4. Is that something that could be done until the old > scripts are upgraded? > > Floyd > > > > -- > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Change Date
Is it me or are everyone responding how to give a the date in here? The timestamp is still time() and not date() isnt it? Timestamp works in seconds, so 1 hour is : 60 seconds * 60 minutes. $hour = 60*60; $day = 24*$hour; timestamp for 125 days into the future would then be, $futuretimestamp = time() + ($day*125); time() returns the current timestamp, this very second. All you do is calculate all the seconds there is in 125 days and add it up. If you want to go back to the future, you subtract it from time(). Then, when you want the date to be entered for the screen or somthing use the date() command. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Sadeq Naqashzade" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > How can I find time stamp for example 125 next days. or 03:30 hours next? > > Regards, > S. Naqashzade > PS: Sorry for my bad english :-( > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: House for rent - Good price
Fix your clock! Post like theese really screws up the layout in my newsreader! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "O J P P" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello all mailing list, House for rent - Good price, :), bye. URL : http://www.geocities.com/rapogo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Translate web site language
Fix your clock! Post like theese really screws up the layout in my newsreader! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Orlando Pozo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I think that PHP have libraries to translate one language into another, if you have information about it, please, give me a hand, thanks, bye. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Associative vs normal arrays
Fix your clock! Post like theese really screws up the layout in my newsreader! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Joe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Is there a way to determine if an array is associative or not? Maybe something similar to the is_array() function ?? Thanks, JOE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] The clock issue in this forum!
Im using Outlook Express reading theese messages and I think the newsreader works just fine. But what do I do when theese people post with wrong dates. Is there any way in Outlook Express I can remove theese posts, or do I have to see them topping the list every time I check the lists? Ive tried several ways now, but I cant seem to fix them. Any help would be appritiated? Maby I should change newsreader? -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print..
Fix your clock! Post like theese really screws up the layout in my newsreader! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Daniel Antonio De Lima" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Good Morning I am working with PHP 4.0.6, and I do not obtain to send given of the page for the printer. I use function " PRINTER_OPEN() ", I make the manual in accordance with, exactly thus it gives an error to me of indefinite function. What it can be? Fatal error: Call you undefined function:printer_open() $print = printer_open(); $print = printer_open("LPT1 "); printer_write($print, " Test of printer "); printer_write($print, " Test of printer "); printer_write($print, " Test of printer "); $print = printer_close(); e this error it even gives to me with function " PRINTER_WRITE() ", could give tips of that he can be happening. Yours truly. Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Count online users question
Cookies, or browsersession. I found the latter to be very easy to work with. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Al" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > I am trying to figure an accurate way to calculate how many users are > > viewing a site, at any particular time. This task is very simple except > for > > one part - How do you determine when a person has left the site...apache > > hasn't served anymore requests from a particular ip for xx minutes ?? > > Hi Mike, > > There is no surefire way to measure the exact time a user leaves your site. > The most accurate way I can think of would be to use a hidden frame on all > your pages that refreshes itself every X seconds. When a user has not > requested that special tracking page for more than X seconds, you can assume > they have 'left' the site. > > However this solution seems like overkill for most purposes: you'll be > wasitng server resources and slowing down your users' experience on your > site. > > In response to your proposed method, most advertising associations > (including the US-based Internet Advertising Bureau) and web analytics > companies (such as Red Sherrif, Nielsens and Hitwise) define the end of a > user session on a website when there is 30 minutes without a further request > for a page from the site. > > And while you may be tempted to track only IP numbers, remember that many > users are behind shared IP numbers (e.g. firewalls) which may skew your > stats. You would be better off using cookies on user's machines to identify > them and log their accesses to a DB. > > Hope that helps, > > Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Upload issue - The 2MB barrier...
As the default setting for file upload is set to 2MB, we usually get a problem since we cant always access the php.ini on every server our scripts should be run from. After looking in the php.ini file on one of my webhosting partners I noticed an interesting (in my opinion) thing with the post settings which read : (And to make it clear, I could easilly change the php.ini file, but due to the other clients on this webserver I cant... Im not alone here ) post_max_size = 55M Since the other setting would easilly accept say 5 MB I wonder, would it be possible to upload an image "as a POST"? Or something like this? Maby this is a pointless idea to investigate further ? -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload issue - The 2MB barrier...
Hmm 1. We can rule out the ini_set() 2. We can now rule out the .htaccess Tried the following : .htaccess php_value upload_max_filesize 5M testfile.php print 'upload_max_filesize = ' . ini_get('upload_max_filesize') . "\n"; The testfile succesfully states the new value, but it doesnt work. Obviously, the documentation on php.net already told me so, so the fact that I really tested this is kinda stupid... hehe. That leaves me with the httpd.conf settings which is supposed to work, also according to the PHP documentation. Just need to locate this file first... -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Richard Davey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello Kim, > > Tuesday, December 2, 2003, 12:34:22 PM, you wrote: > > KS> As the default setting for file upload is set to 2MB, we usually get > KS> a problem since we cant always access the php.ini on every server > KS> our scripts should be run from. > > Can you modify the httpd.conf for your site? If so you can over-ride > the upload_max_filesize setting in that without messing up any other > user on the server. > > -- > Best regards, > Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload issue - The 2MB barrier...
I found the file, but since im on a Cpanel server I do have to do some checking with the admin so that I dont mess up for other users. I wouldnt want my experimenting resulting in an unstable server for other users, :) It looks like this is the only way to alter the settings. Thanks for replies. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Kim Steinhaug wrote: > > That leaves me with the httpd.conf settings which is supposed > > to work, also according to the PHP documentation. Just need to > > locate this file first... > > > > $> locate httpd.conf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Dealing with large classes over several files
umm... It all looks good except this one : function foo::f () This is where you get the T_ error. Dont know what you are trying to do here, but thats the error anyways, :) Your first example is all correct, // myclass.inc.php class foo { // constructor and destructor function f () {} } Dont know if it helps you though. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Callum Urquhart" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This may well have come up before as it is an obvious problem/question. > > Coming from a C++ background, I define a class in a header file and define > the functions for that class in a seperate source file. Now the question: is > this possible in PHP4? > > I have tried the obvious: > > // myclass.inc.php > > class foo > { > // constructor and destructor > function f () {} > } > > > // myclass.php > > function foo::f () > { > // define here > } > > > This gives me an error: unexpected T_PAAMAYIM_NEKUDOTAYIM > Is this possible in PHP4, and if not, why not? It's an obvious problem, > namely for code management. > > > -Callum Urquhart > www.pastecode.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Opening large file problem - fopen
Hello Im having real problems working with large files in PHP. At the moment Im trying to parse an error_log file, and it works like a charm, except that the scipt stopps after parsing around 70.000 lines, or around 8MB of data. Im using this : $file= "error_log"; // 280MB file if($fp=fopen($file, "r+")) { while($line=trim(fgets($fp))) { // Do the business } } Surely this is not the way to work with e.g. a 280MB file. I solved the sollution by chopping the file into 7MB files, and adding a fileopen loop around the script above which solves my problem. But -> How do I parse the 280MB file all in 1 go? I have plenty of timeout and plenty of RAM in the php.ini file, so the problem isnt here. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Opening large file problem - fopen
I found that the script accually breaks on this line : [Mon Jul 14 12:17:26 2003] [error] PHP Notice: INSERT INTO tbl_news (band_id, date, heading,heading_eng, ingress,ingress_eng, body,body_eng) VALUES (-1,"2003-07-14","TESTAMENT endelig til Norge!!!", "Spiller p Rock in - spesial treat for the fans!", "", "", "Testament + support spiller pe Rock In onsdag 30.juli. Grunnet opptatte strre spillesteder ensket Testament likevel gj/re Norge, med en kveld dedikert til fansen som har mttet vente pt Norgesbesket i su mange r.. Rock In blir garantert utsolgt, sr her er det bare hamstre billett ss fort s mulig!! Billetter pl billettservice/posten Bill.pris 250,-+avg. - Drene cpner 19.00","") in /home/xxx/public_html/admin/news_send.php on line 27 [Mon Jul 14 12:17:26 2003] [error] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/public_html/admin/news_send.php:2) in /home/pilotman/public_html/admin/news_send.php on line 34 --- Hope this helpls. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello > > Im having real problems working with large files in PHP. At > the moment Im trying to parse an error_log file, and it works > like a charm, except that the scipt stopps after parsing around > 70.000 lines, or around 8MB of data. Im using this : > > $file= "error_log"; // 280MB file > if($fp=fopen($file, "r+")) > { > while($line=trim(fgets($fp))) > { > // Do the business >} > > } > > Surely this is not the way to work with e.g. a 280MB file. I solved the > sollution by chopping the file into 7MB files, and adding a fileopen > loop around the script above which solves my problem. But -> > How do I parse the 280MB file all in 1 go? > > I have plenty of timeout and plenty of RAM in the php.ini file, so the > problem isnt here. > > -- > Kim Steinhaug > --- > There are 10 types of people when it comes to binary numbers: > those who understand them, and those who don't. > --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Opening large file problem - fopen
I found out that what the script accually does is choke on "\n\n", empty lines. I havnt found a way to solve this with the script, What I do now is use TextPad and just replace all occurencies of "\n\n" with "\n-\n" or something and it works all nice. But this is a bad way of doing it, since the script still doesnt accually work... -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. ------- "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I found that the script accually breaks on this line : > > [Mon Jul 14 12:17:26 2003] [error] PHP Notice: INSERT INTO tbl_news > (band_id, date, heading,heading_eng, ingress,ingress_eng, body,body_eng) > VALUES (-1,"2003-07-14","TESTAMENT endelig til Norge!!!", "Spiller p Rock > in - spesial treat for the fans!", "", "", "Testament + support spiller pe > Rock In onsdag 30.juli. Grunnet opptatte strre spillesteder ensket Testament > likevel gj/re Norge, med en kveld dedikert til fansen som har mttet vente > pt Norgesbesket i su mange r.. > Rock In blir garantert utsolgt, sr her er det bare hamstre billett ss fort > s mulig!! > > Billetter pl billettservice/posten > > Bill.pris 250,-+avg. - Drene cpner 19.00","") in > /home/xxx/public_html/admin/news_send.php on line 27 > [Mon Jul 14 12:17:26 2003] [error] PHP Warning: Cannot modify header > information - headers already sent by (output started at > /home/xxx/public_html/admin/news_send.php:2) in > /home/pilotman/public_html/admin/news_send.php on line 34 > > --- > > Hope this helpls. > > -- > Kim Steinhaug > ------- > There are 10 types of people when it comes to binary numbers: > those who understand them, and those who don't. > --- > > > "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hello > > > > Im having real problems working with large files in PHP. At > > the moment Im trying to parse an error_log file, and it works > > like a charm, except that the scipt stopps after parsing around > > 70.000 lines, or around 8MB of data. Im using this : > > > > $file= "error_log"; // 280MB file > > if($fp=fopen($file, "r+")) > > { > > while($line=trim(fgets($fp))) > > { > > // Do the business > >} > > > > } > > > > Surely this is not the way to work with e.g. a 280MB file. I solved the > > sollution by chopping the file into 7MB files, and adding a fileopen > > loop around the script above which solves my problem. But -> > > How do I parse the 280MB file all in 1 go? > > > > I have plenty of timeout and plenty of RAM in the php.ini file, so the > > problem isnt here. > > > > -- > > Kim Steinhaug > > --- > > There are 10 types of people when it comes to binary numbers: > > those who understand them, and those who don't. > > --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opening large file problem - fopen
Hello, Thanks for you reply. The first approach works, I succesfully imported 1.903.541 entries into my mySQL database, phew! Problem was that as mentioned I had to "massage" the data beforehand, which with TextPad didnt take to much time but again I love my scripts to be complete and be "standalone". Back to the 2) option, I tried another approach, just to see how far the script woul accually go. There are ~2,1 million lines in the error_log so I would like to see a result for the $i in this range. But this script also chokes. $file= "error_log"; $handle = fopen ($file, "rb"); $contents = ""; do { $data = fread($handle, 8192); if (strlen($data) == 0) { break; } $contents = $data; $temp = explode("\n",$contents); $i = $i + count($temp); if($i%1000==0) // Spit out every 1000 lines count echo $i . ""; } while(true); fclose ($handle); echo $count; exit; Do you have an example, or link to a site discussing the issue, of buffering the data? -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Eugene Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, Dec 16, 2003 at 01:30:14PM +0100, Kim Steinhaug wrote: > : > : I found out that what the script accually does is choke on "\n\n", > : empty lines. I havnt found a way to solve this with the script, > : > : What I do now is use TextPad and just replace all occurencies > : of "\n\n" with "\n-\n" or something and it works all nice. But this > : is a bad way of doing it, since the script still doesnt accually work... > > You have two options: > > 1) massage your data beforehand so that your script works properly > > 2) buffer your input lines so that you process them only after you have > read a complete "entry", since one entry may span multiple lines in your > error_log. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opening large file problem - fopen
Attached is a little textfile on 4 lines, it will choke afte 1 line due to the "\n\n" problem. I use this loop to parse it : $file= "error_log.txt"; if($fp=fopen($file, "r+")) { while($line=trim(fgets($fp))) { echo $line . ""; } } -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. ------- "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > Thanks for you reply. The first approach works, I succesfully > imported 1.903.541 entries into my mySQL database, phew! > Problem was that as mentioned I had to "massage" the data > beforehand, which with TextPad didnt take to much time but > again I love my scripts to be complete and be "standalone". > > Back to the 2) option, I tried another approach, just to see > how far the script woul accually go. There are ~2,1 million lines > in the error_log so I would like to see a result for the $i in this > range. But this script also chokes. > > $file= "error_log"; > $handle = fopen ($file, "rb"); > $contents = ""; > do { >$data = fread($handle, 8192); >if (strlen($data) == 0) { >break; >} >$contents = $data; > $temp = explode("\n",$contents); > $i = $i + count($temp); > if($i%1000==0) // Spit out every 1000 lines count > echo $i . ""; > } while(true); > fclose ($handle); > echo $count; > exit; > > Do you have an example, or link to a site discussing the issue, of > buffering the data? > > -- > Kim Steinhaug > --- > There are 10 types of people when it comes to binary numbers: > those who understand them, and those who don't. > --- > > > "Eugene Lee" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On Tue, Dec 16, 2003 at 01:30:14PM +0100, Kim Steinhaug wrote: > > : > > : I found out that what the script accually does is choke on "\n\n", > > : empty lines. I havnt found a way to solve this with the script, > > : > > : What I do now is use TextPad and just replace all occurencies > > : of "\n\n" with "\n-\n" or something and it works all nice. But this > > : is a bad way of doing it, since the script still doesnt accually work... > > > > You have two options: > > > > 1) massage your data beforehand so that your script works properly > > > > 2) buffer your input lines so that you process them only after you have > > read a complete "entry", since one entry may span multiple lines in your > > error_log. begin 666 error_log.txt M6U-U;B!*=6P@(#8@,34Z,3"D@;6]D7V)W;&EM:71E9"\Q+C @;6]D7VQO9U]B>71E#H@"]P=6)L:6-?:'1M;"]%;6%I;$-A;7!A:6=N+TQA>6]U=%\P M,2YJ<&<-"[EMAIL PROTECTED](" V(#$U.C(P.C4Y(#(P,#-=(%ME"]P=6)L:6-?:'1M;"\T,#0N"]P=6)L:6-? M:'1M;"]%;6%I;$-A;7!A:6=N+TQA>6]U=%\P,BYJ<&<-"[EMAIL PROTECTED](" V M(#$U.C(P.C4Y(#(P,#-=(%ME"]P=6)L:6-? M:'1M;"\T,#0N"]P=6)L:6-?:'1M;"]%;6%I;$-A;7!A:6=N [EMAIL PROTECTED]@N:G!G#0I;4W5N($IU;" @-B Q-3HR,#HU.2 R,# S72!;97)R;W)= M(%MC;&EE;G0@,3DT+C(S,"XR-#4N,3(T72!&:6QE(&1O97,@;F]T(&5X:7-T M.B O:&]M92]P<[EMAIL PROTECTED]<'5B;&EC7VAT;6PO-# T+G-H=&UL#0I;4W5N($IU M;" @-B Q-3HR,#HU.2 R,# S72!;97)R;W)=(%MC;&EE;G0@,3DT+C(S,"XR M-#4N,3(T72!0"]P=6)L:6-?:'1M;"\U,# N"]P M=6)L:6-?:'1M;"]%;6%I;$-A;7!A:6=N+TQA>6]U=%\P-"YJ<&<-"EM3=6X@ M2G5L(" V(#$U.C(P.C4Y(#(P,#-=(%ME"]P M=6)L:6-?:'1M;"\T,#0N7)E M7V)L;VMK7S$N9VEF#0I;4W5N($IU;" @-B Q-3HR-#HQ," R,# S72!;97)R M;W)=(%MC;&EE;G0@,3,P+C8W+C4X+C([EMAIL PROTECTED];V5S(&YO="!E>&ES [EMAIL PROTECTED];64O9F5R:65M86"]P=6)L:6-?:'1M;"]I;6%G97,O=F]T95]I;6%G93$N9VEF#0I;4W5N($IU M;" @-B Q-3HR.#HU,R R,# S72!;97)R;W)=(%MC;&EE;G0@,C Y+C(S-RXR M,[EMAIL PROTECTED],38Q72!&:6QE(&1O97,@;F]T(&5X:7-T.B O:&]M92]A=7-T969J;R]P M=6)L:6-?:'1M;"]R;V)O=',N='AT#0I;4W5N($IU;" @-B Q-3HR.#HU,R R M,# S72!;97)R;W)=(%MC;&EE;G0@,C Y+C(S-RXR,[EMAIL PROTECTED],38Q72!&:6QE(&1O M97,@;F]T(&5X:7-T.B O:&]M92]A=7-T969J;R]P=6)L:6-?:'1M;"\T,#0N M&[EMAIL PROTECTED] M;64O9F5R:65M86&[EMAIL PROTECTED];64O9F5R:65M86&[EMAIL PROTECTED];64O9F5R:65M8
[PHP] racing NO domain names problems! (For nordmenn!)
To solve this problem you need a norwegian keyboard so I might aswell type the whole question in norwegian, sorry gyez! --- Jeg har støtt på noen problemer når det gjelder å konvertere domenenavn mot Norids egen ACE konverter. Jeg har prøvd med både POST metoder og GET metoder men resultatet blir uansett det samme. Jeg sender en henvendelse til Norids side, og ønsker å parse resultatet, problemet er bare at Norids side nekter å godta selve bokstavene æøå av en eller annen grunn. En metode er eks. http://www.norid.no/domenenavnbaser/ace/?action=Convert&name=blåbær.no'; $fd=fopen($page,"r"); while ($line=fgets($fd,1000)) { echo $line; } fclose ($fd); ?> Som du ser på det som kommer ut godtaes ikke ÆØÅ. Jeg har prøvd å sende "blåbær" som "bl%E5b%E6r.no" men samme problem. Jeg tenkte kanskje det er en begrensning med GET eller at de har lagt inn en sperre på GET for å bare bruke POST, men den gang ei. POST med sockets gir samme resultat, uanhengig om man benytter "å" eller "%E5". Blir POST data kodet annerledes en GET data, altså "å"=>"%E5"? -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] racing NO domain names problems! (For nordmenn!)
Finally! The answer was this : $url = utf8_encode('http://www.norid.no/domenenavnbaser/ace/?action=Convert&name=bl åbær.no'); And it all finally works, :) -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Stig Venaas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, Dec 16, 2003 at 07:30:09PM +0100, Kim Steinhaug wrote: > > To solve this problem you need a norwegian keyboard so I > > Nah, you can just cut and paste (: > > > might aswell type the whole question in norwegian, sorry gyez! > > > > --- > > > > Jeg har støtt på noen problemer når det gjelder å konvertere > > domenenavn mot Norids egen ACE konverter. Jeg har prøvd > > med både POST metoder og GET metoder men resultatet blir > > uansett det samme. > > > > Jeg sender en henvendelse til Norids side, og ønsker å parse > > resultatet, problemet er bare at Norids side nekter å godta selve > > bokstavene æøå av en eller annen grunn. En metode er eks. > > > > > $page > > ='http://www.norid.no/domenenavnbaser/ace/?action=Convert&name=blåbær.no'; > > $fd=fopen($page,"r"); > > while ($line=fgets($fd,1000)) { > > echo $line; } fclose ($fd); > > ?> > > > > Som du ser på det som kommer ut godtaes ikke ÆØÅ. > > > > Jeg har prøvd å sende "blåbær" som "bl%E5b%E6r.no" men samme problem. > > Jeg tenkte kanskje det er en begrensning med GET eller at de har lagt inn en > > sperre på GET for å bare bruke POST, men den gang ei. POST med sockets > > gir samme resultat, uanhengig om man benytter "å" eller "%E5". > > Blir POST data kodet annerledes en GET data, altså "å"=>"%E5"? > > In the document with the form, it says: > > enctype="application/x-www-form-urlencoded"> > > so I guess it will work if you use this encoding. But the document is > also in UTF-8, so you may have to do UTF-8 encoding first and then URL > encode that perhaps. > > It works with e.g. mozilla, I guess you could also try to see what > exactly it sends. > > Someone non-Norwegian might have suggestions regardig UTF-8 documents > and URL-encoding. I think browser sends post data with same charset > as the main document... > > Stig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sql query and some math
Your first query, could it be that you dont have any reference between the two tables? You should have a link between them, like where t1.id=t2id Or else you do not have any reasonable way of predicting the outcome of the query. Atleast this is what I know from my own experience. Especially if t2 has more entries for each entry in t1, your query will result in unpredictable manner. Hope this helps. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Patrik Fomin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > q1) > i got a database with 2 diffrent tables, > i want to take out all the information that arent duplicated from > on of the tables, like this: > > $sql = "SELECT t1.rubrik, t1.info, t2.priser FROM table1 AS t1, table2 AS t2 > WHERE t1.arkiv = '0' ORDER BY t1.rubrik"; > > the problem is that i got alot of duplicates (its for another purpose), so i > need to filter out the duplicates in the rubrik field to get just one match > each, like: > > id - rubrik - info > > 0 - - some info > 1 - - some info > 2 - - some info > 3 - - some info > 4 - - some info > > would print out > 0 - - some info > 1 - - some info > 2 - - some info > 3 - - some info > > > q2) > i got like 100 matches from a database into a $num variable, > then i want to devide that by 3 aslong as it can be done, eg: > > while ($num != 0) { > > ïf ($num / 3 = true){ > some code to display some fields from a database > > $num = $num - 3; > } > else { > some other code to display > $num = 0; > } > } > > basicly i want the if statement to check if its more then 3 posts left to > print out, if not its gonna print out the remaining last 1 - 2 post in a > diffrent way (for the looks) > > > regards > patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I protect downloadable files?
I would go for the 3rd alternative. There are several ways to "stream" the file with the use of headers. This way you can validate the user securely with your logon system, and you can place the files outside the viewable web content. Typically oputside your www / public_html folder. I use this myself in an application I use, streaming files at 50MB does not use alot of resources at all, atleast not the way I use. My use for the script is to serve high resolution images to several customers, often TIF images up to 50MB and larger. Heres the code I use : $distribution= "filepathonserver"; if ($fd = fopen ($distribution, "r")){ $size=filesize($distribution); $fname = basename ($distribution); header("Pragma: "); header("Cache-Control: "); header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"".$fname."\""); header("Content-length: $size"); while(!feof($fd)) { $buffer = fread($fd, 2048); print $buffer; } fclose ($fd); exit; } -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Apz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, 30 Dec 2003, news.php.net wrote: > > Creating unique symlinks would be easier but my development machine is > > Windows and my server is FreeBSD and I can't create file links under > > Windows. Plus, my FreeBSD server is not near me so remote development is > > difficult. > > 1) windows has symlinks since win2000, however they are named Junctions. >I would recommend visiting sysinternals.com and getting junctions >tool (win2k/xp/2k3 -> miscalenous). Hey, it even comes with source! > > 2) another way is to make a redirect, so you do: >getFile.php?file=something.zip > >and in your code you do: > include "_mylibs.php" > if (userLoggedIn()) > header "Location: ".$_REQUEST["file"]; > else > echo "Only Valid People Can Login"; >?> > > 3) final way is to pass through the file yourself. Safest way, but >potentially more resource hungry than the two above >in your code you do: > > > include "_mylibs.php" > if (userLoggedIn()) > { > header("Content-type: application/octet-stream"); > header("Content-Disposition: attachment; ". >"filename=".$_REQUEST["file"]); > readfile($_REQUEST["file"]); > } > else > echo "Only Valid People Can Login"; >?> > > > > recommended reads: > http://www.php.net/manual/en/function.header.php > > further recommended things to checkout: > freshmeat , and search for anti leecher scripts. > > > > /apz, bringing joy to the world -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I protect downloadable files?
However I forgot to mention, all theese header tricks are real swell indeed, but you should get hold of a friend on a macintosh. The method I use doesnt work on the macintosh, so for the mac users we just serve the files "as is", meaning they accually dont get protected... The other methods aswell should be tested on macintosh systems just to be sure. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. ------- "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would go for the 3rd alternative. There are several ways to > "stream" the file with the use of headers. > > This way you can validate the user securely with your logon system, > and you can place the files outside the viewable web content. > Typically oputside your www / public_html folder. > > I use this myself in an application I use, streaming files at 50MB > does not use alot of resources at all, atleast not the way I use. > My use for the script is to serve high resolution images to several > customers, often TIF images up to 50MB and larger. > > Heres the code I use : > > $distribution= "filepathonserver"; > if ($fd = fopen ($distribution, "r")){ > $size=filesize($distribution); > $fname = basename ($distribution); > > header("Pragma: "); > header("Cache-Control: "); > header("Content-type: application/octet-stream"); > header("Content-Disposition: attachment; filename=\"".$fname."\""); > header("Content-length: $size"); > > while(!feof($fd)) { > $buffer = fread($fd, 2048); > print $buffer; > } > fclose ($fd); > exit; > } > > -- > Kim Steinhaug > --- > There are 10 types of people when it comes to binary numbers: > those who understand them, and those who don't. > --- > > > "Apz" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On Tue, 30 Dec 2003, news.php.net wrote: > > > Creating unique symlinks would be easier but my development machine is > > > Windows and my server is FreeBSD and I can't create file links under > > > Windows. Plus, my FreeBSD server is not near me so remote development > is > > > difficult. > > > > 1) windows has symlinks since win2000, however they are named Junctions. > >I would recommend visiting sysinternals.com and getting junctions > >tool (win2k/xp/2k3 -> miscalenous). Hey, it even comes with source! > > > > 2) another way is to make a redirect, so you do: > >getFile.php?file=something.zip > > > >and in your code you do: > > > include "_mylibs.php" > > if (userLoggedIn()) > > header "Location: ".$_REQUEST["file"]; > > else > > echo "Only Valid People Can Login"; > >?> > > > > 3) final way is to pass through the file yourself. Safest way, but > >potentially more resource hungry than the two above > >in your code you do: > > > > > > > include "_mylibs.php" > > if (userLoggedIn()) > > { > > header("Content-type: application/octet-stream"); > > header("Content-Disposition: attachment; ". > >"filename=".$_REQUEST["file"]); > > readfile($_REQUEST["file"]); > > } > > else > > echo "Only Valid People Can Login"; > >?> > > > > > > > > recommended reads: > > http://www.php.net/manual/en/function.header.php > > > > further recommended things to checkout: > > freshmeat , and search for anti leecher scripts. > > > > > > > > /apz, bringing joy to the world -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Selecting between using letters
Im on my way to bed so short do it yourself answer, but you should look up the regex part of mySQL. I think you can match the beginning and end of a coloumns entry. And using the power of the regex function you could make a WHERE statement for somethink like [a-e] if it was a-e you were looking for. Remember ofcourse that you wuld need to use the regex syntax. The page on mySQL covering the topic has a lot of examples. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Doug Parker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How would I create a select statement in MySQL that would return a range of > records from the LastName field where the value starts with a designated > letter - for example, returning the range where the first letter of LastName > is between A and E... > > Any help would be greatly appreciated. > > > > > http://www.phreshdesign.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: JavaScript Enabled?
Indeed an old thread this one, but I still would like to know if someone have some input on some ways of solving this dilemma. Surely it is easy to detect javascript when its enabled, but what to do when it's not enabled is a much more interesting approach. I have several systems online which (maby from old habits) heavily depends on javascript functionality. Surely I could easily remove all javascript and do all processing and validation serverside, but in my honest opinion I see no practical reason to ignor javascript in any application. The benefits of using java is far greater than the problems. SOLLUTION 1 - DETECTING THE CLIENT I would think that if we set a meta refresh to the noscript.htm and an onload javascript to switch to script.htm we could from theese pages set some session variables if the user has script or not. However this redirecting of pages is kinda silly I think, and I would like to think that there are other ways of doing this? Let us not forget that search engines would just love this sollution on our frontpage... Surely we could add this code and refresh the same page with ?jave=false or ?java=true, but for some reason I dont like this sollution. Meta refresh is bad. ALTERNATIVE SOLLUTION - POSSIBLE? Hoping someone has already solved this Im throwing some thoughts here. Since I use the session variable on all my pages, I could also create a fake gif spacer from a php script (eg. spacer.gif.php, which eventually spits out the gif but lets me do some stuff meanwhile at first). This gif could be called from javascript document write. A 1x1 spacer, which if I call this gif would mean that javascript would work, and if this script is triggered I could update the session with eg. script=true; Which would make me know if the user has it enabled or not? Atleast this sounds logical in my head, aslong as I dont need to alert the user at once if hes got enabled java or not. This approach would mean that I can alert the user with whatever HTML code from PHP I would want after eg. 3 pageviews, since he would surely have the triggered the dopcument.write by then. (Ofcourse if he has deactivated images aswell we have problems but hey... ) Alot of nothing here really, but maby someone have some thoughts on the matter. -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - "Richard Davey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > Can anyone suggest a suitable means for detecting if a client browser > has JavaScript enabled or not? > > I know this isn't exactly PHP related, but I need to make sure my PHP > script offers an alternative in a friendly way and not a JS error, but > I just wondered if there was a foolproof method of doing this? > > -- > Best regards, > Richard Davey > http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP logic - Whats going on here?
Ive stumbled onto a rather strange problem, atleast I cant see why this is happening. Im using phpMailer to send mails, and I have the following straight forward code : $mail = new phpmailer(); $mail->IsSendmail(); $mail->From = '[EMAIL PROTECTED]'; $mail->FromName = 'From Name'; $mail->AddAddress('[EMAIL PROTECTED]'); $mail->Subject = $header; $mail->Body = $body; Then to send the mail we use this : if(!$mail->Send()) { echo $lang_error['mailer_error'] . "\n"; } As you see above, Ive dropped the "what if all goes well" loop, since I believe that the $mail->Send() is initiaded in the first statement For some reason the above results in a blank mail, no $body at all, rest is fine. However, if I include a dummy for if all goes well : if(!$mail->Send()) { echo $lang_error['mailer_error'] . "\n"; } else { // Why do I need this one??? } What I dont understand is why do I need the last else statement? Isnt the result of $mail->Send() completed if I only check for !$mail->Send()? Maby it would be better to write like this : if(!$mail->Send()) { echo $lang_error['mailer_error'] . "\n"; } else if ($mail->Send()){ // Why do I need this one??? } The above would in my belief send two mails, atleast my logic tells me that. The strange part is that when looking at examples from phpmailer.sourceforge.net they use my initial loop aswell, not the "Why do I need this one???" part. Im beginning to wonder if there are something mystical going on with either my code or our servers. ?? Hope someone understand what Im wondering about here, hehe. -- -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP logic - Whats going on here?
Thanks for your reply, it all seems logical when you think of it, still I also think it sounds logical without the extra ELSE statement since the function has to executed for the first IF to do the comparison, meaning that the email should be sendt in the first place. (If it didnt how could it state FALSE or TRUE, unless PHP only simulates the function if it falls outside the initial IF statement) However, no reason to argue the obvious, :D On the other hand, this would also mean that the exmaples from phpmailers homepage are wrong : [ SNIP FROM http://phpmailer.sourceforge.net/extending.html ] $mail->Body= $body; $mail->AltBody = $text_body; $mail->AddAddress($row["email"], $row["full_name"]); $mail->AddStringAttachment($row["photo"], "YourPhoto.jpg"); if(!$mail->Send()) echo "There has been a mail error sending to " . $row["email"] . ""; [ /SNIP] This is probably why I in the first place removed the extra ELSE statement, since I didnt see any reason for it. But in future Ill always include it it seems, :D -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: dropdown box displays empty rule
Well, seems you have some confusing logic here, since you print out the option before you check if it should be checked. To top it off, when its accually checked you write out an empty value, which really doesnt make any sence at all. A quick rewite would be : while($rowu=mysql_fetch_object($result1)){ if ($selected==$rowu->naamreis) echo "naamreis\">" . $rowu->naamreis . "\n" ; else echo "naamreis\">" . $rowu->naamreis . "\n" ; } -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no - www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using Post like Get
Since you are on the same server, I hope you mean the same domain. If not the session variable wouldnt work very well. But if you infact are on the same domain, you should look into the session variable and store everything you need. From what I know there are now limits on how much you can store in a session, that said I wouldt pump several megabytes into it... Several good answers here, but it looks like most of us agree on the session. Cookies can ofcourse also be used, but this also means that you require all your clients to have them enabled. Anyways, even when using cookies I always use session as the main system - cookies only works as a "saved session" in my systems. (Meaning, instead of having to logg onto the system again, the username and passowrd are stored in a cookie, this way the user can choose the famous "remember me" setting many of us enjoy). -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - "Dennis Gearon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What I'm trying to achieve is to have the same cookie IDENTIFY a user on > different (or same) applications (on the same server), but require them > to log in for each application, and get a different session.. Basically, > to keep separate 'user trails and in process variables' for different > tabs or windows in a browser. > > www.scotttrade.com does it somehow, and I see no GET variables on the URL. > > John W. Holmes wrote: > > > Dennis Gearon wrote: > > > >> With get varaibles, it's possible to always have get variables on a > >> page, even without a form, by simply appending the Get variables to > >> the end of the URL. > >> > >> Is there anyway to do the same with Post variables? For instance, a > >> javascript that onUnload submit, or something? > > > > > > You can't just include POST variables in a link, if that's what you're > > going for. Perhaps some clunky javascript submitting a hidden form on > > an onclick method would get you close, but why even bother? > > > > Maybe you should just say what you're actually trying to achieve and > > why, then we could offer better alternatives. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String compare of 7 text strings
* Ed Lazor wrote : > Nice solution =) My thoughts exatly, :D -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Upload problems
Just a quick question, Did you alter the upload_max_filesize to 500MB and the post_max_size to say 510MB and you succesfully upload 500MB files from one machine to the server? I never testes with filesizes that large, but It would be nice to hear if it accually works without tweaking to much. I would also think that the general 30sec timout would need to be altered as moving a 500MB file from /var/ to the users homedirectory and then do some filechecking on it and such would easilly need some extra seconds. Not to think of the overhead if many people upload large files at a time. Ok, its a vague post this, just looking for some input here, :D Its like the needle and the haystack, dont know what im exatcly looking for here, but you never know. I work with large files myself on some systems, and its always nice to get feedback whatever it is from other people working with the same stuff. -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] matching system - anyone seen any?
I wonder if anyone have come across a script/system that already has this feature, else I would need to do it all over again. The scenario is this : I want people to select the movies they have seen and rate them 1/10. Movies not available in the "polling" system they can add, and rate them. This way the database is constantly growing, and ratings are constantly added. You can rate as many films you want, or noen if you like. Then, after you have rated you can "match" your ratings to find other people that match your selections. More like matching a profile really. There would be some sort of system inside here which could build a form of profile based on your ratings, and then compare theese profiles. I havnt really started planning how this would work, or should work, but first mainly if anyone has seen such a system around. Looking for existing wheels... :D -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Read file backwards
Anyone have a script that reads a file backwards? Im looking for a way to trace a log file, say the last 30 lines each time I run the script. I havnt found any DOS tools so I guess doing it in PHP will be just as fine, and Im on a Win32 platform. I could however read the entire file, and count the files and show the last lines, but this wouldnt really read it backwards and would work very "foolishly" on large files I would think. If there isnt a way of doing this Ill have to do the above, but you never know. Ill google in the meantime. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Read file backwards
Got a tip by email, Might look here and modify it if needed ... http://tailforwin32.sourceforge.net/ Thanks, this is atleast much better than switching windows and refershing the files in Textpad which I do at the moment. tail was ofcourse the word I was looking for, not the trace word. Thanks for the tip, Kim Steinhaug "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Anyone have a script that reads a file backwards? Im looking for > a way to trace a log file, say the last 30 lines each time I run the script. > I havnt found any DOS tools so I guess doing it in PHP will be just as > fine, and Im on a Win32 platform. > > I could however read the entire file, and count the files and show the > last lines, but this wouldnt really read it backwards and would work > very "foolishly" on large files I would think. > > If there isnt a way of doing this Ill have to do the above, but you never > know. Ill google in the meantime. > > -- > -- > Kim Steinhaug > -- > There are 10 types of people when it comes to binary numbers: > those who understand them, and those who don't. > -- > www.steinhaug.com - www.easywebshop.no - www.webkitpro.com > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: function for backing up mysql
Take a look at phpclasses.org Last week there also came another class especially made for backups aswell if I recall. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Victor spång arthursson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi! Wonder if anyone knows if there somewhere "out there" are any good functions that streams out data from mysql as a sql-file, like phpmyadmin does? The best would be one which I told which database and which tables to dump, and which directly stared streaming the data Sincerely Victor= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Rporting tool - CVS?
Scenario : Im working on several large projects, all which have several users. Each user has a personal innstallation. Each of my projects are in constant development, and often the updates from version to version are only in a few files. Is there a tool out there who can compare two folders, and generate a report on what files are new, removed and updated? Usually I just upload all the project files all over, since all settings are in the database or settings file. But when projects have over 500 files, and you have 50 customers it would be nice to just upload the files which are updated. I have a feeling CVS would maby be the trick here, but im not sure. Still I could manually do this, it isnt that hard, but you know - maby there already is such a system out there and in that case it would fit me perfectly. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Reversing a string?
Hehe, managed to do it on first try. This should do it : 1){ $reversed = ""; for($i=0;$i<$length;$i++){ $reversed .= substr($string,$length-$i,1); echo substr($string,$length-$i,1) . ""; } $reversed .= substr($string,0,1); echo substr($string,0,1) . ""; echo $reversed; } else echo $string; ?> I added some errochecking if the string is only 1 character, since there should be no use in running the for loop then. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Kristian Rasmussen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > I need a script for reversing a string ("hello world" becomes "dlrow > olleh"). I have tried the following: > > --- > $length = strlen($i); > $g = ""; > > while ($length > 0) > { >$g = $i[$length] . $g; > $length--; > } > echo $g; > --- > > With, obviously, no success. Is this the way or could array_reverse() > somehow be used? > > Kristian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reversing a string?
hehe, Reading the manual is somewhat not so bad after all... -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Robert Cummings" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 2004-05-13 at 17:27, Kristian Rasmussen wrote: > > Hi all, > > > > I need a script for reversing a string ("hello world" becomes "dlrow > > olleh"). I have tried the following: > > > > --- > > $length = strlen($i); > > $g = ""; > > > > while ($length > 0) > > { > >$g = $i[$length] . $g; > > $length--; > > } > > echo $g; > > The following will work: > > $length = strlen( $i ); > $g = ""; > > while( $length > 0 ) > { > $g .= $i{--$length}; > } > echo $g; > > But in all honesty the following is superior: > > $g = strrev( $i ); > echo $g; > > Cheers, > Rob. > -- > .. > | InterJinn Application Framework - http://www.interjinn.com | > :: > | An application and templating framework for PHP. Boasting | > | a powerful, scalable system for accessing system services | > | such as forms, properties, sessions, and caches. InterJinn | > | also provides an extremely flexible architecture for | > | creating re-usable components quickly and easily. | > `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP graphing tool?
You will find a couple on phpclasses.org, also a few on sourceforge.net Some googling and youll find a few more. Ive been down the same road, finally youll see that accually there are no free ones usable for your project (atleast I had a real hard time finding some). There are some really great flash graphs out there, and the last year the pricing has dropped to a reasonable one aswell so you might aswell look at the comercial sollutions out there, they have become real good. Well, thats one day worth of work summed up for you in one handy little reply, :) -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Amanda Hemmerich" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there a PHP tool or module out there that would be good for creating > line or bar graphs? I'm looking for something I can pass numbers to and > it will just graph those numbers. > > Any recommendations? > > Thanks! > Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Resequencing logic
Well, this is much the same as any CMS system where you are able to sort the contents by your own, in your case song titles. One way to solve this is by using form fields together with your listings so that you have some sort of link to the posts in your database. You also need a field in the database that keeps track of the sort. You also need abit of javascript. EG. ID, SONG TITLE, SORTER Lets have some data, 1, Limbo, 5 2, Bimbo, 6 3, Cimba, 1 This will be presented : Cimba (1) Limbo (5) Bimbo (6) When you print out the HTML I would include some hidden form fields for each item so that I know what to sort / move up / down. Eg. hidden name="data[item][$i]" value="ID"/ Cimba (hidden ID=3) hidden name="data[item][$i]" value="ID"/ Limbo (hidden ID=1) hidden name="data[item][$i]" value="ID"/ Bimbo (hidden ID=2) Each line would need some sort of javascript command, like javascript="moveup($i)" Assign this moveup() variable to anything, eg. hidden name=check value="**" so we can access it from PHP. Your javascript will then submit the form with ALL variables mentioned above. So do we now know? 1. We have a complete array of all the records from the HTML page in $_POST["data"]["item"] 2. We also know what database ID each item has with the twin array $_POST["data"]["id"] If we were to move something up, now we have a way of doing so, since : Say you entered moveup(2), which the javascript assigned the "2" to a variable "check" which we now know as $_POST["check"]. Moving 2 (Which is 3 since we start counting from 0) we know that 2 is supposed to switch places with 1, meaning the SORTER will be switched. so we know the following : $data = $_POST["item"]; $sourceID = $data["item"][$_POST["check"]]; $destinationID = $data["item"][$_POST["check"]-1]; The rest would be to do the SQL queries for the SORTER field, A=C, B=A, C=B meaning : tempA = select sorter from blabla wher id = source tempB = select sorter from blabla wher id = destination update blabla set sorter=destination where id = source update blabla set sorter=source where id = destination This was all abit quick'n'dirty as I call it, but I hope you got the general idea on how to do it. You need ofcourse alot more debugging and such for the final code (Like you cand moveUP the first row, since that would make the array go from 0 to -1 which doesnt make sence). -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Matt Grimm" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I apologize if this message is a repeat; I've had trouble posting with > Thunderbird. > > I'm interested in how you folks would approach the following issue: > > You have a list of data, in a user-defined sequence. For instance, a list > of song titles that can be rearranged on a web page in any order. I don't > think I have the best grasp of the logic involved, and as such, the problem > is a real pain for me. I use this approach: > > -If adding, records after or equal to the new (requested) spot are > incremented > -If moving up, records before the current spot and after or equal to the > new spot are incremented > -If moving down, records after the current spot and before or equal to the > new spot are decremented > -If deleting, records after or equal to the current spot are decremented > > Is there some MySQL or PHP function that will handle this sort of > reordering business, or is there possibly a simpler logic I could use? > > Thanks, > Matt > [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: form submission logic
Well, I would include another hidden field and name it something like "ACTION". I would also include a checkbox on every item you want to do something with like this : Then use javascript on your actions to set the action to whatever mode you need, for example "delete". On the PHP side you get a very nice workflow now, as you will recieve an array on all the items which are selected and you can perform multiple tasks at once. Example, publish n articles in one go, or delete all at once. Remember to valiudate the $_POST["item"] as an array! Remember, all the values in this array will be the onces you should $_POST["action"]. Have fun! -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Aaron Wolski" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > Was wondering if someone had any idea's on this logic and if it'd work, > before I tried to implement it: > > Within the tags I have my buttons - Publish, Unpublish, > New, Edit and Delete. > > Next I have a table of that displays a list of records from a database > with a checkbox to select a particular record. > > Once a record has been "selected" they click one of the top buttons to > perform their desired action. > > WILL this work OR do the buttons HAVE to go at the bottom? > > Thanks! Any help is appreciated. > > Regards, > > Aaron > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Website Architecture
Well if you really want to do it the perfect way, I would recommend using only one PHP file to generate the whole site. Or if you like, have one file with all the functions. You should also read into classess and create most of the functions as classess. To do the error handling there are many ways to go, but the best way would be to use output buffering. If an error occurs you can store the entire buffer if you like into a database and present an entire different page to the user informing that samoething went wrong. The old alternative is to present a "50/50" page with some error handling here and there. Its really all up to you, there isnt a perfect way in doing this. But my advice again, use classess (OOP) as its very reusable and look at output buffering for total control. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Paul Higgins" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > I have a question regarding website design with PHP. Is it better to have a > single PHP script produce different content or have a separate PHP script > for every action. > > For example, if an error occurs, should I have the same PHP script produce > an error page or have a separate PHP script produce the error page. > > I'm asking in reference to performance. > > Thanks! > > _ > Is your PC infected? Get a FREE online computer virus scan from McAfee® > Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Installing GD library
put the DLL file in your PHP DLL file directory, uncomment the line in php.ini referring to it. Restart apache if running, IIS doesnt need to be restarted. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Phpu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I've downloaded the GD library. Can someone tell me how do i install it on a windows system? I found in internet a few articles but i don't quite understand. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: auto saving data in forms
Well shouldnt be a problem. Hook up an iframe on your page, use a javascript timer to send all data to the iframe every n seconds and submit the form inside the iframe. This will give the user a perfect workflow in the window he is working in, since the refreshing and such is done inside the iframe (which can be hidden), Sure you could use javaapplets and such, but there really shouldnt be any need for it. Surely such an autosave function shoudl use a temp database /table to store the data, just as word uses temp files for autosaves. Have fun! -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > i'm currently designing a website in which i have some forms with data saved in > database. > > My customer wants that when he add or modify some datas in these forms, changes > will be made immediately in database. I really don't know how to do it and don't > know if it is possible. > > Is there anyone who have fijnd a solution to solve that problem and who can help > me. I accept solutions in other langages than PHP like JAVA + XML. > > thanks, > > Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: form submission logic
I dont agree however, if your creating a system which should be user friendly I would absolutely demand from my users to have JS enabled. If they dont have JS enabled, then -> well, to bad for them... We have created several web applications and have alot of customers (B2B), and they have all JS enabled. The friendslyness and functionality you can do with JS makes the total experience far better than not using JS. And you alse can save alot of reloading of the pages with confirmation dialogs and such. Anyway, its all a matter of opinion. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Torsten Roehr" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Well, > > > > I would include another hidden field and name it something like "ACTION". > > I would also include a checkbox on every item you want to do something > with > > like this : > > > > > > > > Then use javascript on your actions to set the action to whatever mode you > > need, for example "delete". On the PHP side you get a very nice workflow > now, as > > you will recieve an array on all the items which are selected and you can > > perform multiple tasks at once. Example, publish n articles in one go, or > delete all > > at once. > > I would not recommend using Javascript here because then you are reliant on > the client having JS enabled. Just use different names for your submit > buttons and then check them: > > if (isset($_POST['new'])) { > ... > } elseif (isset($_POST['delete'])) { > ... > } > > ...and so on > > Regards, Torsten > > > > > Remember to valiudate the $_POST["item"] as an array! Remember, all the > > values > > in this array will be the onces you should $_POST["action"]. > > > > Have fun! > > > > -- > > -- > > Kim Steinhaug > > -- > > There are 10 types of people when it comes to binary numbers: > > those who understand them, and those who don't. > > -- > > www.steinhaug.com - www.easywebshop.no - www.webkitpro.com > > -- > > > > "Aaron Wolski" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Hi all, > > > > > > Was wondering if someone had any idea's on this logic and if it'd work, > > > before I tried to implement it: > > > > > > Within the tags I have my buttons - Publish, Unpublish, > > > New, Edit and Delete. > > > > > > Next I have a table of that displays a list of records from a database > > > with a checkbox to select a particular record. > > > > > > Once a record has been "selected" they click one of the top buttons to > > > perform their desired action. > > > > > > WILL this work OR do the buttons HAVE to go at the bottom? > > > > > > Thanks! Any help is appreciated. > > > > > > Regards, > > > > > > Aaron > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] page_title
Is it me or is the sollution here incredible simple? -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "John W. Holmes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Erik Gjertsen wrote: > > > > > > > > > > > > > > > > $page_title = "Welcome"; > > Hmmm... you're title doesn't show up? Are you using sessions? Is > safe_mode on or off? Is html_title_mode on or off in your php.ini file? > > -- > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reversing an IF statement
Often I end up using a "dumb" IF statement which to me seems that it could have been done some other way. Example : if( ($_GET["id"]==1) or ($_GET["mode"]=="home") or ((!isset($_GET["item"])) && ($_GET["mode"]=="news")) ) { // Here we do nothing } else { // This is where we do it } If we translate the above to simpler reading we could say : if(statement) // skip else // Do the stuff I'm ofcourse looking for this if(!statement) // Do the stuff Problem is, when using more statements I never seem to find the way of doing it without having an empty {} in it, dont know if you see my problem here however, its the best I can exmplain. For all I know it has to be like this. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Include from another URL?
You could always use this : $text = ""; $fd=fopen($url,"r"); while ($line=fgets($fd,1000)) { $text.=$line; } fclose ($fd); echo $text; -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Nik" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi there, > I'm new to these groups so forgive me if I'm asking at the wrong place (tell > me where then :) > > Ok, > I'm not PHP guru but I need to create a simple script that would do this: > > Include a content from another URL into the current output. I have done > something like > this: > > -- code start > include 'http://myotherurl.com:8080'; > ?> > -- code end > > and it seems to work with one exception: it produces a warning message > saying something like > "Warning: main(): stream does not support seeking in .../web-root/index.php > on line 9" > where line #9 is: include 'http://myotherurl.com:8080'; from above code. > It then shows a message from 'http://myotherurl.com:8080' > > Thanks!!! > Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: gifs, icons etc
At sourceforge you will find several icon paks available under different licenses. However if your software is proprietary you will have trouble using any of theese (Atleast the ones worth using). I myself have been searching the net for such but ended up doing the work myself. Atleast thats how my story went, :) -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Brent Clark" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all > > I would like to know if any body has a url for free some icons and, or small > pics that can be used in a site \ page > development. > > I was looking at a project call dotproject. > And I noticed a lot of kewl small pics. > > I dont want to infringe on any licenses etc > > Kind Regards > Brent Clark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Carrying Variables
You could ofcourse also use sessions. If you need to store alot of values, this would be the way to go. If its only a couple of short ones, ofcourse some GET variables is the simplest and fastest way to go. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Ronald "The Newbie" Allen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How would I carry a variable from one page to another > > Here is what I mean > > I have a send.php page and this is sent to > insert_into_database.php where the values of the previous page are inserted > into the database. > I then use a meta=refresh to go to another page and evaluate the variable. > The problem is that I do remember how to carry the variable. I believed > that I used the meta before to carry it, but unsure. Any help would be > appreciated! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sessions pls help
Well, What you need to do is start all pages with the session_start(); variable, like this : This would make you ready for handling logins and such further down the page. What you also need to do is two things, 1. Create a login which registers a new session. 2. Create a validation function which validates the logged user on each page. Example, login page : username=$_GET["username"]; $u->password=$_GET["password"]; session_register(u); } ?> The above code would mean that a) You enable the session for the page. b) If the username and passord is valid, you se the sessionobject, in the example "u" to the username and passord. Further you need the page to validate if you have a valid login, a simple way would be to just validate if the u object is something at all, since if you havnt logged in there isnt any value here. Example : // check if user logged in if(!$u->username){ // Not logged in, lets throw a header or something to send the user to login page } The best should be to look up the username from $u->username against your database to be sure that the username infact is valid. Final script page would be : username=$_GET["username"]; $u->password=$_GET["password"]; session_register(u); } // check if user logged in if(!$u->username){ // Not logged in, lets throw a header or something to send the user to login page header("location: login.php"); exit; } // The rest of page comes here ?> This is a brief explernation which should give you what you need to get going on your session handling. You also might want to add more variables into the prosess, like IP, browseragent and such to prevent session hijacking from proxy servers, just to be on the secure side. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Robi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > > I need some info about sessions in php, > to clarify my knowledge and usage. > So lets imagine that > I am building a web site > where I can log in and log off, > it is without db. > How do I use sessions, > am I right use the start_session() > and its a value to PHPSID as > cookie, so if make link to > another page I will check against > phpsesid which is cookie against the id > what I have in link?right? > pls help > troby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session
You could do add an extra value/parameter to your session, "lastactive". Each time you have some activity from the current session you update your database with a timestamp. This way you could easily delete everything from your database which is older that say 30 minutes. Having a session database which grows out of proportions is kinda waste of space. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Mrs" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi > > How can I check if speciffic session is alive having session id? > Or how can I delete data from MySQL belong to dead session? > > (I hope somebody understend what I wrote) > > MrS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Decompressing files via php
There is some ZIP classes on phpclasses.org that work very well, you dont need to install anything on the server aswell as all code is included in the class. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Gerard Samuel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Friday 21 May 2004 04:44 pm, Justin Patrin wrote: > > Gerard Samuel wrote: > > > Looking for libraries that are capable of decompressing files, such as > > > those in zip or tar format. > > > Im aware of PCL(Tar/Zip), and was wondering if there were any others out > > > there. > > > Just want to see whats out there before I settle on one of them. > > > > > > Thanks > > > > http://pear.php.net/package/Archive_Zip > > > > I was aware of Archive_Zip. I thought it was the same as PCLZip, as it was > created by the same author. > But thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: export from mysql to csv file
You are also probably using PHPMyAdmin, if not you should be using this. Exporting to CVS is fairly simple, and if your used to quering the databsae you should be able to do this very easilly yourself if your looking for a sollution you can do from scripts. Basically what you do is simply do a "select * from table", which will give you every coloumn of the database, Thereafter loop through the entire dataset and use the mysql_fetch_array function, then use this : foreach ($temp AS $key=>$value){ // $key = coloumn name // $temp[$key] = coloumn value if(!is_numeric($key)) echo $key . " : " . $temp[$key] . ""; } Where $temp is the $temp = mysql_fetch_array($dataset_from_query); If your into >100.000 entries in the database you will need to do some smart quering, or alter the php.ini to handle more than the standard 30 sec timout. Basically you could also go in "rounds" of limit 0,5 thereafter limit 50000,5 but that wasnt your question. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Dustin Krysak" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Can anyone point me to an existing script or tutorial to learn this? > > Thanks in advance! > > d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Header target?
Steve Douville had a long answer, the short answer : no -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Bob Lockie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is it possible to specify the target frame in a "Header" call? > I have a form that submits in one frame and I want it to redirect to > another frame in some cases. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: array_rand() not random
Hmm... Ive been having same problems with mysql and picking random numbers, I ended up having to program a rather more sofisticated system to eliminate the stats you were referring to. You could, not that it will be any better, try another approach : Something like : $count = count($your_data_array); $random = rand(0, $count); echo $your_data_array[$random]; PHP is maby using the same random function for both the array_rand and rand for all I know but its worth a go. The harder way would be to include an internal counter for your elements you want to be randomized, so that when an item is selected you count it. Then the next time you calculate the random element you take the accual hits into meassure. There are like a 1000 ways to do this so use your imagination. One way could be to use some sessions, and when a user hits the page you precalculate the random sort for all your elements, and store that in the session. Then for each and every visit form that visitor you just go along with the pre-randomed data. This way your user will get a truly randomized experienced, and youll be showing off all the elements even if the random function in itself is abit "non-random". Im sure there also exists a mathematical approach calculating a sort of the elements based on the earlier views (meaning that we count each view). -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Nori Heikkinen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Best Lossless Hi-Res Photo Storage with PHP
well, there are formats that have impressed me. The Mpg-4 format which requires plugins all over the place is really amazing, from e-vue. They also provide a plugin atleast for IE to browse the images. I dont know if you can compress images outside the windows platform however. If your looking for supreme quality however, you would need to stay away from the lossy formats and probably go for TIFF which is a great format and is also supported by any major software. PNG however is abit "strange", woudnt sendt PNG images to a publisher... You could ZIP the TIF images on the HD to same space, you often get good results on this. This would also make the downloads better for the user, and since all the browsing online would use thumbnails you dont need to waste CPU do depack the images, since you all users can depack a ZIP file (thats the least you would expect from a user that purchase a High resolution image). Ive created such systems myself, and my sollution was another : Plug in a new harddrive. We save the images as jpg, tif, eps, ai or whatever the original image was created as, and create thumbnails at various resolutions in high compressed jpg for fast browsing. Often I tend to ZIP the lossless images aswell, but then again I dont need to since HD isnt a problem atleast in my case. Hope this helps. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Galen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm working on a photo site and most of it is working. The intent is to > store original high-resolution photos that will only be accessed when > purchased, and then a variety of thumbnails that will be accessed when > viewing. Because they're high-resolution, I need maximal image > compression but I can't sacrifice image quality. With hundreds (or > more) of many megapixel images, space requirements quickly soar. > > I am currently using PNG, but that's not all that great for lossless > photo compression. JPEG 2000 is significantly better in terms of file > size, but I haven't ever used that with PHP (and it seems I'll have to > use it via ImageMagick or something). Are there any other (free) > formats for high image compression out there that I can use (maybe even > just via the shell) with PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Best Lossless Hi-Res Photo Storage with PHP
Hei, Regarding the jpg compression, we did some testing along with our customers press buereu's (I think thats the name, the ones that do all the prints and designs the logoes and such). Here we did som testing on the images and the quality. What we experienced was that if we converted the images to JPG with a quality of 10 it was good enough for most people. I however still use 11 just to be safe. (We are ofcourse talking about >300DPI images) So there you have it, quality 10 is still good enough quality for print. However - be aware of another stupid fact - people expecting high resolution downloads wont download a 4-5mb jpg image, since it cant (?) be good enough quality... They are simply expecting a 50MB tif image since this is what they are working with normally. This is infact a huge problem! So much depending on you customers, but saving as a jpg should be just fine. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Galen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Jun 12, 2004, at 4:36 PM, Kim Steinhaug wrote: > > > well, there are formats that have impressed me. The Mpg-4 format > > which requires plugins all over the place is really amazing, from > > e-vue. > > They also provide a plugin atleast for IE to browse the images. > > > > I dont know if you can compress images outside the windows platform > > however. > > > > That's a key problem. I don't touch Windows unless I have to, so I > don't primarily run it at home and my servers _never_ run it, so this > format is totally out of the running - I need to be able to > compress/decompress on *nix based machines. > > > If your looking for supreme quality however, you would need to stay > > away from the lossy formats and probably go for TIFF which is a great > > format and is also supported by any major software. PNG however is > > abit "strange", woudnt sendt PNG images to a publisher... > > > > > > You could ZIP the TIF images on the HD to same space, you often > > get good results on this. This would also make the downloads better > > for the user, and since all the browsing online would use thumbnails > > you > > dont need to waste CPU do depack the images, since you all users > > can depack a ZIP file (thats the least you would expect from a user > > that > > purchase a High resolution image). > > I've experimented, PNG is notably better than ZIP for compressing image > material. PNG retains 100% quality and offers the smallest file sizes > around in a file that can be read by almost any system (i.e. all > half-recent browsers, photoshop, most other graphics applications, > etc). There's no reason I can't also offer a TIFF file, but I'll > primarily route the user to the PNG file because it's simply the > smallest download yet retains 100% quality and is a completely "free" > format. > > > > > Ive created such systems myself, and my sollution was another : > > Plug in a new harddrive. We save the images as jpg, tif, eps, ai or > > whatever > > the original image was created as, and create thumbnails at various > > resolutions in high compressed jpg for fast browsing. Often I tend to > > ZIP the lossless images aswell, but then again I dont need to since HD > > isnt > > a problem atleast in my case. > > > > I have a similar system implemented with thumbnails and caching and all > sorts of things. Works great. But hard drive space is a major concern, > so I have to be more conservative with the hi-res versions. > > > Hope this helps. > > > > Well, it's good to know that somebody else works with this sort of > thing. Although I was really hoping to hear from someone who's worked > with JPEG 2000 lossless (much higher than PNG image compression ratio!) > via ImageMagick or something similar to that. Or perhaps any other > interesting solutions people have come up with that beat PNG for > compression. More thoughts anybody? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: array_rand() not random
Well, I must admit Im gotten abit to familiar with the use of MySQL lately, though it might be abit overkill - but what the heck. The database is there to be used and we shouldnt worry to much. For those really worrying there are several file based "sql" alternatives out there. Ok, I would use and update statement against the SQL database, soething like : update my_stats_table set counter=counter+1 where id=1 All you need is to fire this query on every page, well, you might have different counters for different pages I just used the ID=1 as an example, it might aswell be "page='frontpage'" If you need a more dynamic sollution, meaning you have contents that you want logged that change from time to time - and you do not want to prepare the database all the time you could do it like this, remember I use a DB extraction layer function named query, so whenever I write query I really mean mysql_query... Assuming your counting banners query("update my_stats_table set counter=counter+1 where id=" . md5($bannername)); if(!mysql_affected_rows) query("inserted my_stats_table (id, counter) VALUES ('" . md5($bannername) . "',1)"); You see the logic with the mysql_affected_rows. Now your still stuck with doing some nifty stats generating from the data you have in your table - but now you have numbers in the database and you have several options. One that suddenly comes to mind, is always showing the one with the smallest impressions. $result = query("select * from my_stats_table where order by counter limit 1"); You would here need to add more information, probably might aswell include the entire banner in the database. Well, BTW, hope this helps you. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com ---------- on Sun, 13 Jun 2004 01:15:20AM +0200, Kim Steinhaug insinuated: > Hmm... Ive been having same problems with mysql and picking random > numbers, I ended up having to program a rather more sofisticated > system to eliminate the stats you were referring to. > > You could, not that it will be any better, try another approach : > > Something like : > > $count = count($your_data_array); > $random = rand(0, $count); > echo $your_data_array[$random]; > > PHP is maby using the same random function for both the array_rand and > rand for all I know but its worth a go. yeah, since they use the same thing i'm not sure it'd be worth the effort. > The harder way would be to include an internal counter for your > elements you want to be randomized, so that when an item is selected > you count it. Then the next time you calculate the random element > you take the accual hits into meassure. There are like a 1000 ways > to do this so use your imagination. that would be cool. but how do you maintain the value of a counter from reload to reload? would i have to open an external file, read its variable, increment it, write to it, and close it every time? or is there a way to do that in the code of a single php page? thanks again, -- .~. nori @ sccs.swarthmore.edu /V\ http://www.sccs.swarthmore.edu/~nori // \\ @ maenad.net /( )\ www.maenad.net/jnl ^`~'^ ++ Sponsor me as I run my SECOND marathon for AIDS: ++ ++ http://www.aidsmarathon.com/participant.asp?runner=DC-2844 ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: comparing timestamps
Well, Since the current timestamt is now, and 5 minutes equals 60seconds * 5 minutes = 300, this would give you your range as : $range = time() - 300; If you are working with time() in your database your select would be something like : select * from table where timestamp >= $range -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Chris Mach" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I want to compare a timestamp in my database with the current time. I want to be able to tell if the timestamp is within 5 mins of the current time. How would I do this? Please? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.708 / Virus Database: 464 - Release Date: 18-Jun-2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: is there any application , by using i can produce php exe files in windows ?
Well, You could have a look at this one, http://gtk.php.net/ Though I never had the lucury of getting anywhere with it, it has the possibility to create standalone EXE. There is (Atleast the last time i checked) still a problem with the EXE opening an extra command prompt window, which makes it look abit "unprofessional" if your thinking of applying somthing for your business customer. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Ravi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > HI, > > is there any windows application , by using we can produce standalone php > .exe files ? > > > --- knowledge is power share it --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mysql fetch_row()
Whatabout : mysql_fetch_array() or mysql_fetch_object() Both gives you both the results and the names of the coloumns. Maby I didnt get the question right but since nobody else mentioned it, .) -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Gerben" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > when I call mysql_fetch_row() I get an array, but this Array doesn't have > the fieldnames as array-keys. > I've seen several codes from others where they use something like > > print $row['key']; > > This doesn't work on my server. Is this because my server-software is too > old or am I using the wrong function? > PHP Version 4.3.4 > mySQL version: 3.23.54 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can I detect size of files which are too large to upload?
Well, there is really a short answer for this one. NO! I guess you want to inform the user that a 30MB file is to much to handle for the default 2MB barrier of PHP. Uploading the 30MB file to inform the user that 2MB is what we can handle is kinda to late.. Ive been looking several times for systems that can tell me the filesize before I upload the files / images. Javascript doesnt have the rights, maby some javaapplet where the user accepts the applet could do it. The best function Ive seen so far is the image upload applet from the Gallery team, ther are very close to being able to confront this problem. If you find a sollution be sure to inform me, I would love to know it. Happy hunting! -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com --¨ "Pablo Gosse" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi folks. I'm just tweaking the file manager portion of my CMS, and am wondering if there is any way I can identify the size of an uploaded file which exceeded the upload_max_filesize? I'd like to be able to tell the user the size of the file they tried to upload, in addition to telling them the allowable maximum size. It would seem logical to me that I would not be able to do this, since if the file exceeds the limit set by upload_max_filesize then the upload should not continue past that point. Is this an accurate assumption? Cheers and TIA. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Encryption Question
Do you really need to use stripslashes when retrieving the data? Wouldnt stripslashes only affect magic quotes or already added slashes, I mean when you addslashes to the SQL the slashes are indeed removed when inserted in the table. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Justin Patrin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jay Blanchard wrote: > > > Good morning gurus! > > > > I am encrypting some data on one server and now I am attempting to decrypt on another server using mcrypt_encrypt and mycrypt_decrypt (using same key and initialzation vector). It is almost working but I seem to still have a little problem, that data is missing the last character which still seems to be encrypted. I am putting the data in the database with addslashes, and retrieving with stripslashes, but I get things like this; > > > > 45221141¤Þ,]¹9Ñ > > 7775ÿåZ|z > > > > while($arrEncInfo = mysql_fetch_array($dbGetSub)){ > > $stripDataA = stripslashes($arrEncInfo['dataA']); > > $stripIV = stripslashes($arrEncInfo['iv']); > > $dataA = mcrypt_decrypt($encAlg, $encKey, $stripDataA, $encMode, $stripIV); > > echo $dataA . "\n"; > > } > > > > Has anyone seen this? Could there be a difference between the PHP installs? Both are version 4.3.7. > > > > Thanks! > > > > Jay > > You should probably use mysql_escape_string or mysql_real_escape_string > instead of addslashes and stripslashes. IMHO addslashes and stripslashes > are pretty much useless. > > -- > paperCrane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: is there any application , by using i can produce php exe files in windows ?
That is thrue, but there are some experiments with compiling the scripts into self running exe's. There are a nice tutorial available somewhere made by probably the only one who has managed to do this, :) Anywho, I remember one can use his precompiled files to create ones own EXE setups. Still, the problem at the time I experimented with it was that you get an extra DOS window which lies on the taskbar. This was a year ago, maby things have happened since then. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Kim Steinhaug wrote --- napísal:: > > Well, > > > > You could have a look at this one, http://gtk.php.net/ > > Though I never had the lucury of getting anywhere with it, it > > has the possibility to create standalone EXE. There is (Atleast the last > > time i checked) still a problem with the EXE opening an extra command prompt > > window, which makes it look abit "unprofessional" if your thinking of > > applying > > somthing for your business customer. > > > > That extension does not create exe files, they are normal php scripts > that use gtk functions. > > The "window issue" can be solved, there is some kind of wrapper available. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Benchmarking a script
If you have an apache webserver setup you should look into the ab, apache benchmark suite. This will give you a very good tool to benchmark your files in its correct environment without altering your code. If youre on a windows plattform and cant locate the ab.exe tool please tell me and I'll email it to you, I remember I spent some time finding it. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Anguz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I have a script I am optimizing and want to compare the before and after > in speed. So I wrote a few lines to loop this script but I have a > problem. In the script I'm optimizing there's some function definitions > and when the script starts the second iteration it throws an error > because the function already exists. How can I modify my benchmark code > to make it work? This is what I have: > > $bench_n = 1000; > for($bench_i=$bench_n; --$bench_i>=0; ){ > ob_start(); > $bench_time1 = array_sum(explode(' ', microtime())); > // script start > > // script... > > // script end ** > $bench_time0 += array_sum(explode(' ', microtime())) - $bench_time1; > while(@ob_end_clean()); > } > echo 'Tot Time: ' , $bench_time0 , 'Loops:' , $bench_n , > 'Avg Time: ' , ($bench_time0 / $bench_n) , ''; > ?> > > Thank you very much in advance. > > Cristian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: bad programming?
Could be something about the server environment, you could try changing to : $_SERVER["REQUEST_METHOD"] Run a phpinfo() and see what variables are active on your new server. I know that IIS webservers lack alot of the variables we take for granted mostly. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- "Amanda Hemmerich" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > We just moved a bunch of code from one web hosting company to another. > Now, one of the pages no longer works. I have been sort of starting from > scratch, and the first line is still not working. Am I using something > that I shouldn't be? Here is a code snippet: > > if ($REQUEST_METHOD=='POST') { >for(reset($HTTP_POST_VARS); > $key=key($HTTP_POST_VARS); > next($HTTP_POST_VARS)) { > $this = addslashes($HTTP_POST_VARS[$key]); > $this = strtr($this, ">", " "); > $this = strtr($this, "<", " "); > $this = strtr($this, "|", " "); > $$key = $this; >} > } > > The part that's not working is the $REQUEST_METHOD=='POST' line. If I > replace that with if ($login) (and $login is the name of the submit button > on the form), it works fine. I am leary of using $login...any other > suggestions? > > Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: encryption needed?
if there is a system of your id's, like 1.. 2... 3... 4.. and such, you should consider obfuscating the id's. Especially if you dont have any form of login system that serve the client the id they want. What you really should consider is having a login system that after the user is logged in you serve the user the correct content, and all from what is stored in the session. Meaning you dont need client side javascript or hidden forms at all. If the id's are unguessable however I wouldt care that much, on the other hand - is the information in mention sensitive? If so you are back to the login system again. -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - "Klaus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > I am to set up a service where users can view news of companies. > To identify the company selected an easy way is to use the company-id. > The id is not displayed but stored in the client browser as JS-variable. > > Question: > Is it ok to use the company-id or do I have to encrypt the id > using mcrypt (takes some time)? > > > Thanks in advance > Klaus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Opinion: PHP Sessions or Cookies
Sessions are the best thing to use, cookies are nice as a supplement. If you want your users to be able to "auto-login" cookies are just the thing to use, but apart from this cookies are not my favourite. Another thing is that many browsers nowaydays have turned cookies all off.. I remember a friend of mine did a supportsystem where the loggin system was pure cookies... Man - did their staff get a lot of support from people who didnt manage to logg into the system... As mentioned - this were users with cookies turned off As the other users mentioned, the /tmp folder might be out of space, however your provider might also have some custom setup on that server which screws up the /tmp folder here and there. I know for a fact one large provider here in Norway who has this problem on one of their servers due to a heavy site which from time to time sucks up resources resulting in the /tmp folder getting messed up. If you still havnt solved your problem, get your provider to move you to another of his servers (physically!), or change provider. You shouldnt be having theese problems. -- -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - "Ed Lazor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm using PHP sessions for user tracking. My host provider's server is > dropping session data. He swears it's my scripts and says I should be using > cookies for better security. That goes completely opposite to my > understanding, so I'd like to run it by you guys. Which is more secure: > PHP sessions or cookies? > > > > In case you're curious, more details on the specifics of the problem I'm > experiencing: > > > > I have a prepend file that executes start_session. The script assumes the > user is a guest if $_SESSION["UserID"] is not set. All guests route to the > login screen. Successful authentication sets $_SESSION["UserID"] and sends > you to the original requested page. > > > > It seems fairly straight forward to me. People are able to login and start > using the site, but the login screen displays randomly after they've already > authenticated successfully. > > > > It sounds like PHP session data is being lost on the server. I've also seen > error messages on web pages that report PHP / MySQL as having trouble > reading from the temp directory. Here's the extact message: ERRORError > writing file '/tmp/MYiYcf7q' (Errcode: 28). > > > > Anyway, those are the details. I look forward to hearing what you think. > > > > -Ed > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and Excel
I might be wrong, but if your client are using all the functions available in Excel Im pretty sure you wont get this to work. Ive tested a few of the Excel converters for PHP and they all work nice with simple Excel spreadsheets, but once you start doing it Excel style... Your on your own... If youre on a Win32 platform you might solve this nicely, since this gives you alot of possibilities with exec and such. But I wouldt spend to much time on this if the system is to run on a *nix system. I hope someone proove me wrong here, but theese are my findings. Possible there are some nasty good proprietary Excel systems out there? Anyone? -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - "Arnold" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I want to use a large Excel sheet in a website. The Excel sheet exists of > lots of functions and the developer of it is a financial person who is used > to programmning in Excel, not in other "programming languages". How can i: > insert the data that's filled in in several forms on web pages (i guess the > "spreadsheet Excel Writer" package), let Excel do the work and produce the > output information, in PHP? Or is there an easier way to use an Excel sheet > together with web pages? > > Arnold -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pdf
> Hi all , > > I am using PHP 4.3.2 and MYSQL database. > > I need to convert the sql query to Adobe PDF format. > Any one have any suggestion how to do this? > > I have search phpclasses , found SQL2PdfReport classes , however it > gave error message as shown below : > >"Error in opening pdf " > > Lookup the code in the SQL2Report class , it did not support pdf 7.0 and > above. > > Thanks > I would recommend you looking into pdflib, this is a professional package which supports all versions of PDF, and really whatever you need. The other class people mentions are free, but far from as advanced as pdflib. Grab it here : http://www.pdflib.com/ regards, Kim Steinhaug http://www.steinhaug.no/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php