Re: [PHP] PHP5 - Weird Error - "cannot find element in variable"
Curt Zirzow wrote: * Thus wrote Scott Hyndman: Okay, I'm getting this error in a class I've written. I can't explain it. it works perfectly fine for me: http://zirzow.dyndns.org/html/php/oop5/IA.php With the information you provided its near impossible to tell you whats wrong. Curt I'm getting the exact same error while trying to assgin a value to an local array. I tried using the code at http://zirzow.dyndns.org/html/php/oop5/IA.php, to check if i was doing something wrong and i got the following answer: Warning: Cannot find element items in variable in Unknown on line 0 Warning: Cannot find element items in variable in Unknown on line 0 Warning: Cannot find element items in variable in Unknown on line 0 Warning: Cannot find element items in variable in Unknown on line 0 Warning: Cannot find element items in variable in Unknown on line 0 This only happens when i use the debbuger (Zend 3.5). If i run the script normally it just does nothing! So i think we have a really nasty bug. Can anyone tell me what to do? Miguel Manso -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Good eve
I have a table with several field, one of them has a date insertion on the d/m/y format. I would like to return only the data for the present day (today will be date 05/12/02 tomorrow will be 06/12/02) I will do SELECT field1, field2, field3 FROM table WHERE date=? What is missing on the ??s ? Thx in advance Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date
And sorry about the subject, it should be Date "Miguel BráS" <[EMAIL PROTECTED]> escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a table with several field, one of them has a date insertion on the > d/m/y format. > I would like to return only the data for the present day (today will be date > 05/12/02 tomorrow will be 06/12/02) > > I will do SELECT field1, field2, field3 FROM table WHERE date=? > > What is missing on the ??s ? > > Thx in advance > Miguel > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good eve
thx to both Miguel "Rolf Vreijdenberger" <[EMAIL PROTECTED]> escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > SELECT field1, field2, field3 FROM table WHERE date=NOW() > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date again
Ok guys, having a problem here. I did my table with 6 fields, they are: id position name timein timeout date I have a form to insert the info on the fields, and at the date field, I have a drop down menu that returns me the next 7 days (the date in d/m/y), people will choose the date they want and that will be stored on the table. Now I want to retrieve the position, name, timein and timeout from by table and display it on a page. But I want only the records for the present date. I inserted the info on my table and on the date's field I inserted 07/12/02 and 06/12/02 just for testing I called the data via a query: SELECT position, name, timein, timeout, date FROM table WHERE date=NOW() It was supposed that only the record from the present date was shown. But not, I can't have anything. Only the custom message I did if nothing was available What is missing here? Looked at PHP manual, time, date mktime and so on functions, but nothing. Anybody for a hand? One more thing, how can I do to prevent that different people apply for a same position, on the same day and during the "shift" of the first one that applied? I mean, I decide to occupy the FSS position from 21:00 to 23:00 on 08th Decemeber. Someone come and try to apply also for FSS but from 19:00 to 20:30 or from 21:30 to 22:30. Since the position is occupied during a portion of the requested time or during all the requested time, how can I prevent this to be added on the table?? Thx Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Next and Previous
On a page i have all the records from a table. they are linkable. if you click on them, the will show the specific record id with all info on the row. how to make a link for the following record and one other for the previous? suppose, the page you're seeing is http://www.x.com/news.php?ID=501 how to add a link for the page to show the ID=502 and the ID=500 Regards Miguel PS- And don't strange about the letter color, I don't know why i green now!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Next and Previous
Hi, it's giving me an error. it assumes the next page as news.php?ID=1 and the previous as news.php?ID=-1 Any hint for that? Miguel "Chris Shiflett" <[EMAIL PROTECTED]> escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > --- Miguel Brás <[EMAIL PROTECTED]> wrote: > > suppose, the page you're seeing is > > http://www.x.com/news.php?ID=501 how to add > > a link for the page to show the ID=502 and the > > ID=500 > > Next > > Previous > > Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Next and Previous
That's not the case, I tested it on ID549 and the previous one should be 548 and he still assume -1 Miguel "Timothy Hitchens )" <[EMAIL PROTECTED]> escreveu na mensagem 000101c2bc33$7e887020$0500a8c0@bambino">news:000101c2bc33$7e887020$0500a8c0@bambino... This is because you are at the beginning and you need to have some logic to not display the previous if at beginning. Timothy Hitchens (HiTCHO) Open Source Consulting e-mail: [EMAIL PROTECTED] > -----Original Message- > From: Miguel Brás [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 15 January 2003 11:06 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Next and Previous > > > Hi, > > it's giving me an error. it assumes the next page as > news.php?ID=1 and the previous as news.php?ID=-1 Any hint for that? > > Miguel > > "Chris Shiflett" <[EMAIL PROTECTED]> escreveu na mensagem > news:[EMAIL PROTECTED].> yahoo.com... > > > --- Miguel Brás <[EMAIL PROTECTED]> wrote: > > > > suppose, the page you're seeing is > > > http://www.x.com/news.php?ID=501 how to add a link > for the page > > > to show the ID=502 and the ID=500 > > > > Next > > > > Previous > > > > 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
Re: [PHP] Next and Previous
Let's see i solved thhe problem... I did since I was making the select with WHERE ID = '$ID' so I get the var $ID., Thx for the help of all Miguel "Matt" <[EMAIL PROTECTED]> escreveu na mensagem 034901c2bc37$41429160$[EMAIL PROTECTED]">news:034901c2bc37$41429160$[EMAIL PROTECTED]... > >"Miguel Brás" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > That's not the case, I tested it on ID549 and the previous one should be > 548 and he still assume -1 > > Works for me. Are you adding the ?ID=500 to the url? If you don't have > that, then the ID is 0, so you get the 1 and -1. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Send email when some action
Hi gents, i have a script to manage the registered users on my site. have also a table with id, name, uname, passwrd, email, datejoined, level and status my question is... it there any possibility to inform a member by mail that his (let'say) current status changed from inactive to active, or from active to inactive? I mean, whenever a change occur on member's details, a mail is sent to him telling what was changed. Any posssibility? Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Send email when some action
thx for the replies Miguel "Maxim Maletsky" <[EMAIL PROTECTED]> escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... mail() function @ http://php.net/mail -- Maxim Maletsky [EMAIL PROTECTED] "Miguel Brás" <[EMAIL PROTECTED]> wrote... : > Hi gents, > > i have a script to manage the registered users on my site. > have also a table with id, name, uname, passwrd, email, datejoined, level > and status > > my question is... > it there any possibility to inform a member by mail that his (let'say) > current status changed from inactive to active, or from active to inactive? > I mean, whenever a change occur on member's details, a mail is sent to him > telling what was changed. Any posssibility? > > Miguel > > > > -- > 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] get the $email string
Hi, i made a page to display some user details and then clicking on the user name it goes to another page to send a mail via mail() function. here is the line of the first page name; ?> when click on user name, it goes to the mail_active.php?[EMAIL PROTECTED] on the mail_active.php page, how do I get the e-mail address to send? I mean, the mail function is mail ("$to","$subject","$message","From: $sender"); How can I take the $to string to be [EMAIL PROTECTED]? Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Delete files via PHP
Hi guys, I made a upload file's script and it works fine. No, I wanna create a page where it will display the directory content and will let me delete any file standing there. Is there any way to use php for that? Where can I get info about it? BTW, I have PHP/MySQL working on a Linux system Thx in advance Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delete files via PHP
Hey, thx for your speech In a matter of fact, I have 2 books about PHP and all they say about the unlink function (I use it in my upload system) is that it is suposed to force the delete of the temporary file that it is created during the upload process. So, i was never thinking that the unlink fuction was able to do it. Sorry for thge trouble Miguel "Øyvind vestavik" <[EMAIL PROTECTED]> escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Read the manual first. If you can't find it, search the net (google is a great place to start). If you still can't find it, _then_ ask on the list. I had no idea how to do this, but it took me 30 sec to find out, and I'm a newbie. http://no.php.net/manual/en/function.unlink.php vennlig hilsen Øyvind On Fri, 31 Jan 2003, Miguel Brás wrote: > Hi guys, > > I made a upload file's script and it works fine. > > No, I wanna create a page where it will display the directory content and > will let me delete any file standing there. > > Is there any way to use php for that? Where can I get info about it? > > BTW, I have PHP/MySQL working on a Linux system > > Thx in advance > Miguel > > > > -- > 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] Delete files via PHP
Hi, that's a negative They say that after uploading the file, the temp file on the tmp directory (usual) is deleted, anyway in order to confirm the deletion we should use unlink() function. Reading from one of the books, they say that the temp files are not deleted if a misconfiguration is found on php.ini or if the directory permissions aren't set as they should be. Miguel "Jason Wong" <[EMAIL PROTECTED]> escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Saturday 01 February 2003 03:23, Miguel Brás wrote: > > Hey, thx for your speech > > > > In a matter of fact, I have 2 books about PHP and all they say about the > > unlink function (I use it in my upload system) is that it is suposed to > > force the delete of the temporary file that it is created during the upload > > process. > > > > So, i was never thinking that the unlink fuction was able to do it. > > Could you tell us which books they are? They seem to be giving very poor > advice. Uploaded files are _automatically_ deleted when the script ends. > There is no need to force deletion of those temporary files. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > -- > /* > The best laid plans of mice and men are held up in the legal department. > */ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redeclare formatdate
Hi, I have this message coming when calling the page main.php Fatal error: Cannot redeclare formatdate() in /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3 the code related to this message is: I use this code is some other pages and it works well, but here the code is used in page not_main.php whose I included it on main.php using require() function Anyone have a tip for it? Thx Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redeclare formatdate
Thx for the help... Miguel "Jason Sheets" <[EMAIL PROTECTED]> escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > This is a good reason to use include_once and require_once. > > Jason > > On Sat, 2003-02-01 at 15:59, John W. Holmes wrote: > > > I have this message coming when calling the page main.php > > > > > > Fatal error: Cannot redeclare formatdate() in > > > /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3 > > > > > > the code related to this message is: > > > > > >> > // format MySQL DATETIME value into a more readable string > > > function formatDate($val) > > > { > > >$arr = explode("/", $val); > > >return date("d/m/y", mktime(0,0,0, $arr[1], $arr[2], $arr[0])); > > > } > > > ?> > > > > > > I use this code is some other pages and it works well, but here the > > code > > > is used in page not_main.php whose I included it on main.php using > > > require() > > > function > > > > Your function is being declared twice, which means that this file is > > probably being included or required twice. Look through your code... > > > > ---John W. Holmes... > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > > today. http://www.phparch.com/ > > > > > > > > -- > > 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] Execute at a defined time
Hi, I was looking on PHP manual but didn't find anything about it. How can I execute a script all days at the same time? I kno i must have access to the CRON of the system, but don't know what function should I use to make this happen (run the script). Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute at a defined time
Thx all for the help Problem solved Miguel "Jason Sheets" <[EMAIL PROTECTED]> escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi Miguel, You can use cron to execute the CGI or CLI version of PHP against your PHP script, for example /usr/local/bin/php example.php, simply create a cron entry that will execute at the desired time. If you need information on the crontab format do a man crontab or search google for cron help as there is a lot of information available. Jason On Wed, 2003-02-05 at 06:49, Miguel Brás wrote: > Hi, > > I was looking on PHP manual but didn't find anything about it. > > How can I execute a script all days at the same time? I kno i must have > access to the CRON of the system, but don't know what function should I use > to make this happen (run the script). > > Miguel > > > > -- > 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] Read file and get what i want
Hello gents, I made a script to open a file on a server and write his content to a temp file on my server. A part of the temp file is below: ***temp file** !GENERAL VERSION = 1 RELOAD = 1 UPDATE = 20030206181916 CONNECTED CLIENTS = 178 CONNECTED SERVERS = 12 !CLIENTS AHS5577:134723:RUBÉN FALCÓN LEBG:PILOT::42.226630:-1.795440:35248:423:T/B763/F:410:LEBL:35000:LEST:IVANB E:1:1:4001:0:40:0:I:1715:1715:1:30:4:30:NONE:NONE :LEBL - LOBAR 1C - UN725 - LOMDA 1G - LEST:::20030206181830 OBS::FRANCIS BALLION:ATC:199.999:44.791670:0.541670:0:0::IVANDE:9:1:0:0:100:: 20030206181821 I-JEST:127128:ROBERTO PIETRAFESA LIBG:PILOT::41.791590:12.244720:17:0:T/B737/T:300:LIRF:15000:LICD:IVANBE:1:1 :0:0:40:0:I:1930:1930:1:0:4:30:NONE:CHARTS ON BOARD :LIRF-ROTUN-CORAD-GIANO-PAL-PAL14-LONDI-MABOX-RATOK-MADIR-ASDAX-DEDUK-LPD-LI CD:::20030206181816 ELY0001:127632:OMRI ATAR LLBG:PILOT::31.996330:34.892110:153:0:T/B772/F:486:LLBG:FL380:KJFK:IVANGR2:1 :1:1200:0:40:0:I:1000:1100:1:30:4:30:NONE:NONE :DENA1E -> SUVAS KAROL APLON MAROS DASNI TOMBI AYT KUMRU ELMAS EKSEN KFK HANKO GAYEM WRN BALIK ARGES BUKEL PELUR DEMUN REBLA KARIL PITOK SLC BABUS BNO BODAL VLM ILNEK DONAD VARIK PEROX SODRO TABAT TAMEB ROBEL KEMAD HMM RELBI RKN TENLI FLEVO:::20030206181756 DLH001:138912:MANUEL KAUFMANN EDDT:PILOT::52.556900:13.294230:133:28::IVANDE2:1:1:1200:0:40::: :::20030206181755 *End of temp file*** Now the tricky part... Each part is separated by a : Example AHS5577:134723:RUBÉN FALCÓN LEBG:PILOT:: first part is callsign, then is the id, then the name, type and so on and on (some parts has no data >>::<<) Now, how do I get the first part (callsign) of each line so i can make something like: if ($first_part ==TAP){ echo "TAP is online"; } else { echo "TAP isn't online"; } Was I clear enough? Anyone has an ideia for this? Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Different dates with lmost same script
Hi, I have 2 pages that shows a table contents On one, it shows the title and date with the following script ** 0) { // iterate através do conj resultados // print titulo dos artigos while($row = mysql_fetch_object($result)) { ?> http://www.ivao-pt.org/noticias/";>titulo; ?> timestamp); ?> Nenhuma notícia disponível! * functions.php script * On the other one, besides showing date and title, it shows also the text, autor and some other stuff almost with same code The problem is that on the one where only the title and date are shown, he gives me always the same date, no matter if i posted yesterday or today. The date is always 30/11/02 On the more detailed page, the date is shown correctly, today's date if posted today, yesterday's date if posted yesterday. Any idea for that? I checked the table, and the date is correct...i don't know what else to do Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Different dates with lmost same script
Hi, I have 2 pages that shows a table contents On one, it shows the title and date with the following script ** 0) { // iterate através do conj resultados // print titulo dos artigos while($row = mysql_fetch_object($result)) { ?> http://www.ivao-pt.org/noticias/";>titulo; ?> timestamp); ?> Nenhuma notícia disponível! * functions.php script * On the other one, besides showing date and title, it shows also the text, autor and some other stuff almost with same code The problem is that on the one where only the title and date are shown, he gives me always the same date, no matter if i posted yesterday or today. The date is always 30/11/02 On the more detailed page, the date is shown correctly, today's date if posted today, yesterday's date if posted yesterday. Any idea for that? I checked the table, and the date is correct...i don't know what else to do Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Show the info to update depending on the selection
Hi, I have a page that is intendend to update a table field on DB i have a drop down menu wich displays all the position fields available on db and a text area where i will insert the new data. now the problem: I'm using the query SELECT * FROM table WHERE position = $position the $position is the choosen option from the drop down menu. then have echo "$functions" where it will show to me the present data available on DB after all this, i have another query UPDATE table SET functions = $functions WHERE position = $position All is ok and working except the fact that he doesn't displays $functions when selecting a option from the drop down menu? Any help out there? Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Data from DB
Hello gents, I have a table with users and passwords with over than 100 rows. I have 7 specific users that I wanna display on a page, as well their data. How can I display this specific users on the page? Thx Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Data from DB
Using MySQL Any change for a code sample? Thx Miguel "Greg Donald" <[EMAIL PROTECTED]> escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Mon, 17 Feb 2003, Miguel Brás wrote: > > > >I have a table with users and passwords with over than 100 rows. > >I have 7 specific users that I wanna display on a page, as well their data. > > > >How can I display this specific users on the page? > > You probably want to execute some SQL queries. Then the data that is > returned you will want to place into an array. Then finally you > will want to iterate over the array creating some html from each row for > display. > > > -- > Greg Donald > http://destiney.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What is wrong with this?
Hi, here's the script * "; $connection = mysql_connect($host, $user, $pass) or die ("Erro de execução. Informe-nos sobre a situação!"); mysql_select_db($db) or die ("Erro de execução. Informe-nos sobre a situação!"); $queryaviao="SELECT * FROM ssr ORDER BY aviao"; // sets up the find $resultaviao = mysql_query ($queryaviao); // runs the find $num = mysql_num_rows($resultaviao); //goes thru each row building the display for ($i = 0; $i < $num; $i++) { $aviao = mysql_result($resultaviao, $i, "aviao"); $sk = mysql_result($resultaviao, $i, "sk"); $drop_down_list .= "$aviao"; } $drop_down_list .= ""; ?> Determinar a Categoria da Aeronave Aircraft model SBox code 0) { // print result ?> The squawk code for is XXX No aircrafts found with the supplied model I receive this messages when trying to work with the script: Erro no pedido: . You have an error in your SQL syntax near '= 'Airbus' ' at line 1 Erro no pedido: . You have an error in your SQL syntax near '= 'CONC' ' at line 1 Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is wrong with this?
Hi, yes in fact it worked...I also had the $numrows with wrong mysql command, it should be mysql_num_rows() instead of the mysql_fetch_rows(). Thx Ernest But now that this is working, i have another big problem...my $drop_down_list isn't assuming the value of the shown option...right here on the below part for ($i = 0; $i < $num; $i++) { $aviao = mysql_result($resultaviao, $i, "aviao"); $sk = mysql_result($resultaviao, $i, "sk"); $drop_down_list .= "$aviao"; } ** So he isn't getting the data from DB. He displays all records on DB available at aviao field, but he is not making the correct mysql query... Anyone knows why? - Original Message - From: "Ernest E Vogelsinger" <[EMAIL PROTECTED]> To: "Miguel Brás" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, February 24, 2003 9:45 AM Subject: Re: [PHP] What is wrong with this? At 10:37 24.02.2003, Miguel Brás said: [snip] >//logical request >if ($nome) { >$sql="aviao = '$nome' "; >} >if ($code) { >$sql="code = '$code' "; >} >$query = "SELECT * FROM ssr WHERE"; >$query .= $sql; [snip] Hi, I've copied only the relevant lines of your program. The issue here is that your string concatenation results in SELECT * FROM ssr WHEREaviao = 'Airbus' Note the missing space after "WHERE". Your code should better read $query = "SELECT * FROM ssr WHERE "; $query .= $sql; Have an eye on the added blank after WHERE. HTH, -- >O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Page per page
Hi guys, Anyone has a good example to build a system that show X records per page and give links to next and previous pages? Thx Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie Security Questions...
Hi all, First thankx for reading this !. I'm a Newbie in PHP, previously i was doing web stuff in perl. I want to do a site were you login, and depending on the login account the user receives a given set of permissions. From what i have studid the session management, were you start a session id, and can put in several variables... My question is this, this variables remain were ? on the user browser (cookies, url enconding ?) or does the user just receive the single session id, and the rest remain on the server ? This is a important security consideration for me. Any help will be great Stay well ! Miguel Angelo e-mail: [EMAIL PROTECTED] http://migas.mine.nu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache 2.x and PHP
Hi All, Can anyone aswer this simple question, that i still have not found it anywhere... Is PHP capable of running on Apache 2.x and if so what version ? And is it stable ? Thankxs for any reply Miguel Angelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] APACHE/PHP - buttons don't work
Hi, I've recently upgraded my webserver for apache 2.0.47 with php 4.3.2 on a solaris 9 box My problem is... the buttons on the php pages don't work and I can't figure why this is happening... Apache compiled like: ./configure --prefix=/opt/apache --activate-module=/opt/php/distribution/php-4.3.2/libs/libphp4.a --enable-module=so --with-ssl=/usr/local/ssl --enable-ssl I've compiled the PHP like: ./configure --prefix=/opt/php --with-config-file-path=/opt/php/conf --with-apache2=/opt/apache --with-apxs2=/opt/apache/bin/apxs --with-openssl=/usr/local/ssl --enable-force-cgi-redirect --disable-debug --enable-pic --enable-inline-optimizations --with-ftp --with-zlib --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-track-vars --enable-trans-sid --enable-memory-limit --enable-calendar --enable-mbstring I don't know if it is a compilation issue... but I can't see other option beside this one. Thanks Regards, Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] buttons don't work
I've recently upgraded my webserver for apache 2.0.47 with php 4.3.2 on a solaris 9 box My problem is... the buttons on the php pages don't work and I can't figure why this is happening... Apache compiled like: ./configure --prefix=/opt/apache --activate-module=/opt/php/distribution/php-4.3.2/libs/libphp4.a --enable-module=so --with-ssl=/usr/local/ssl --enable-ssl I've compiled the PHP like: ./configure --prefix=/opt/php --with-config-file-path=/opt/php/conf --with-apache2=/opt/apache --with-apxs2=/opt/apache/bin/apxs --with-openssl=/usr/local/ssl --enable-force-cgi-redirect --disable-debug --enable-pic --enable-inline-optimizations --with-ftp --with-zlib --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-track-vars --enable-trans-sid --enable-memory-limit --enable-calendar --enable-mbstring I don't know if it is a compilation issue... but I can't see other option beside this one. Thanks Regards, Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Select DataBase Mysql Problem
Hi everyone, FIRST THANKX FOR ANY HELP !! and THANKX FOR READING :) I'm a reall newbie on PHP and i'm build a php app to connect into a mysql database.. but i cannot select the database i have build the database, and created a user with : create database mydatabase; use mydatabase; create tb_users ( userid varchar(20), userpassword varchar(20 ); grant select, update, insert, delete on mydatabase.* to [EMAIL PROTECTED] IDENTIFIED BY "mypassword"; then flush priveliges... I tested the user on mysql and it work correcly for my the pretended database NOTES: O.S. Linux Mysql : compiled the most recent stable 4.0.12 Php was compiled by SuSe on SuSe 8.0 Php is connected into mysql via socks (configured on /etc/php.ini) to test the set up i have used the php.net manual example to connect into the mysql database i manage to connect into mysql but i cannot select the database can this be my mistake or can it be a software problem ? here is the php programa "); print "Connected successfully"; mysql_select_db("$DB_NAME", $link) or die("Could not select database"); /* Performing SQL query */ $query = "SELECT * FROM tb_users"; $result = mysql_query($query) or die("Query failed"); /* Printing results in HTML */ print "\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { print "\t\n"; foreach ($line as $col_value) { print "\t\t$col_value\n"; } print "\t\n"; } print "\n"; /* Free resultset */ mysql_free_result($result); /* Closing connection */ mysql_close($link); ?> Stay Happy Miguel Angelo --- End of Forwarded Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Select DataBase Mysql Problem
Thankx a million Tom, I used .mysql_error() and i found it right away. Actualy i have a config.php file with the mysql user information and i was forgeting to do a include("config.php"); before i used mysql. Really stupid error. Thankx again. Miguel Angelo > Hi, > > Sunday, March 23, 2003, 1:26:04 PM, you wrote: > MA> Hi everyone, > > MA> FIRST THANKX FOR ANY HELP !! > MA> and THANKX FOR READING :) > > MA> I'm a reall newbie on PHP and i'm build a php app to connect > into a mysql MA> database.. but i cannot select the database > > MA> i have build the database, and created a user > MA> with : > > MA> create database mydatabase; > MA> use mydatabase; > MA> create tb_users ( userid varchar(20), userpassword varchar(20 ); > > MA> grant select, update, insert, delete on mydatabase.* to [EMAIL PROTECTED] > MA> IDENTIFIED BY "mypassword"; > > MA> then flush priveliges... > MA> I tested the user on mysql and it work correcly for my the > pretended database > > MA> NOTES: > MA> O.S. Linux > MA> Mysql : compiled the most recent stable 4.0.12 > MA> Php was compiled by SuSe on SuSe 8.0 > MA> Php is connected into mysql via socks (configured on /etc/php.ini) > > MA> to test the set up i have used the php.net manual example to > connect into the MA> mysql database i manage to connect into mysql > but i cannot select the database MA> can this be my mistake or can > it be a software problem ? > > MA> here is the php programa > > MA> MA> $DB_HOST = "localhost"; > MA> $DB_USER = "myuser"; > MA> $DB_PASSWORD = "mypassword"; > MA> $DB_NAME = "mydatabase"; > > MA> /* Connecting, selecting database */ > MA> $link = mysql_connect("$DB_HOST", "$DB_USER", "$DB_PASSWORD") > or MA> die("Could not connect"); MA> print "Connected successfully"; > MA> mysql_select_db("$DB_NAME", $link) or die("Could not select > MA> database"); > > MA> /* Performing SQL query */ > MA> $query = "SELECT * FROM tb_users"; > MA> $result = mysql_query($query) or die("Query failed"); > > MA> /* Printing results in HTML */ > MA> print "\n"; > MA> while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { > MA> print "\t\n"; > MA> foreach ($line as $col_value) { > MA> print "\t\t$col_value\n"; > MA> } > MA> print "\t\n"; > MA> } > MA> print "\n"; > > MA> /* Free resultset */ > MA> mysql_free_result($result); > > MA> /* Closing connection */ > MA> mysql_close($link); > ?>> > > MA> Stay Happy > MA> Miguel Angelo > MA> --- End of Forwarded Message --- > > Add a call to mysql_error() to find out what mysql does not like. > > mysql_select_db("$DB_NAME", $link) or die("Could not select > database: ".mysql_error().""); > > -- > regards, > Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] detect proxy
Hi Sonjaya, Here is how i detect a proxy / user external ip and internal ip I use the global variable catched by PHP from the web server, the web server that i use is Apache i don't know about your's but it might work. There are tonns of available information here is some that i have debugged If you get a User Browser :$GLOBALS[HTTP_USER_AGENT] External IP : $GLOBALS[REMOTE_ADDR] Internal IP : $GLOBALS[HTTP_X_FORWARDED_FOR] Proxy : $GLOBALS[HTTP_VIA] Please notice that you might get all, same or partial information from the user i think the only one that you can trust 100% is the External IP since this is basic TCP/IP all the rest might be empty or with invalid values. Microsoft ISA proxy at my job for example does not foward the internal user IP. try something print_r($GLOBALS)to check out all the avaliable informations you could do something like this if ( $GLOBALS[HTTP_VIA] == "" ) { echo "User Proxy is Not Available "; } else { echo "User Proxy: $GLOBALS[HTTP_VIA] "; } Hope this help you ! Stay happy Miguel Angelo From: sonjaya <[EMAIL PROTECTED]> To: php-general <[EMAIL PROTECTED]> Date: Wed, 28 May 2003 18:02:26 +0700 Subject: detect proxy dear milist any body now script to detect browser also ip event using proxy public or high anonymous .thank's -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Scandir Question
Hi All, I have a little question, i would like to load up a array with the file list of a virtual directory... example http://my_server/my_directory I have seen the scandir function and it looks great, but i would prefer load the thing using the virtual directory not the real directory Is there any way to do this ?, or must i use the fisical directory ??? THankx for reading Stay happy Miguel Angelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] interact with .htaccess
Hi People That is a very good idea, i was thinking about using something similar on a file sharing area... But James, do you know how can we use this to build pages i mean include images on a html pages on a restricted way kind like Do you know how i can safely restrict file acess and still link this files into a html page, this would for example allow showing a album of photos to some users but not all site users. By the way i'm building a new personal web page and will share the code in a open source i think it would be good for newbies like me Thankx any way Miguel From: James Hicks <[EMAIL PROTECTED]> To: " Peter Berglund" <[EMAIL PROTECTED]> Date: Sun, 15 Jun 2003 10:55:33 -0400 CC: [EMAIL PROTECTED] Subject: Re: [PHP] Re: interact with .htaccess I think what you really want to do is place your downloadable files in a directory that is not in your httpd's document root and use a password protected PHP script to access these files and send them to the user after authentication. I think you could accomplish this with the fpassthru() function and the correct header. htaccess is just going to get in your way. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Building a save photo album
Hi People I need to build a secure photo album, in a way where only some autenticated users can see the images and the images thumbnails. Some people have given idear to put the images/file directory outside of the web server documents, but how can i then insert the images thumbnails on html page... similar to How can i do this ? or is there any other thing that i can do under php to prevent this ? Thankx people Miguel Angelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Building a save photo album
Hi Again, I forgot to informe you, i already have the user autentication part working ok, i know if the user has permissions to view/user something via one serialized variable which defines is running permissions, and the user is autenticated using a mysql database Thankx again Hi People I need to build a secure photo album, in a way where only some autenticated users can see the images and the images thumbnails. Some people have given idear to put the images/file directory outside of the web server documents, but how can i then insert the images thumbnails on html page... similar to How can i do this ? or is there any other thing that i can do under php to prevent this ? Thankx people Miguel Angelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Security Advisory: Vulnerability in PHP versions 4.2.0and 4.2.1
On Mon, 22 Jul 2002, Greg Donald wrote: > Not only did I get to re-write all my apps the past few months because of > the new register_globals default that was imposed by `the php group`... You didn't have to. The choice was given to you, for your own good. If you have very disciplined programmers and a solid auditing process, you can still do just fine with register_globals on. > Now I get to upgrade my PHP install once a month or so cause of new > security holes.. Yay! Vastly preferable to the alternative: Brand X, where security holes go unpatched. The PHP group fixed the problem immediately. > Wasn't this new register_globals setting supposed to enhance security? Now there's a non-sequitur if ever I saw one. "What do you mean I have to stop running across the freeway? I thought giving up smoking was supposed to enhance my health." > How would you like to be a sys admin with dozens of machines to upgrade > before you can proceed with anythign else? I upgraded dozens of machines. It took about 10 minutes total. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pine config
On Fri, 19 Jul 2002, Michael Hall wrote: > This is sort of off topic, but can anyone tell me why my Pine email client > displays "To: Somebody Or Other" rather than my name "Michael Hall" > whenever I send an email to this list? > > I have attempted to fix this many times but cannot for the life of me > figure out why it is happening. It's doing this as a favor to you. If it displayed the "From" you'd know less about the message than you know this way. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Special Characters In url
On Tue, 23 Jul 2002, Ricky wrote: > I am having problems passing variables in a url specifically when there is > an & sign. Any suggestions? There is a special function just for you. http://php.net/urlencode miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comma question
On Mon, 22 Jul 2002, B i g D o g wrote: > I figured that the comma was to concatenate but is was wondering if the > parser handled it different. The comma isn't actually for concatenation. The net effect is the same in this case, but a very different thing is happening. echo "hello " , "there"; Here 'echo' is printing two separate arguments. First it is printing "hello " and then it is printing "there". echo "hello " . "there"; Here the strings are concatenated to form a single string ("hello there") and then this is processed by echo which prints it out. The effects are the same, as I said, but it's important to realize why they're very different ways of getting that effect. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Doing an HTML POST using header()
On Mon, 22 Jul 2002, Francis wrote: > I'm trying to redirect to another website but doing a post to that website > at the same time. (ie POST rather than a GET (eg: header("Location: > www.anothersite.com/index.php?page=22"); ) > > How do you do an HTML post using the header() whats the syntax? I just cant > find it anywhere. You can't. If you want to do a post, either construct the request yourself, use one of the many free classes created to do so, or use the cURL library. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: HTML E-mails
On Sun, 21 Jul 2002, Richard Lynch wrote: > Actually, though, when my clients insist on HTML email, I just tell > them: "No. If you want that feature, you'll have to hire somebody else > to do it. I've already explained why." I don't think I've lost a > single client that way -- Every one of them has re-considered my advice, > and outright refusal, and decided maybe I *do* know what the hell I'm > talking about. YMMV. I agree with everything you say. Furthermore, I think that when I'm being paid for my expertise, I have a specific responsibility to stop people from doing stupid things, even if they do happen to really want them. There is no honor - and in the long term, no future - in casting aside my better judgment because I once read that "the customer is always right." miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inline Images ?
On Sun, 21 Jul 2002, Roberto Ramírez wrote: > Is there a way to display an image withouth sending the headers first? You have to send the header - that's how the browser knows what sort of image it is. > I'm trying to display an inline image... but when I try it just only > send the raw image data... > > I've thinking that I need to save an image first to disk and then > display the image later... That's not necessary. Hi there. Here is an image: "; ?> miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirecting after login
On Mon, 22 Jul 2002, Tim Thorburn wrote: > A site I'm working on requires a login screen where various individuals > will log into the site and add information for their various > departments. Rather than setup a different script for each department, I > was hoping to create one script that would either accept or deny a login > based on the username/password stored in a database, then based on the > username/password - redirect the individuals browser to a URL. > > I've got the login part working perfectly, and I can turn the URL into a > link on the page, but I'd rather have the script just automatically forward > the person to the page they're login gives them access to. > > I've tried using header(), but since the redirection takes place about > mid-script, it doesn't work. I've also tried using tag redirects, > but those don't seem to accept the PHP/MySQL combo. Once they've been redirected, can they just bookmark the resulting page and never have to log in again? miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script executing Telnet Shell Command...
On Mon, 22 Jul 2002, Kondwani Spike Mkandawire wrote: > I am trying to execute a Script running a telnet command > testing through a range of IP connections... > Here goes: > > $str = "123.456.789."; > $count = 0; > > while ($count < 999){ > $runTheScriptCommand... > } > ?> > > What I want to stick into the while loop is if connection > was successful, break... Is there a way I can check whether > telnet connection was successful on each step through the > loop or do I have to restructure my program and try > connecting to a port via fsockopen... By the way > does anyone know what port number telnet connects to... Telnet is port 23, and the protocol is more complicated than you might think. Perhaps you could look into using 'expect' (a unix utility) to control your telnet session. That might bring you less heartache in the long run. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: HTML E-mails
On Tue, 23 Jul 2002, Manuel Lemos wrote: > On 07/23/2002 02:40 AM, Miguel Cruz wrote: >> On Sun, 21 Jul 2002, Richard Lynch wrote: >>> Actually, though, when my clients insist on HTML email, I just >>> tell them: "No. If you want that feature, you'll have to hire >>> somebody else to do it. I've already explained why." I don't think >>> I've lost a single client that way -- Every one of >>> them has re-considered my advice, and outright >>> refusal, and decided maybe I *do* know what the hell I'm talking about. >>> YMMV. >> >> I agree with everything you say. Furthermore, I think that >> when I'm being paid for my expertise, I have a specific responsibility >> to stop people from doing stupid things, even if they do happen to >> really want them. There is no honor - and in the long term, no >> future - in casting aside my better judgment because I once read that >> "the customer is always right." > > It is good when you can discourage your customers to use a certain wide > spread technology for good reasons and still get paid for that. > > Anyway, would you object to develop a system for a customer where it is > needed to send messages to clients that do not oppose to receive > messages in HTML? If so, why? I have never had a customer say "We have three people, and I personally installed their email client, and I want to develop a web-based system for sending mail to them." What I have heard quite a lot is "We have a growing list of clients and I would like to send mail to all of them." This customer is not served by having a system that sends confusing scrambled-looking messages to their clients. Better everyone has a slightly blander experience than 10% of the users be permanently alienated. If they have a way to definitively determine that users are consistently using HTML-capable MUAs, that's excellent, and I would not discourage them from sending HTML-formatted messages to those users. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] number of files in a dir vs. performace
On Mon, 22 Jul 2002, eat pasta type fasta wrote: > currently I am holding all of the files in 1 directory since the DB can > keep track of them, however their number has grown to over 400 at this > point > > my issue is whether it would be worth it (performance wise) to split them > into thumbs and works thus having 200+ files per directory as opposed to > so many, I am expecting the number of images to double in the future. 400 is not very many. Tens of thousands can start to become a problem. Look at the distribution of your file names and come up with a hashing mechanism. For instance, if your filenames are numbers, create subdirectories 0/ 1/ 2/ 3/ 4/ etc., and place the files based on their final digit. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The page before for newman.
On Thu, 25 Jul 2002, Philip J. Newman wrote: > I'm looking for the global veriable that lists the page before the page > that i just came from. Anyone know what i'm talking about? $_SERVER['HTTP_REFERER'] miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way to log bad email address'
On Thu, 25 Jul 2002, Justin French wrote: > what's the best way to log the bad email address' from a mail() loop? > > >From the manual: > "mail() returns TRUE if the mail was successfully accepted for delivery, > FALSE otherwise." > > Is the definition of "accepted for delivery" dependent on each server, or is > there are general definition of what it means? In almost every case, mail() will return true, regardless of how bogus the destination email address is. mail() just dumps it into the mail queue. There's a lot that goes on between there and delivery, and mail() doesn't wait around. You'll need to catch bounces as they come in. To make life easier, assign your own unique Message-IDs and remember them, so you can easily invalidate addresses. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How do I validate input using php?
On Wed, 24 Jul 2002, Mike Mannakee wrote: > Here's the code I use to validate emails: > > function check_email($email) > { > global $email; > $regex="^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$"; > return eregi($regex, $email, $trash); > } Please search the archives on this topic; it's been covered exhaustively, and each time it comes up we get 25 bad functions and eventually one good one. The above function will bark at valid domains (.museum, etc.) and will allow patently invalid domains (anything containing _). miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Security Advisory: Vulnerability in PHP versions4.2.0
On Wed, 24 Jul 2002, Scott Fletcher wrote: > It work very nicely The whole process take 30 to 45 minutes for just > one server. I wonder how does someone did 12 computers in 10 minutes. > Cool! cd /usr/src/local tar -zxf php-4.2.2.tar.gz cd php-4.2.2 ../php-4.2.1/config.nice make install for i in server1 server2 server3 server4 server5 serverN scp ../apache_1.3.26/src/httpd ${i}:/usr/local/apache/bin/ Most of the time was watching 'make install'. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Security Advisory: Vulnerability in PHP versions4.2.0and 4.2.1
On Tue, 23 Jul 2002, Richard Lynch wrote: > This is excluding support contracts for software you paid for -- Once you > pay Oracle enough money for Support Contracts, they have pretty good > support, from what I hear... :-) They're attentive and responsive and about as knowledgeable as you could hope for (definitely not your typical tech support script readers), but the product is so hopelessly complex that it's still easy to stump them. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing upper directory of public_html directory
On Wed, 24 Jul 2002, Justin French wrote: > If your ISP doesn't allow you to use .htaccess files in this way, AND can't > provide you with a directory outside the document root for placing sensitive > files, then I'd recommend switching hosts, because they clearly don't have > an understanding of what you need. It's possible they put each of their customer in a chroot jail, in which case - barring gross mistakes on the part of the customer - keeping the password in a .php file in the docroot is quite secure. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] control structure question
On Tue, 23 Jul 2002, Javier Montserat wrote: > So refering back, i re-wrote the original example using the switch syntax... > > switch (true) { > case doStep1(): > case doStep2(): > case doStep3(): > error(); > break; > default: > valid(); > } > > Each case expressions is evaluated, until one of them evaluates to a value > equal (==) to the switch expression (in this case a boolean error flag). > > The error() code will only be called if one of the doStep() evaluates to > false. > > And the valid() code will only be evaluated if the switch reached the > default, which means that none of the above check returned false > > I think for this example the switch syntax is more elegant than using a > series of if() statements. That's pretty clever! miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: can there be a fax gateway?
On Wed, 24 Jul 2002, Briggsy wrote: > Altn-N have a product called relayfax which is used with e-mail. You could > use forms to send an email and have realyfax fax it > > www.altn.com They have awesome support for their mailserver MDaemon so I > would say realyfax would be equally as good Also, there's a free volunteer network of fax servers you can read about at: http://www.tpc.int/ Coverage is not universal, and you might get ads on the cover sheet, but I've used it plenty of times over the years (this has been around for a decade or so) and it's served me well. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] pdf to html
On Thu, 25 Jul 2002, David Buerer wrote: > I can think of many reasons why displaying the pdf in the browser is a last > resort and not a first resort. Especially in situations where the reader is > not installed. > > Like Tyler, I would be quite interested to see if anyone has any ideas on > how to convert from pdf to html. It's exceptionally difficult if you want to preserve the graphics. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match() occurence position
On Thu, 25 Jul 2002, lallous wrote: > Yes, I'm aware of the strpos() or any other non-regexp string functions... > > but it is either I use regexp to match a certain pattern or I'll have to > write a char-by-char parser to emulate regexp searching and yet get the > position of the occurence! Once you have found the matching string with preg_match, you can use strpos() to see where it was. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reg exp to remove line feeds before lines starting withwhite space
On Thu, 25 Jul 2002, Nicklas af Ekenstam wrote: > I'm trying to do some parsing of mail headers and since not all > headers follow the pattern: > > X-Header-A: A string > X-Header-B: Another string that is longer > X-Header-C: And this string is very very long compared > > But may very well look like this: > > X-Header-A: A string > X-Header-B: Another string that is > longer > X-Header-C: And this string is very very long > compared I imagine you want something like (untested): $str = preg_replace('/\n[ \t]+/s', ' ', $str); miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] failure notice (fwd)
Is this for real? Rackspace hosts an awful lot of good-hearted people (including myself). Is there a specific reason why the entire ISP's customer base has been blocked from posting to php-general? I guess I have to give up participating on the PHP list... miguel -- Forwarded message -- Date: 27 Jul 2002 19:21:15 - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: failure notice Hi. This is the qmail-send program at stoic.net. I'm afraid I wasn't able to deliver your message to the following addresses. This is a permanent error; I've given up. Sorry it didn't work out. <[EMAIL PROTECTED]>: 216.92.131.4 does not like recipient. Remote host said: 553 209.61.128.0/18 blocked by rackspace.blackholes.us Giving up on 216.92.131.4. --- Below this line is a copy of the message. Return-Path: <[EMAIL PROTECTED]> Received: (qmail 22694 invoked by uid 508); 27 Jul 2002 19:21:11 - Received: from localhost ([EMAIL PROTECTED]) by localhost with SMTP; 27 Jul 2002 19:21:11 - Date: Sat, 27 Jul 2002 14:21:11 -0500 (CDT) From: Miguel Cruz <[EMAIL PROTECTED]> To: Tony Harrison <[EMAIL PROTECTED]> cc: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Date() Problem In-Reply-To: <[EMAIL PROTECTED]> Message-ID: <[EMAIL PROTECTED]> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Sat, 27 Jul 2002, Tony Harrison wrote: > I tried using UNIX stamps but it dont work, and why the hell does it default > to that date anyway? I thought it was supposed to default to the current > time? Be very happy it works the way it does. Since it defaults to an easily-recognizable date and time, you can quickly tell when you've messed up your code. If you don't provide a second argument to date() at all, then it'll default to the current date and time. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP problem
Hi there, I need some help here: 1 - I have a table created on a DB where I insert the data that I want. 2 - I have a submit page to submit the info I want to the DB 3 - I have a page that displays the info from the DB (choosed by id) 4 - I have a page where I have a text box field and a button. When i want to submit some info to database, I give the pretended id (not auto_incremment), for example 11 and the rest of the info. The info is inserted and the id is 11. Now, I want to see the info with the id 11, so I use the page with the text box filed and insert the ID 11. When hit OK, i want to see the info of id 11 displayed on the (for example) info.php page, where ?id=11. If i insert the id 12 and if it exists, I want to see the info displayed on info.php page, where ?id=12. Any soul can give me a possible code to use on the "search" form, in order to see the info displayed on the info.php page?? Thx Miguel
[PHP] What is this??
Hi guys, I was doing a script to insert data on a table, and the following message appeared me when testing the form for data insertion: Column count doesn't match value count at row 1 I lsaw the PHP manual and some other resources that I have, but couldn't find anything about it... Any hint from someone?? Cheers Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is this??
Ok I found the problem. I also had a column on my table and I was not using it, so I deleted her. I had also one more field on my form and forgot to add him to the query. Thx for the hint Best Miguel "Leif K-Brooks" <[EMAIL PROTECTED]> escreveu na mensagem news:3DBCA42E.9070608@;buyer-brokerage.com... > My guess is that you're doing something like "insert into > table(col1,col2,col3) values('val1','val2')". You need to have an equal > ammount of columns and values. > > Miguel Brás wrote: > > >Hi guys, > > > >I was doing a script to insert data on a table, and the following message > >appeared me when testing the form for data insertion: > >Column count doesn't match value count at row 1 > > > >I lsaw the PHP manual and some other resources that I have, but couldn't > >find anything about it... > > > >Any hint from someone?? > > > >Cheers > >Miguel > > > > > > > > > > > > -- > The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Drop down list with date
Hello guys, I have a question: How can I create a drop down menu where the choices are the days of the month, displaying always the next 7 days? What I mean is, create a drop down menu and show the today's date, next day, and next... Example: Today is 12th, then the menu shows the following option to be choosen 12/11/02 13/11/02 14/11/02 15/11/02 16/11/02 17/11/02 18/11/02 Tomorrow 13th will display 13/11/02 14/11/02 15/11/02 16/11/02 17/11/02 18/11/02 19/11/02 and so on... Thx Regards Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Only one value from a msSQL field.
On Wed, 19 Jun 2002, Philip J. Newman wrote: > Only one value from a msSQL field. > I have many values the same in a field and would like to know how i can select one >of each (not mating). > > $sql = "SELECT * FROM brands WHERE 1 ORDER BY `sId` DESC LIMIT 6"; > > lists everything .. I'm not sure I understand your question (samples are always nice), but I'd suggest looking into "GROUP BY" or "SELECT DISTINCT". miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] open a new html page
On Wed, 5 Jun 2002, Renaldo De Silva wrote: > is there a simple way to automatically load a new page according to a > choice made by a user. > > If one persons logs in they go to one page, If another peson logs in they go > to another page? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] global variables without sessions on apache
On Wed, 5 Jun 2002, Zac Hillier wrote: > Is it possible using php on our own apache server to create global > variables for virtual host without having to use session variables. > > We would like to have three variables that are constant for each virtual > host and that are available from every page, I thought it would be possible > with htaccess or http.conf but am struggling to find documentation for it. When you say "that are constant" do you mean that they never change or just that they are the same for each page at any given time? If you need dynamic variables shared between all your pages, you're going to have to either use a database or shared memory as documented at: http://www.php.net/manual/en/ref.sem.php miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stopping multiple votes by IP
On Wed, 5 Jun 2002, Nick Wilson wrote: > The only small problem I see is if a user logs out and then registers as > another user and votes again. I will be verifying emails of memebers so > I think this an unlikely scenario but it still bugs me a little. Any web-based unique-user-identification process that does not involve a human can be fooled. The only exceptions would be if you had access to government-issued unique ID databases, such as passport or tax ID numbers. Nobody else takes the time to uniquely enumerate the population. Therefore the only way you can do it reliably is by looking the person in the eye, listening to their voice, or applying human judgment to the combination of evidence they have transmitted to you electronically. Anything that relies on email, name, credit card number, etc., for ID is doomed to failure in this regard because it's too easy to manufacture or appropriate new identities. Additionally, some of the methods (credit card) are, in addition to being susceptible to spoofing, sufficiently intrusive as to deter participation by legitimate users. So decide how much hassle it's worth making it (both for yourself and for your users) and run with it. My feeling would be that a cookie + email token is enough for anything but high-security or money-based operations; after those measures the amount of hassle rises steeply. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] currency rounding issues
On Thu, 6 Jun 2002, Paul Berg wrote: > I am putting together an app that involves the adding together of rounded > numbers and displaying in a currency format. > The round() function is causing errors of 1 cent to appear after addition. > Does anyone know of any routines that might assist? It would help if you'd provide an example including the numbers you're adding, the result you get, and the desired result. Nevertheless, check out: ceil() floor() number_format() I'm sure you'll find something good in there. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need some suggestions about "community" :)
On Thu, 6 Jun 2002, Hawk wrote: > Just for fun I, and a few friends were going to make a community, started > about an hour ago :) > Haven't started with the design or anything yet, but I was thinking how the > best way to handle users would be, or atleast what you can recommend, first > I thought about having a database with users, and one with messages and > stuff, and then I thought it might be smoother to create a database for each > user, and store all his/her things in it, what do you think? A database for each user doesn't make a lot of sense. A table of users, a table of messages, a table of groups, a table of whatever else... miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remote file information (PHP 4.0)
On Wed, 5 Jun 2002, Erik Fears wrote: > Is there a way, when requesting remote files (using fopen() or file()) to > determine the base directory of the file retrieved? For instance, if I did: > > $file = file("http://www.host.com/directory/php";); > > Several things can happen. One is that theres an actual file named php that > is retrieved. Secondly, php could be a directory and the file index.html is > retrieved from that directory. Or php could be a directory without an index, > in which case a directory listing is generated or something to that effect. > > But what I want to be able to do is to determine what the base directory is > in any case. For instance if php was a file, the base would be > http://www.host.com/directory/, if it was a directory with an index the base > would be http://www.host.com/directory/php. > > Anyone know if this information is available? Not definitively. Sometimes (quite often), if you request something that's a directory, you'll get a 301 redirecting you to the same URL with the slash properly appended. Other than that, you're out of luck. Servers can hand back anything they want in response to any request and there's no need for them to even have a CONCEPT of file vs. directory, let alone tell you about it. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Modifying the sort order of a query
Try a sub-select: SELECT * FROM (SELECT * FROM rap ORDER BY rcountry,rcity,rsname,rfname DESC LIMIT 30 OFFSET 30) ORDER BY whatever; miguel On Wed, 5 Jun 2002, Andre Dubuc wrote: > Apache 1.3.23 + PHP 4.1.2 + PostgreSQL 7.2 > > I have a query that sorts by name, country, and city, then pages in groups of > 30 records. Originally, I had also coded two buttons: "Sort by Country', > 'Sort by City' since I wanted to offer users the options of these choices. > > Unfortunately, these buttons work well, but re-select the whole shebang > (which I guess is to be expected), destroying any paging that had already > started. I've tried all sorts of ways, tried re-arranging the order of > execution, but the result is the same. > > I'm at a loss on how to proceed. I've deleted the choice (for now) and run it > as a simple select order by name query.The problem seems to be: I need a > sub-query select function that retains the original query, simply > re-organizing it according to the new criteria, and retains the original > paging. (Perhaps I shouldn't care whether the paging is messed up as long as > the results are the same.) > > I realize that the way it's set up below, it will automatically send a NEW > query, which is not what I want. I'd like to work with the results of the > original query and modify it with the new criteria > > Any suggestions how I can achieve this, or whether it's even possible? I > would greatly appreciate any assistance or comments. > > >** > > Snippet of offending code: > > > //snippet follows: > > print ""; > print " "; > print ""; > > // more code > > if($_POST['submit'] == "Sort by Name"){ > $query = "SELECT * FROM rap ORDER BY > rsname,rfname,rcountry,rcity,DESC LIMIT 30 OFFSET 30"; > } > elseif($_POST['submit'] == "Sort by Country"){ > $query = "SELECT * FROM rap ORDER BY > rcountry,rcity,rsname,rfname DESC LIMIT 30 OFFSET 30"; > } > > //more code, including paging functions > ?> > > > > > Tia, > Andre > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Values to an image script
On Thu, 6 Jun 2002, Anzak Wolf wrote: > $h=20; > $w=80; > print ""; > > Now this is a much watered down version of what I'm doing, but the idea is > the same. I don't want to put the values I'm passing to the image in the > html code to be passed with a get. I'd like to be able to maybe pass then > in a POST format though I'm not sure how I can do that or if I can. The > other idea I had was to start a session and register $h and $w then when I > start the images script I can connect to the session and get the values form > there though I would have to use Arrays so that I could keep data on many > diff. images. I could pass the array index to the image script which would > index all the array elements needed. The only down side I can see to that > is that I would have to serialize the array vars in order to maintain them > between sessions (index.php and image.php) and I would have a higher over > head on my session code which may impact preformance greatly. Anyone have > any ideas about this as in good idea bad idea, or other suggestions on how > to pass this data without letting the user see it. You don't want them to see it for which reason? 1) It's highly confidential; or 2) It looks ugly; or 3) You don't want casual users messing with it...? If 3, just base64 encode the serialized array of data and most people will leave it alone (it'll just look like a string of random letters and numbers) Posting isn't that useful unless the image is going to show up on its own in the web browser window. Sessions are okay, but once people start using the back button you are going to have some weird side effects. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying images with php?
On Wed, 5 Jun 2002, Ragnar wrote: > no, you did not misunderstand. Thats the way im building the html code for > displaying images now, but in the manual there is a lot of image-functions. > I thought that there maybe was some better way of displaying the images.. The image functions are for building new images or for modifying existing images. If you already have them ready to go sitting in a directory, there's no point messing with anything more complicated than miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and javascript question
On Wed, 5 Jun 2002, Martin Clifford wrote: > As far as I'm aware you can't create a javascript variable and use it > within PHP on the same page. You can add that variable's value to a > hidden form element to be passed to the next page, but I don't think so > with the same page. You're quite right; the PHP executes and terminates before the JavaScript ever starts. If you want to get JavaScript-calculated values back into PHP, you have to pass them back through new requests to the server. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: sorting a list using regex
I completely don't understand what you're trying to say, but I have a sneaking suspicion the usort() functions might be helpful here. miguel On Wed, 5 Jun 2002, Joshua E Minnie wrote: > I am trying to sort a list by their first character, my problem comes when > that first character is a number. When the character is a number I should > be able to display just the values which begin with a number. When the > value is a letter, I have no problem sorting this out. Here is the code > that I am using to determine that, any help will be greatly appreciated. > > [snip] > while(!feof($fp)) { > $artist = fgetcsv($fp,1024,":"); > if(isset($_GET["sort"])) { > if(($_GET["sort"] != substr(strtoupper($artist[0]),0,1)) && > !($_GET["sort"] == "#" && ereg("^[0-9]",$artist[0]))) continue; > } > } > [snip] > ?> > > Running PHP 4.2.1 on IIS 5 W2K > > Thanks > > -josh > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Finding out how a variable was registered
On Wed, 5 Jun 2002, John Taylor-Johnston wrote: > If you change your header to pragma-nocache, he should not be able > to see the source to know what elements he needs for a . There are plenty of browsers (lynx being the obvious example) that will let you see the source regardless of any headers. And when all else fails, there's telnet www.example.com 80. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Modifying the sort order of a query
My understanding was that he wanted to see the same 30 rows, but sorted in a different way. For instance, he wanted to see entries 30-60 as sorted by age, but to have those sorted by height when displayed. miguel On Thu, 6 Jun 2002, Bogdan Stancescu wrote: > That's at least curious - limiting and offsetting will most certainly > affect the results which are then sorted... I don't think that's what he > was after. Just my 2c. > > Bogdan > > Miguel Cruz wrote: > > >Try a sub-select: > > > >SELECT * FROM (SELECT * FROM rap ORDER BY rcountry,rcity,rsname,rfname > >DESC LIMIT 30 OFFSET 30) ORDER BY whatever; > > > >miguel > > > >On Wed, 5 Jun 2002, Andre Dubuc wrote: > > > > > >>Apache 1.3.23 + PHP 4.1.2 + PostgreSQL 7.2 > >> > >>I have a query that sorts by name, country, and city, then pages in groups of > >>30 records. Originally, I had also coded two buttons: "Sort by Country', > >>'Sort by City' since I wanted to offer users the options of these choices. > >> > >>Unfortunately, these buttons work well, but re-select the whole shebang > >>(which I guess is to be expected), destroying any paging that had already > >>started. I've tried all sorts of ways, tried re-arranging the order of > >>execution, but the result is the same. > >> > >>I'm at a loss on how to proceed. I've deleted the choice (for now) and run it > >>as a simple select order by name query.The problem seems to be: I need a > >>sub-query select function that retains the original query, simply > >>re-organizing it according to the new criteria, and retains the original > >>paging. (Perhaps I shouldn't care whether the paging is messed up as long as > >>the results are the same.) > >> > >>I realize that the way it's set up below, it will automatically send a NEW > >>query, which is not what I want. I'd like to work with the results of the > >>original query and modify it with the new criteria > >> > >>Any suggestions how I can achieve this, or whether it's even possible? I > >>would greatly appreciate any assistance or comments. > >> > >>>** > >> > >>Snippet of offending code: > >> > >> >> > >>//snippet follows: > >> > >>print ""; > >>print " "; > >>print ""; > >> > >>// more code > >> > >>if($_POST['submit'] == "Sort by Name"){ > >>$query = "SELECT * FROM rap ORDER BY > >>rsname,rfname,rcountry,rcity,DESC LIMIT 30 OFFSET 30"; > >>} > >>elseif($_POST['submit'] == "Sort by Country"){ > >>$query = "SELECT * FROM rap ORDER BY > >>rcountry,rcity,rsname,rfname DESC LIMIT 30 OFFSET 30"; > >>} > >> > >>//more code, including paging functions > >>?> > >> > >>> > >> > >>Tia, > >>Andre > >> > >> > >> > >> > >> > > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] run from telnet...like PERL?
On Wed, 5 Jun 2002, Robert Packer wrote: > I wrote a script to strip the domain from an e-mail address with PHP. But it > will max out my lousy computer at work. The lists have about 1 million plus > addresses on them... However, a colleague wrote a very similar program with > PERL and ran it from telnet and it went just fine. Can PHP be run in this > fashion? Build or download the standalone binary, and then it works just like Perl (except that you'll want to add -q to the bangpath invocation). miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple email validation ereg
On Mon, 3 Jun 2002, Alexander Skwar wrote: > So sprach Jason Wong am 2002-06-03 um 12:10:29 +0800 : >> The lack of an MX record doesn't necessarily mean mail will not get >> through, so you cannot use that as a test for whether the address is >> valid. > > It will not? Do you have an example? How is a mail server supposed to > know where the mail should be delivered if there's no MX? By looking up the A record. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Search Engine Friend Dynamic Pages
On Thu, 6 Jun 2002, Scott Reismanis wrote: > Just a quick question regarding developing search engine friendly > pages. Basically I am re-writing my site so that say mysite.com? > page=support&action=help becomes mysite.com/support/help/ Reason why is > it looks nicer and is search engine friendly, as some search engines > cannot spider URLS with query strings. > > Anyhow my preferable method of achiving this is having all pages raise > a 404 error, which then loads my custom 404 page which shall output > a "200 ok header" and load the appropiate content. I have heard > somewhere though, that despite overwriting the 404 header, search > engines wont index the page because they think it does not exist... is > this the case? If so I shall use another method, such as one where I > crop the *.php extension off my files and force apache to interpret > them as mime type php. Look at the headers you're sending out. If there's no 404, then the search engine has no possible way of knowing how you handled it on the back end. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date problem
On Thu, 6 Jun 2002, andy wrote: > I would like to count the users out of a mysql db who registered after a > certain date. > > The column I have in the db is a char and I do not want to change this > anymore. > This is how a typical entry looks like: May 29, 2002 > > This is how I tryed it: > > // while '10...' is unix timestamp june 1, 02 > SELECT COUNT(*) AS c > FROM users_table > WHERE UNIX_TIMESTAMP( user_regdate ) > '1022882400' You can only call UNIX_TIMESTAMP on a DATE or DATETIME field, not on just any generic CHAR/VARCHAR/TEXT/whatever. "May 29, 2002" isn't a MySQL timestamp, so I'm guessing you have a textual field type. The lesson of all this is: Convert dates to either unix or database-native date format before storing them in the database. Things like "May 29, 2002" are useless in a database. At this point I'd recommend running a quick script to strtotime() all your dates and then re-write them to a new field that's in a proper format. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] phpSearch
On Thu, 6 Jun 2002, millw0rm wrote: > Hi, I m looking for a Search Engine kinda application which can search > content inside my own website, which includes files like php, text, html & > as well as mySQL db... do u guys hav ne idea where i can find the > application or r there ne1 who can develop it for me pls... i tried few > applications like phpdig, Site Search, phpMySearch but unfortunately now of > them got what I need... neways can u help me out. pls We do all that with mnogosearch (http://www.mnogosearch.ru/). miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Secure File Upload
On Thu, 6 Jun 2002, Christoph Starkmann wrote: > Yes. In fact, i would like to prevent having users upload too > big files. There are two reasons: > First, I don't want my server space to be consumed by files too big. > Second, I want to be able to prevent my (limited) traffic to > be "exhausted". Simple reason: I pay for anything above let's say > 10 GB of traffic. So what PHP offers to me AFAIK enables me to > protect my space, but not my traffic. That's where my question > comes from. Depending on your server environment, you may be able to get the firewall code to drop a connection after a certain amount of traffic in one direction. That would effectively and unceremoniously cut off the rogue uploads. Beyond the scope of this mailing list, though. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrieving text from a URL using PHP
echo strip_tags($contents); miguel On Thu, 6 Jun 2002, Anthony Ritter wrote: > I'm still trying to figure out how to implement the strip_tags() function on > the script below so that the output of the URL is straight text. > > Please advise if you get a chance. > > TR > . > > > > Retrieving text from a URL > > > $theurl="http://www.blah.com";; > if (!($fp=fopen($theurl, "r"))) > { > echo "Could not open the URL"; > exit; > } > $contents= fread($fp, 100); > fclose($fp); > echo "$contents"; > echo ""."This information retrieved from"." href=\"$theurl\">$theurl"."on ".(date("l jS F Y g:i a T")); > ?> > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Combo box selected value...
On Fri, 4 Jan 1980, Alexandra Aguiar wrote: > I got the followin code to generate a combo box... Your clock is off by about 20 years. Is it possible to fix it before posting to the list? Thanks. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Anyone?
Just FYI, I read your previous two messages and decided not to answer them for the following (very subjective) reasons: 1. Your commenting style () made my head hurt. 2. The question was a little too open-ended yet the answer would be very specific. I'm happy to write a long-winded blowhard essay if I think it will contribute to a broad discussion of interest to many people. But when it's just in effect a free programming help service, I tend to take on the terser projects. There are plenty of kind-hearted people who will respond to messages like yours, at least sometimes (when they have enough time, or are waiting for a big compile to finish, or feel guilty about cutting someone off on the freeway this morning and want to earn karma back, or whatever). But it seemed like you were sort of curious as to why you didn't get any response, so there you go. miguel On Thu, 6 Jun 2002, Jas wrote: > I cannot believe that no one with alot of PHP and MySQL experience has not > replied to this post yet. Is PHP not a secure scripting language? I would > really like a little insight into this question, anyone? > > "Jas" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I posted this yesterday and did not get any response at all? Just > wondering > > if someone can give me some insight into some security measures for a > > content management application... > > > > Posted 06/05/2002 > > Ok, I am not a security expert so I would like to know if my security > > measures I have implimented is adequate enough to keep people out. Any > > pointers on this would be very helpful as I am trying to impliment a > secure > > way for people to update a website through the use of a content management > > application. Example of code is as follows > > > > // Login form - index.php > > > > > > > > Select an image to identify yourself as an administrator. > > > > image01 > > image02 > > image03 > > image04 > > image05 > > > > > > > > > > > > // Authentication checker - auth_done.php > > #check fields for valid entries in form > > if ((!$u_name) || (!$p_word) || (!$image)){ > > header("Location: index.php"); > > exit; > > } > > connects to database > > require '/path/to/database/connection/script/dbcon.php'; > > #selects database table containing users that are allowed to > > use application > > $db_table = 'users'; > > $sql = "SELECT * from $db_table WHERE un = \"$user\" AND pw = > > password(\"$pw\")"; > > $result = @mysql_query($sql,$dbh) or die("Couldn't execute query"); > > #loops through all records to find a match > > $num = mysql_numrows($result); > > if ($num !=0) { > > #creates variables for sessions > > $p_hash = "$p_word"; > > $to_hash = "$image"; > > #creates md5 hash of image user selected > > $pstring = md5($to_hash); > > #creates md5 hash of password user entered > > $image_sel = md5(uniqid(microtime($p_word),1)); > > #starts session for user > >session_start(); > > #registers variables created (md5 of password, username, & > > image) in session > >session_register('user'); > >session_register('$pstring'); > >session_register('$image_sel'); > > #captures users ip address (logging stuff, not listed in > this > > code for security reasons) > > $ipaddy = $REMOTE_ADDR; > > #echoes success message to authenticated user > > $msg_success = "You have been authorized to make changes to the > > website! Your IP address has been recorded and sent to the administrator: > > $ipaddy"; > > } else { > > #this prints if user name and password combination is not > > found in database > > print "You are not authorized to use this application!"; > > exit; > > } > > > > Now on each page in the content management app I have these lines of code: > > #Start the session# > > session_start(); > > #check session variables# > > if (isset($HTTP_SESSION_VARS['user'])
Re: [PHP] NEED HELP (passing variable to new page)
1) Why are you using JavaScript to open the window? HTML will do just fine () and will work on all browsers as well as search engines. 2) Your sample page has some password on it and I can't decipher from your message what's actually going on, so without seeing it in action, I'm stumped. miguel On Thu, 6 Jun 2002, Igor Portnoy wrote: > I am having hard time passing the variable to the next page. May be you > can help me. Let me explain: > > > > I am using mySQL database to store information about images (ID, name, > author, description, etc). I am pulling some of the information to > create this (look at the example here: > http://www.gibsonusa.com/test/page/index.php) Now, I want a new window > appear when user clicks on the image. I have achieved it with the > following script: > > > > echo ""; > > echo" function pop1() {"; > > echo" window.open(\"info.php?prod_id=$result[0]\"); }"; \\ $result[0] > is variable that stores id of the image in database > > echo ""; > > > > I am calling this function in the following manner: echo" onclick=\"pop1();\""; > > > > You can see the result if you click on the image. The new page opens > up, BUT the id (product_id in this case) value is not passed to the next > page correctly. If you click on the first or second image on the first > page it shows that the ID is the same for both of them. However if you > look at the source code you can see that the ids are assigned correctly. > The same thing happens if you click on any image that says "no image > available" (I am using different script to generate those). It seems > that the script picks up and stores in the memory the value of an ID of > the last image generated with the script (I don't know if that make > sense). > > > > Oh, by the way the contents of info.php that I am calling in the script > above are as following: > > > $myid = $_GET['prod_id']; > > echo" Product ID: $myid"; > > ?> > > > > What am I doing wrong? Can you help? > > > > Thank you. > > Sorry for lengthy e-mail. > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Trying to list a directory content HELP PLEASE
On Thu, 6 Jun 2002, webmaster mbtradingco wrote: > Hey Scott, that at least helped me to find out what is going wrong. > > When I use the code as you told me... > >$fd=readdir("/home/casapu/paginas /image/caterleras/"); >if (!$fd) die ("Can't read dir"); > > It gives me: > Warning: Supplied argument is not a valid Directory resource in > /home/casapu/paginas/mbt/php/dir.php on line 7 > Can't read dir > > So I'm assuming is not accepting the directory. I have checked the > permits, and it has all enabled, read, write and executable. > I have tried with the final slash, and without it, and so far it keeps > giving me that message... any ideas? Does the directory "paginas " really have a blank space at the end of the name? miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tracking Problem -- Force full script execution?
On Fri, 7 Jun 2002, mike wrote: > I am trying to track every user who visits my site (over 100,000 per > minute..) I don't have an answer, but I'm impressed that you're able to get 144,000,000 hits a day - on par with Yahoo which was previously considered the runaway leader in web traffic volume. That must be some pretty amazing porn. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re[2]: [PHP] Re: strip_tags bug ?
How about if you use htmlentities() and then preg specified tags back into place? That way, the onus for not looking silly falls upon those who use unapproved tags. This would seem like the more conservative approach - and as a security-obsessed paranoid fool, I like conservative approaches. miguel On Fri, 7 Jun 2002, Mikhail Avrekh wrote: > Actually, we allow our users to use HTML tags -- a pretty large set of > tags is allowed in the second argument to strip_tags(). We just want to > strip out and other stuff which has been known to cause problems. > > This is why I was wondering if anyone has a good regexp which can allow > one to provide a set of allowed tags, instead of stripping any and all > HTML and other tags. > > M. > > On Fri, 7 Jun 2002, John Holmes wrote: > > > I don't see why people use strip_tags at all. I would hate posting to a > > forum that will strip tags, esp. if I want to show an example of > > something. > > > > Just use htmlentities() and the data will be shown exactly as the user > > typed it, but none of the HTML or code within it will be evaluated. So > > if the type
Re: [PHP] Re: Search a flat file.
If the file is of a reasonable size (not hundreds of kilobytes), then you can just slurp it all into an array and foreach through it: $matched = 0; $myfile = file('/usr/home/crud/myfile'); foreach ($myfile as $line) { $split_line = explode(':', $line); if ($split_line[1] == 'bob') { echo 'Got a match!'; $matched = 1; break; } } if (!$matched) echo 'Username not found.'; If it's larger, you're doing it an awful lot, or your server is resource-cramped, you'd probably want to fopen() it and loop over fgets() so you don't have to read in any more than necessary. miguel On Fri, 7 Jun 2002, Tom Ray wrote: > ok I believe I follow you on that, I will give that a try. But the > question I have now is how do I loop that request? > > Gaylen Fraley wrote: > > >Use the explode() function based on the colon. Then parse the 2nd array > >element for the username that you want. If matched, display all elements in > >that array row. Conversely you could use the implode() to reassemble the > >array row. > > > >(Assume $file_row is the row name that you have assigned) > > > >/* your code to loop through the file goes here */ > >$your_array = explode(":",$file_row); > >/* remember that arrays start with element 0 */ > >if ($your_array[1]) == "some name" { > >/* routine to display entire row */ > >} > >/* continue processing loop */ > > > >-- > >Gaylen > >PHP KISGB v4.0.5 Guest Book http://www.gaylenandmargie.com/phpwebsite/ > > > >"Tom Ray" <[EMAIL PROTECTED]> wrote in message > >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > >>I want to be able to search a flat file line by line looking for data > >>such as a username then display all the information in that line. Is > >>there some way to search the following format: > >> > >>record1:username:info:info:info > >>record2:username:info:info:info > >>record3:username:info:info:info > >> > >> > >>So if someone submits the username in record two for the search I want > >>it to stop at record two and then display that information... > >> > >>any suggestions? > >> > >> > >> > > > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] restricting files
On Sat, 8 Jun 2002, Justin French wrote: > When you say serve the files through a script, I assume you mean > "download.php" force-feeds an MP3 (or whatever) to the browser. > > Is this correct? > > I read people have lots of problems with this... Only until they get it working (I should hope). We use it for many, many sites and I can't think of any problems it's caused. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing ^M
On Sun, 9 Jun 2002, Michael Hall wrote: > I am trying remove ^M characters (some kind of newline character) from > an HTML file. I've tried all sorts of ereg_replace and sed possibilities > but the things just won't go away. Does anyone have a way of removing > such characters? $str = str_replace("\r", '', $str); miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What are pros and cons of the Apache module verses cgiversion?
On Sat, 8 Jun 2002, Al wrote: > I notice that some webhosts offer the apache module and some the cgi. > > On the surface, the cgi version appears to be a lot of extra hassle. The Apache module runs faster and has smoother integration with the web server. The CGI version allows you to run in different uid contexts, so that users on a shared/multiuser system can be prevented from seeing and messing with each other's files. There are scads of differences, but these seem to be the most salient for most people. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing ^M
'chomp' removes the end-of-line character(s) from its input, which is different from doing an EOL conversion (which is what the OP was after). The result of the below perl would be to concatenate all lines together as one. miguel On Sat, 8 Jun 2002, Chris Knipe wrote: > Perl apparently also works very nice for this > > open (FILE, "filename"): > open (NEWFILE, "filename); > > WHILE () { > chomp; > print NEWFILE $_ > } > > close (FILE); > close(NEWFILE); > > this should take care of ^M > Kind Regards, > > Chris Knipe > MegaLAN Corporate Networking Services > Tel: +27 21 854 7064 > Cell: +27 72 434 7582 > > - Original Message - > From: "Michael Hall" <[EMAIL PROTECTED]> > To: "PHP List" <[EMAIL PROTECTED]> > Sent: Sunday, June 09, 2002 2:40 AM > Subject: [PHP] Removing ^M > > > > > > > > I am trying remove ^M characters (some kind of newline character) from an > > HTML file. I've tried all sorts of ereg_replace and sed possibilities > > but the > > things just won't go away. Does anyone have a way of removing such > > characters? > > > > TIA > > > > Mick > > > > > > > > > > -- > > 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] Removing ^M
I don't think tr expects to receive a filename on the command line. Try: tr -d "\r" < oldfile.html > newfile.html miguel On Sat, 8 Jun 2002, Steve Buehler wrote: > I get this when running that command: > tr: only one string may be given when deleting without squeezing repeats > > > I looked at the tr man pages and it didn't help much. I also tried using > '\r' and `\r` and just \r , but always get the same result. > > Steve > > At 11:07 PM 6/8/2002 +0200, you wrote: > >why not just run > > tr -d "\r" htmlfile.htm > > > > > >- Original Message - > >From: "Michael Hall" <[EMAIL PROTECTED]> > >To: "PHP List" <[EMAIL PROTECTED]> > >Sent: Sunday, June 09, 2002 2:40 AM > >Subject: [PHP] Removing ^M > > > > > > > > > > > > > I am trying remove ^M characters (some kind of newline character) from an > > > HTML file. I've tried all sorts of ereg_replace and sed possibilities > > > but the > > > things just won't go away. Does anyone have a way of removing such > > > characters? > > > > > > TIA > > > > > > Mick > > > > > > > > > > > > > > > -- > > > 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 > > > > > >-- > >This message has been scanned for viruses and > >dangerous content by MailScanner, and is > >believed to be clean. > >ow3 > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to test if rewrite rule is working
On Sat, 8 Jun 2002, Nicole Lallande wrote: > I have created the following htaccess file using rewrite rules for the > purpose of having search engine friendly files created from my dynamic > files. > > RewriteEngine On > RewriteRule ^index-(.*),(.*)\.html$ index.php?section=$1&page=$2 > RewriteRule ^nav-(.*),(.*)\.html$ nav.php?section=$1&page=$2 > > How do I test to see if this is working from a search engine robot > standpoint? I don't see anything in my log files and I don't see that > the URI in the address bar has changed. Am I doing something wrong? This isn't a PHP question. If you don't have the rule do a redirect [R] then you won't see a change in the address bar. The obvious way to test it in any case is to supply a URL like index-1,2.html or whatever and see if you get to the right place. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php