[PHP] Re: Sorry for naggin, need a short test
At 12.04.2002 19:20, you wrote: Works fine here. I can see the main page, and it opens up a window Knackige Preise! auf wiedersen -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Thanks Jason, that´s what I didn´t want to hear ! ;-) Seems to get a long night, installing M$ $tuff again, to eliminate my local error. Thanks again (don´t know how this is in chinese) Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: another try...
Aeh, maybe you should make a plan, first, what to do. ;-) That´s normal if you go to the supermarket, why not on softwaredevelopment? At 08.04.2002 18:20, you wrote: Ok I have it working to a point... how can I impliment a loop to count the files in the directory, right now it only pulls the first file into the select box. Here is the code: ?php $dir_name = /path/to/images/directory/on/server/; $dir = opendir($dir_name); echo pFORM METHOD=\post\ ACTION=\index_done.php3\ NAME=\Foo\; echo SELECT NAME=\files\; // form name not really required, and shouldn´t be a var. while ($file_name = readdir($dir)) { if (($file_name != .) ($file_name !=..)) { echo OPTION VALUE=\$file_name\ NAME=\my_file[]\$file_name/OPTION; // how can you get the option name in your next script if you use $filename?? } // end if } // end while echo /SELECTbrbr; echo INPUT TYPE=\submit\ NAME=\submit\ VALUE=\select\/FORM/p; closedir($dir); ? Thanks, in advance Jas I know your next Question :) , How to get the selected values in my script index_doen.php3 look for arrays, getting content from arrays. HTH Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loading Images
At 26.03.2002 14:44, you wrote: I wasn't so much concearned about security of users grabbin pics. I am more trying to learn how these people load there menus dynamically and pics dynamically. Do you have any links to pages or code that describe how to make a link in the db to pics on my filesystem? Thanks. -Chris snip I cannot help you with code,also it wouldn´t really help you understanding the problem but give you more problems understanding my code. I use to have a table with the following structure TABLE MENU rn // that´s an autoincrement number for indexing page // on which page the component will appear foobar.php3 pt // path to the pic (depending of quantity of path) ../pix/ nop // the name of the pic foo.jpg altval // the word which will be shown in the alt tag of the pics reference This is the foopic link// where will the link go newfoo.php orm // a number to order the sf // showflag, to switch off unwanted/uncompleted pages For pathinformations, I use an includefile which is included on every page. This holds the informations about tablewidth, pathes(oops that´s correct?), sitenames and everything the Site needs on every page. Now you just make a select like select * from menu where page=$PHP_SELF where sf=1 order by orm And make your menu. If you put the menu in an extra page (or an object) you just have to include it on every content page and the work is done. echo 'table border=0 width='.$tbwidth.' cellpadding=0 cellspacing=0 summary=Menutable' while($res=answer from db) { echo 'trtd' echo 'a href='.$res[5].'?somevar=something' echo 'img src=$res[2] border=0 width=XX height=YY alt=$res[4] echo '/a/td/tr' } echo '/table' As you said you want to make a menu, width height of the pics are known. Otherwise you shoul check them using fuctions from the graphic library. The Browsers are faster if they know exactly what the do. Maybe this gives you some understanding how to do it. Oliver (sorry all trailing ; are missing. It´s early today) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Tool to remove comments??
Hi Folks, does anybody know a tool for removing comments out of PHP scripts? I mean // this is a comment and /* this is also a comment */ it should also handle something like echo'http://somewher.somecom/somepage'; // this goes to somewhere and multiline comment like /* ..blah */ maybe anybody has an awk script, that he/she will share with me. TIA Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting
At 20.03.2002 16:29, you wrote: Hii, Actually i want to sort the files form mysql database using php sorting.I can get the correct result using php sorting if the data's are stored in the array like this format. $temp=array(apple,Orange,Gova) please tell me how i will store the field details in a array fetched from mysql database even if you could sort the data with the correct select f.e. select * from your_db where something='tru' order by the_field_you_wnt_to_sort, the method you requested is something like while($res=result_from_db_select) (sorry for result_from_db_select but as I´m using objects for databaseactions, I don´t know the exact commands maybe mysql_fetch_row) { for($i=0; $i count($res); $i++) // counts all fields that come back { $temp[$i] = $res[$i]; } } if you have a named array, you could also use an array for the names f.e. $arraynames=array(first_col,second_col,third_col) the your code would like while($res=result_from_db_select) { for($i=0; $i count($res); $i++) // counts all fields that come back { $temp[$arraynames[$i]] = $res[$i]; } } HTH Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP session ID not unique or session_register problems
At 18.03.2002 14:54, you wrote: Even if I did´nt look closely at your code, I would suggest, that you decrease the amount of data, diferent tables to one table. You set an cookie, therfor you have the same effect as if you use sesssion vars. So it´s easy to set and find the data, via cookie. f.e. table: cookie // here the initial cookie, you sent is stored varname // what kind of information should be stored varval // the value of the varname. timestamp // if you like now you can save all desired informations according to cookie, have them all in one place, and can select them to different conditions. But, what if the user doesn´t allow cookies ?? Hi! I am a kind of newbie in PHP programming, but I have found an interesting problem and some php guys I know were unable to help me to solve it. So I am coming here with my question... I have written a little more advanced counter, which should be included in other PHP scripts in website. It uses cookies, which expire in one year. That helps me to determine which users are coming back to the website. It also uses sessions (session cookies) to detect how one user is moving in the website in one session. Program uses three MySQL tables - table of cookies (cookie ID, number of visits), table of sessions (session ID, cookie ID, IP, browser,...) and table of visited subpages in the website (session ID, visited location). The program flow is simple: 1. Check the cookies. If user do not have a cookie, send it to him. Else find cookie ID in the database (first table) and increase the counter. 2. Check session ID. If session is not registered, register it and set 'number of session visits counter' to 1, AND save session ID (+ cookie ID, IP,...) to the second MySQL table. If session is already registered, just increase the session visits counter. 3. Save session ID and visited location (I use the $REQUEST_URI variable) to the third MySQL table. It seems OK, but see what happened. I explicitely said that if ($sess_visits == 1), variable $sessid is saved to the second table. That means that $sessid must be unique - it should appear in a table just once. But when I exported data from table, I found that some $sessid appeared twice or three times! What could be the problem??? See a little bit of my code: ini_set(session.cookie_lifetime, 0); // Initialize session session_start(); // Register session and set number of session visits variable to 1 if (!session_is_registered('sess_visits')) { session_register('sess_visits'); $sess_visits = 1; } else { $sess_visits++; } if ($sess_visits == 1) { ... // Save session, IP, etc. into database $sql = INSERT INTO wc_sessionident SET sessid = '$sessid', ...; ... } bye, Matej -- 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
Re: [PHP] printing in HTML or PHP
At 18.03.2002 16:57, you wrote: I would like to print the line bellow on my HTML generated by a PHP file. How can I do it? The line is: link rel=stylesheet type=text/css href=default.css Thank you Daniel Ferreira Castro Your line should be between head and /head the you could use echo 'link rel=stylesheet type=text/css href=default.css'; HTH Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OBJECT£ºWHAT'S THE RALATION BETWEEN A,B AND C?
At 17.03.2002 10:01, you wrote: ?php class A { function A($i) { $this-value = $i; // try to figure out why we do not need a reference here $this-b = new B($this); } function createRef() { $this-c = new B($this); } function echoValue() { echo br,class ,get_class($this),': ',$this-value; } } class B { function B($a) { $this-a = $a; } function echoValue() { echo br,class ,get_class($this),': ',$this-a-value; } } // try to undestand why using a simple copy here would yield // in an undesired result in the *-marked line $a =new A(10); $a-createRef(); $a-echoValue(); $a-b-echoValue(); $a-c-echoValue(); $a-value = 11; $a-echoValue(); $a-b-echoValue(); // * $a-c-echoValue(); ? Even if I don´t understand what your code does, shouldn´t you give any variable a place to be stored so it schould look like class foo { var $a; var $b; function fooplus() { $this - a = foofoo; and so on ?? } } HTH Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SERVER INFO
At 16.03.2002 01:41, you wrote: Hi all, I appologise if this is off topic but I don't know who to ask. I hope you guys don't mind. Does any body know where I can find information about the steps of setting up a server(LINUX) so that people can find a certain URL address? I want to sent up a small server for myself from home with my machine but I don't know how to make it so that the web pages that I put in my server accessable by other people around the world. do I have to connect my modem into my phone line (online) all the time or...??? It sounds, as you are a newbe. Setting up a linuxbox is one thing, getting it in the internet is another. Better way is to look for a provider (maybe free, or free php) to put the pages there. That´s cheaper then having the linuxbox be connected to the internet via a phone-line. (mh.. what about an IP ?) If you want to do PHP, set up a linux server as described in the link (see th other reply) test your stuff locally and when you´re ready put them on the provider´s machine. You´ll save a lot of money and time. look in the archive for free php spaces. HTH Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with TTF
At 24.10.01 12:37, you wrote: Warning: Could not find/open font in /sdr/httpd/Prisa/DATA/private/libs/graficos/intradia.php on line 57 Line 57: ImageTTFText ($O_imagen, 11, 0, 10, 20, $O_colorValor, arial.ttf,$s_Valor); arial.ttf is into the same dir. Any ideas? I had the same problems while using postscriptfonts. try this $font=imagepsloadfont(YOUR.FONT); you have to look for a substitution for imageepsloadfont maybe it´s imagettfloadfont(); - and you have to do this command TWO times. Don´t ask me why, but it works ?! Hope this helps Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] str_replace binary safe??
At 22.10.01 21:36, you wrote: Hi folks, following problem appeared on PHP 3.0.16 on LINUX I have a binary file, where I want to replace some letters I do the following: $filename = xyz.sdc; $fd = fopen( $filename, r+b ); // also tried r $x=filesize( $filename ); // this shows the correct filesize 22528 byte $contents = fread( $fd, $x ); fclose( $fd ); $y=strlen($contents); // The first mistake $y = 32956 byte echo BEFOREbr.$contents; $contents=str_replace(UU,123456, $contents); echo AFTERbr.$contents; It seems, that php converts HEX 00 00 to HEX 5C 30 just when it reads the data in memory because at the BEFORE echo the data will be shown as \0 (hex 00 00 ). The filesize will be correct when I save the str_replaced text and the text will be cahnged correct. Any idea, where this comes from?? Let's start with the fopen(), where the mode expression might be causing problems - should it be rb? http://www.php.net/manual/en/function.fopen.php If the 'binary' component hasn't been recognised it might explain the first mistake. The ensuing problems may even stem from there... Thanks DLNeil, I tried rb r r+b(C-style) always the same :( Any other suggestions ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Working with numbers
At 01:39 04.05.01 -0400, you wrote: Ok Jennifer lets do some basics ;-) I've done some searching on the php site for more info about double and float etc, but I don't really understand anything I found. Can someone give me an explanation about the difference between decimal, float, double? decimal is a straight number f.e 123456 the size/length of this number belongs to the used hardware/compiler (normally 64bit???) it could be signed so it could be -123456 or +123456 float is a number like 123,456 or 0,123456 size/signed see above double is also a number like float but with the double size (normally 128 bit ??) Should I be using decimal as my column type in the MySQL database or should I be using a different column type? If you want to store float numbers like prices or so you could use float(M,D) where M ist the langth of all numbers and D is the number of the fraction(is that word right) I mean what´s behind the , . Look in the manual of mysql datatypes to get more information about numbers and other interesting datatypes. HTH Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]