[PHP] sessions
Hi, Im working on a site where the user logs in , if username and password matches with uname and pword in database then he is a valid user. I then start a session with session_onstart() and have a variable for his username and for his permissions ! (these variables are stored on server) Once he entered the secrure area , there is a logoff button for the user to log off ! the logoff code looks like (?php session_start(); $name = session_name(); session_unset(); session_destroy(); setcookie($name,,-3600); print(script language='javascript'self.close();/script); ? ) the above code deletes the cookie on the clients computer + the session variables on the server ! finally , here is my question ! If the user does not logoff , but simply closes the browser , the cookie on his computer will be deleted , but the session variables on the server will still be there ! How do i delete this ? Thanks a bunch ! Shaun -- Novtel Consulting Tel: +27 21 9822373 Fax: +27 21 9815846 Please visit our website: www.novtel.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php list via email
hi there , is there any way to possibly get the list via email ? i can only access it via the newsgroup viewer in outlook and my firewall guy at work persists not to let me have access and you guys are very important to have in the community while i am @ work, not saying i cant do anything my self heh but speaking to you guys is healthy for my development role, which is not the case atm :| -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php list via email
Yes. http://www.php.net/mailing-lists.php electroteque wrote: hi there , is there any way to possibly get the list via email ? i can only access it via the newsgroup viewer in outlook and my firewall guy at work persists not to let me have access and you guys are very important to have in the community while i am @ work, not saying i cant do anything my self heh but speaking to you guys is healthy for my development role, which is not the case atm :| -- 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] syntax question
I'm looking through some existing code for a project I'm working on, but I keep running into this syntax that I really don't understand. Here's an example: $a=strpos($a,'-')?explode('-',$a,2):array($a); What do the ? and the : do here? I'm seeing this sort of thing all over and just have no idea what ? : do. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] syntax question
It's fairly simple. The code you posted could also be written: if(strpos($a,'-')){ $a = explode('-',$a,2); }else{ $a = array($a); } It's called the ternary conditional operator. Unfortunatley, it's buried in the PHP manual. http://us2.php.net/manual/en/language.expressions.php Jimmy wrote: I'm looking through some existing code for a project I'm working on, but I keep running into this syntax that I really don't understand. Here's an example: $a=strpos($a,'-')?explode('-',$a,2):array($a); What do the ? and the : do here? I'm seeing this sort of thing all over and just have no idea what ? : do. Thanks. -- 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
Re: [PHP] language translations on php site
and do my language support according to that. ok thats the next thing i'm going to ask how do you do your language support and how accurate is it ? we run a service for multi-cultures and a dynamic translation from english content would be excellent, i have noticed most of the language moudles only handle predefined messages ??? plus i changed my language settin and it didnt work on the php site Richard Baskett [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Take a look at: http://www.php.net/manual/en/reserved.variables.php and scroll down to the HTTP_ACCEPT_LANGUAGE constant. When you set your language variable within your browser, the HTTP_ACCEPT_LANGUAGE constant can be accessed by $_SERVER['HTTP_ACCEPT_LANGUAGE']. It results in a two letter code, (usually). The way that I do it, is grab the variable and just take the first two letters of the variable and do my language support according to that. Cheers! Rick As I grow to understand life less and less, I learn to live it more and more. - Jules Renard From: electroteque [EMAIL PROTECTED] Date: Thu, 6 Mar 2003 07:46:37 +1100 To: [EMAIL PROTECTED] Subject: [PHP] language translations on php site Set your own language preference [01-Mar-2003] Starting from today, your browser's Accept Language setting is also honored on language sensitive pages on the php.net site. If you would like to get to the documentation page of echo for example, you can use the /echo shortcut on all mirror sites, if your browser is set to provide your language preference information to the server. This also makes the PHP error message links point to the documentation in your preferred language. You can set your preferences under Edit/Preferences/Navigator/Languages in Mozilla, and under Tools/Internet Options/Languages in Internet Explorer. This will probably also enhance your web experience on sites providing translated content. i'm interested how this works , any ideas ? -- 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] php list via email
do i add my email in the subsription box for the ezlm ? if so i have tried it before and never got an email, the others are links to archives and newsservers Leif K-Brooks [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Yes. http://www.php.net/mailing-lists.php electroteque wrote: hi there , is there any way to possibly get the list via email ? i can only access it via the newsgroup viewer in outlook and my firewall guy at work persists not to let me have access and you guys are very important to have in the community while i am @ work, not saying i cant do anything my self heh but speaking to you guys is healthy for my development role, which is not the case atm :| -- 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
Re: [PHP] print $array[$i][0] pukes
Leif, et al -- ...and then Leif K-Brooks said... % % print $i :: {$manilist[$i][0]}\n; Aha! Perfect. Here I'd been trying such things with the leading $ on the *outside* of the braces. Thanks, all, for the help! Back on the 'net after a great all-night storm (which in fact hasn't stopped and is really doing the sheet-of-tin-booming thing), :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] php list via email
Daniel -- ...and then electroteque said... % % hi there , is there any way to possibly get the list via email ? i can only ... Um, yeah. Look at the bottom of every post, including the very one you just made: % -- % PHP General Mailing List (http://www.php.net/) % To unsubscribe, visit: http://www.php.net/unsub.php If accessing via the web doesn't float your boat (like it just plain sinks mine), try the old-fashioned methods. When you get down the list to mailing [EMAIL PROTECTED] you'll get a confirmation response. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP] error checking with fread
add this check John Taylor-Johnston wrote: http://www.php.net/manual/en/function.fread.php What about error checking if the file contains something as I include below? Is that enough? Is this the right way? ?php $filename = /usr/local/something.txt; $handle = fopen ($filename, r); if(!$handle) die('could not open file for reading'); $contents = fread ($handle, filesize ($filename)); fclose ($handle); if ($contents){echoformtextarea$contents/textarea/form;} else{echo no contents there;} ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] input type=file name=txt_file /
Everything you need is here: http://www.php.net/manual/en/features.file-upload.php#features.file-upload.post-method John Taylor-Johnston wrote: Instead of using fread, I want to upload a *.txt file using: input type=file name=txt_file / and display it in a textarea. Where do I go now? Specifically, how do I get $contents? Thanks, John ?php $filename = /usr/local/something.txt; $handle = fopen ($filename, r); $contents = fread ($handle, filesize ($filename)); fclose ($handle); if ($contents){echoformtextarea$contents/textarea/form;} else{echo no contents there;} ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] some help needed building chat-app
If you mean making the client refresh the page after an amount of time, use header('Refresh: 10'); it is in seconds Michiel van Heusden wrote: thanks for your replies the other thing i was trying to ask :) is how to keep on looping and looking for new messages is just a plain loop ok or should i use a timer or whatsoever, i have no clue right now it's a bit like $x = loop; do while ($x == loop) { //mysql_query (select new messages) //output new messages to bottom of html } Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You need only one query with LIMIT, example: //this will select last 10 messages $res=mysq_query('SELECT * FROM chat_messages ORDER BY addtime DESC LIMIT 10'); // this will print them from newer to older while($message=mysql_fetch_array($res)) { echo $message['from'].': '.$message[message'].'br'; } the connection is closed once your script is over (unless you use pconnect), you can not really find out the window has been closed. you don't need to worry about any crash, sql server will take care of this Michiel van Heusden wrote: i'm working on a chat-app which has to be extremely plain and simple mysql is available i tried stripping some of the big scripts, but ended up in a mess so i've ended up building a little app myself i'm just wondering whether i'm using the right principe to get the data refreshed in the chat.. i'm dropping all the messages as records in a mysql-table then i have the php script first printing all the html stuff opening a paragraph and then a loop, querying the mysql, printing the data and querying again is that a way to build this, or are there much better ways? and some other questions: * how can i make sure the db-connection is closed before the user closes the window? * is there any server-side problem with this (say, 100 people log on, and are contineously querying mysql, won't there be some sort of crash?) thanx a lot michiel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessions
The session file will be deleted automatically by the garbage colector after certain amount of time, specified in php.ini by session.gc_maxlifetime Shaun van den Berg wrote: Hi, Im working on a site where the user logs in , if username and password matches with uname and pword in database then he is a valid user. I then start a session with session_onstart() and have a variable for his username and for his permissions ! (these variables are stored on server) Once he entered the secrure area , there is a logoff button for the user to log off ! the logoff code looks like (?php session_start(); $name = session_name(); session_unset(); session_destroy(); setcookie($name,,-3600); print(script language='javascript'self.close();/script); ? ) the above code deletes the cookie on the clients computer + the session variables on the server ! finally , here is my question ! If the user does not logoff , but simply closes the browser , the cookie on his computer will be deleted , but the session variables on the server will still be there ! How do i delete this ? Thanks a bunch ! Shaun -- Novtel Consulting Tel: +27 21 9822373 Fax: +27 21 9815846 Please visit our website: www.novtel.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic link converter
thanks heaps mate http://electroteque.dyndns.org:1023/benchmark/preg.phps here it is with email hyperlinking aswell Nik Makepeace [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, 2003-03-06 at 05:49, electroteque wrote: hi there i am trying tom preg_replace on a string enclosed in brackets to denote a dynamic link This works, if I understand you correctly: ?php $message = [http://www.eletroteque.dyndns.org/index_html.php|Eletroteque Multimedia]; echo $message = preg_replace( /\[((http(s?):\/\/)|(www\.))([\w\.]+)([\/\w+\.]+)\|([\s\w\.]+)\b\]/i, a href=\http\\3://\\4\\5\\6\ target=\_blank\\\7/a, $message ); ? But wouldn't it be easier just to do use a pattern like this /\[([^|]+)\|([^\]]+)/ which gets everything between [ and | (the URI) and | and ] (the link name)? Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] print $array[$i][0] pukes
At 10:44 06.03.2003, David T-G said: [snip] ...and then Leif K-Brooks said... % % print $i :: {$manilist[$i][0]}\n; Aha! Perfect. Here I'd been trying such things with the leading $ on the *outside* of the braces. [snip] Try to see it this way: $manilist[$i][0] is a PHP expression, thus needs to be put in curly braces _as_a_whole_ within a string. It doesn't hurt to use curly quotes even if they're not necessary - it's just the same as with using brackets in expression to clarify operator precedence: with brackets, you don't have to fear any performance impact and gain the clarity of the evaluation sequence; with curly quotes, you gain the correct result :-) -- 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
Re: [PHP] What solution to use for mass newsletter mailing reporting?
In my case the client's list is about 1500 addresses and they send every 2-3 weeks. The client wanted a way to recover if sending failed mid-list -- a way to know where to pick up again. A post to the list described a queuing system similar to the one I built, so check the archives if you end up building one yourself. In my preliminary tests it took much longer to send emails than 250 in 15 seconds! Sending test batches of 100, I got ranges from 27 seconds to 202 seconds, with the average time about 73 seconds for 100 emails. During these tests I was writing a counter to a flat file each time through the loop, which probably slows the process down a little, but I don't think that would account for the dramatic differences in speeds between your tests and mine. About bounce backs -- on the commercial host I'm using, each domain comes with web mail accounts. The default user for the account corresponds to the account username for FTP access. Other usernames/passwords can be added and can receive email at [EMAIL PROTECTED]. By setting up the crontab to execute as a specific user, that user email address is listed in the email header as the return-path and bounced/undeliverable email goes to that user email account. Someone at the client company monitors that address, verifies the bounce, and manually removes the address from the list. Good luck with your project! -- Lowell Allen From: J J [EMAIL PROTECTED] Date: Wed, 5 Mar 2003 16:34:44 -0800 (PST) To: PHP [EMAIL PROTECTED] Subject: Re: [PHP] What solution to use for mass newsletter mailing reporting? Interesting way of tracking everything... and I like the idea of the pop-up being able to query the database for current status. For now, I'm firing off a process with no timeout and it can run even after browser abort... but no real way to check on it other than I send a mailing complete type email with some of the mailing details. I was able to send 250 emails within 15 seconds, so roughly 1000 a minute. Not sure if this is because the server load is light, or the server is just that powerful. Does this seem right??? I'd like to find out more how you handle the bounce backs. Again, thanks for the great information. --- Lowell Allen [EMAIL PROTECTED] wrote: - It takes several minutes to send hundreds of emails, so it's best done in the background. You'll need PHP available to run as a CGI/CLI called from a cron tab. - My solution is part of a content management system. Site administrators create the body of the email from database info. When a user hits the send button, the email is saved to a MySQL table which has fields for Time (time created), ListSize (number of addresses), Invalids (bad address formats), Attempts, and InProgress (an enum field used as a flag). There are lots more fields for storing parts of the message, etc., but that's not important to the approach. There's also a database table for storing the email address list, with fields for Time (same as the message table), Valid (valid format), Failed, Attempted, and TimeAttempted. __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.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
Re: [PHP] some help needed building chat-app
You should understand the concept of php better. The browser request the page, php script prints the messages and closes the conection, the page is displayed. You cannot continue printing out after the conection is closed. So you need to tell the browser to refresh after certain amount of time to get a fresh copy with new messages. Michiel van Heusden wrote: actually it's not as much about refreshing the whole page it's just about refreshing the chat-messages that have been posted so i need some sort of loop that continually seeks for new data and if any, prints them thanks anyway - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Michiel van Heusden [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 11:00 AM Subject: Re: [PHP] some help needed building chat-app If you mean making the client refresh the page after an amount of time, use header('Refresh: 10'); it is in seconds Michiel van Heusden wrote: thanks for your replies the other thing i was trying to ask :) is how to keep on looping and looking for new messages is just a plain loop ok or should i use a timer or whatsoever, i have no clue right now it's a bit like $x = loop; do while ($x == loop) { //mysql_query (select new messages) //output new messages to bottom of html } Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You need only one query with LIMIT, example: //this will select last 10 messages $res=mysq_query('SELECT * FROM chat_messages ORDER BY addtime DESC LIMIT 10'); // this will print them from newer to older while($message=mysql_fetch_array($res)) { echo $message['from'].': '.$message[message'].'br'; } the connection is closed once your script is over (unless you use pconnect), you can not really find out the window has been closed. you don't need to worry about any crash, sql server will take care of this Michiel van Heusden wrote: i'm working on a chat-app which has to be extremely plain and simple mysql is available i tried stripping some of the big scripts, but ended up in a mess so i've ended up building a little app myself i'm just wondering whether i'm using the right principe to get the data refreshed in the chat.. i'm dropping all the messages as records in a mysql-table then i have the php script first printing all the html stuff opening a paragraph and then a loop, querying the mysql, printing the data and querying again is that a way to build this, or are there much better ways? and some other questions: * how can i make sure the db-connection is closed before the user closes the window? * is there any server-side problem with this (say, 100 people log on, and are contineously querying mysql, won't there be some sort of crash?) thanx a lot michiel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get data from 5 tables
To keep those similiar column names apart and more readable, you might want to use AS. SELECT table1.data AS data1, table2.data AS data2 ... FROM table1, table2 ... Of course this is optional, you can always use table1.data, table2.data instead. Hope that answers your actual question as to how you know which data comes from which table. Osman Omar [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ok, how do I know which data come from which table? On Wed, 5 Mar 2003, olinux wrote: SELECT * FROM table1, table2, table3, table4 WHERE id = 1 AND table1.id=table2.id AND table2.id=table3.id AND table3.id=table4.id AND etc. or you can use a JOIN http://www.mysql.com/doc/en/JOIN.html --- Osman Omar [EMAIL PROTECTED] wrote: Hi, How do I query to get data from 5 tables with same id. (id=1). eg, table1 id data 1 blue 2 green table2 id data 1 yellow 3 green table3 id data 1 black 4 white etc. thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] submit button
hi everybody, i have a PHP script by name registration.php in which i have a submit button at the bottom. the form in this script is sent to p.php by GET. but on clicking the submit button, nothing happens attaching registration.php. p.php has only the following: ?php echo hi how are u; ? please help, diksha. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Template engine extension
I have created a simple template engine extension. It is published at http://zhat.dk/template/ It is very simple to install and use, and a PHP alternative (an include file) is also provided. No documentation available yet (sorry!!!), so have a look at the example scripts. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Still having a problem with IF/ELSE Statement
I want to tahnk those that responded to my previous post, seems I was doing this all the wrong way. I am still having an issue with the syntax: if($status=='active'){ echo(active line\n); }else{ echo(inactive line\n); }; When I display an employee record that has the employment status $Row[status] of active, then the active line displays no problem, when I display an employee record of an inactive employee, I still get the active line. I have also tried to do it this way but to no avail: if($Row[status]=='active'){ echo(active line\n); }else{ echo(inactive line\n); }; Not to mention numerous ways of adding/removing/changing double quotes and single quotes around. Any and all help would be greatly appreciated Jess -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] some help needed building chat-app
In theory yes, you can, but you cannot be sure browser will display the content as it receives it. Also your script is affected by maximum execution time. Michiel van Heusden wrote: i understand what you say i was just wondering whether there's an option of just keeping the html open and printing it to the end. like html head/head body p font etc.. ? // start loop //request messages // output to html //loop ? - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Michiel van Heusden [EMAIL PROTECTED]; PHP [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:52 PM Subject: Re: [PHP] some help needed building chat-app You should understand the concept of php better. The browser request the page, php script prints the messages and closes the conection, the page is displayed. You cannot continue printing out after the conection is closed. So you need to tell the browser to refresh after certain amount of time to get a fresh copy with new messages. Michiel van Heusden wrote: actually it's not as much about refreshing the whole page it's just about refreshing the chat-messages that have been posted so i need some sort of loop that continually seeks for new data and if any, prints them thanks anyway - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Michiel van Heusden [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 11:00 AM Subject: Re: [PHP] some help needed building chat-app If you mean making the client refresh the page after an amount of time, use header('Refresh: 10'); it is in seconds Michiel van Heusden wrote: thanks for your replies the other thing i was trying to ask :) is how to keep on looping and looking for new messages is just a plain loop ok or should i use a timer or whatsoever, i have no clue right now it's a bit like $x = loop; do while ($x == loop) { //mysql_query (select new messages) //output new messages to bottom of html } Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You need only one query with LIMIT, example: //this will select last 10 messages $res=mysq_query('SELECT * FROM chat_messages ORDER BY addtime DESC LIMIT 10'); // this will print them from newer to older while($message=mysql_fetch_array($res)) { echo $message['from'].': '.$message[message'].'br'; } the connection is closed once your script is over (unless you use pconnect), you can not really find out the window has been closed. you don't need to worry about any crash, sql server will take care of this Michiel van Heusden wrote: i'm working on a chat-app which has to be extremely plain and simple mysql is available i tried stripping some of the big scripts, but ended up in a mess so i've ended up building a little app myself i'm just wondering whether i'm using the right principe to get the data refreshed in the chat.. i'm dropping all the messages as records in a mysql-table then i have the php script first printing all the html stuff opening a paragraph and then a loop, querying the mysql, printing the data and querying again is that a way to build this, or are there much better ways? and some other questions: * how can i make sure the db-connection is closed before the user closes the window? * is there any server-side problem with this (say, 100 people log on, and are contineously querying mysql, won't there be some sort of crash?) thanx a lot michiel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PEAR problems
Hi, I´ve compiled php-4.2.3 in my Red Hat 8 box and everything is fine. But When I took a look at horde´s test page, It tells me PEAR is OK, Recent PEAR is OK, mail is OK, BD is OK but Log is not OK. And I need that log feature for my webmail (horde + imp). what can I do to fix this? What´s wrong? Thanks, José Manuel Valente [EMAIL PROTECTED] Key ID = 0x4EB0F0BB +55 18 33228400 SRI Tecnologia de Informação -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessions
The session files are removed by the php engine, this is what happens: 1. You load a page, its suffix is php, apache loads php engine to execute it 2. php engines decides if it is time to clean session cache - the probability is taken from session.gc_probability (in %) 3. If yes, it checks each session file's modification time, and if it is old, removes it From this you can see that you need to load some php pages to have a chance to see the files removed. If you want them to be removed for sure, set session.gc_probability to 100 and load a php page. Shaun van den Berg wrote: Hi, sorry i can reply in newsgroups , something is wrong ! Anyway , im doing everything local on my machine , so when i test php in my browser i use apache to interpret it , i changed the php.ini file in my winnt directory - session.gc_maxlifetime to 15 secs (it was 1440) but the session variables in my tmp file (on my machine cause its local, file name is sess_3zdfa4blahblah) still exists after i close my browser without login off and i wait for 15 secondes , but nothing happens ? Whats wrong ! Thanks Shaun - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Shaun van den Berg [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:08 PM Subject: Re: [PHP] sessions The session file will be deleted automatically by the garbage colector after certain amount of time, specified in php.ini by session.gc_maxlifetime Shaun van den Berg wrote: Hi, Im working on a site where the user logs in , if username and password matches with uname and pword in database then he is a valid user. I then start a session with session_onstart() and have a variable for his username and for his permissions ! (these variables are stored on server) Once he entered the secrure area , there is a logoff button for the user to log off ! the logoff code looks like (?php session_start(); $name = session_name(); session_unset(); session_destroy(); setcookie($name,,-3600); print(script language='javascript'self.close();/script); ? ) the above code deletes the cookie on the clients computer + the session variables on the server ! finally , here is my question ! If the user does not logoff , but simply closes the browser , the cookie on his computer will be deleted , but the session variables on the server will still be there ! How do i delete this ? Thanks a bunch ! Shaun -- Novtel Consulting Tel: +27 21 9822373 Fax: +27 21 9815846 Please visit our website: www.novtel.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still having a problem with IF/ELSE Statement
Hi, Thursday, March 6, 2003, 10:31:58 PM, you wrote: HJ I want to tahnk those that responded to my previous post, seems I was doing HJ this all the wrong way. I am still having an issue with the syntax: HJ if($status=='active'){ HJ echo(active line\n); HJ }else{ HJ echo(inactive line\n); HJ }; HJ When I display an employee record that has the employment status HJ $Row[status] of active, then the active line displays no problem, when I HJ display an employee record of an inactive employee, I still get the active HJ line. HJ I have also tried to do it this way but to no avail: HJ if($Row[status]=='active'){ HJ echo(active line\n); HJ }else{ HJ echo(inactive line\n); HJ }; HJ Not to mention numerous ways of adding/removing/changing double quotes and HJ single quotes around. HJ Any and all help would be greatly appreciated HJ Jess You dont need quotes in the if bit just : if($status == 'active'){ echo(active line\n); }else{ echo(inactive line\n); } should work -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP vs. CGI
That depends on the way you run PHP If you run it a a server module, it may be more efficient. If not, then it it less efficient than CGI, as the PHP script engine is a CGI program itself, and has to compile and run your script after it gets started itself. Spyproductions Support Team [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Does PHP use less system resources than CGI on a server? I have a bulletin board which is incredibly active, but there is a PHP sister to it. Thanks, -Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] print $array[$i][0] pukes
Ernest, et al -- ...and then Ernest E Vogelsinger said... % % At 10:44 06.03.2003, David T-G said: % [snip] % ...and then Leif K-Brooks said... % % % % print $i :: {$manilist[$i][0]}\n; % Aha! Perfect. Here I'd been trying such things with the leading $ on % the *outside* of the braces. % [snip] % % Try to see it this way: $manilist[$i][0] is a PHP expression, thus needs to % be put in curly braces _as_a_whole_ within a string. Right. What I hadn't seen before is that $manilist[$i] is NOT evaluated like {$manilist}[$i] but as {$manilist[$i]} and so that's why I was putting the $ outside the {}. Some things about php aren't quite as perl-ish as others :-) Thanks HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
RE: [PHP] submit button
hi everybody, i have a PHP script by name registration.php in which i have a submit button at the bottom. the form in this script is sent to p.php by GET. but on clicking the submit button, nothing happens attaching registration.php. p.php has only the following: ?php echo hi how are u; ? please help, diksha. Can you post the form code? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Checking for empty values sent from a form
Is there an easy way to scan through an array of values sent from a form to see if any of them are empty? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: syntax question
By the way, beware of possibly buggy code: strpos() will return 0 if the string begins with '-', but it will return FALSE if '-' is not found in the string. Since both 0 and FALSE will evaluate to boolean false in your condition, you may get weird results. Use this instead: (strpos($a, '-') !== FALSE) ? Jimmy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm looking through some existing code for a project I'm working on, but I keep running into this syntax that I really don't understand. Here's an example: $a=strpos($a,'-')?explode('-',$a,2):array($a); What do the ? and the : do here? I'm seeing this sort of thing all over and just have no idea what ? : do. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Checking for empty values sent from a form
Since input from a form are strings, you can check like this: if ($_POST['your_input_name'] == '') // field is empty Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there an easy way to scan through an array of values sent from a form to see if any of them are empty? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Checking for empty values sent from a form
thanks for your reply but I was wondering if there was a way to check through all of the form entries with an easier way that if ($_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' ) //etc // field is empty this would be particularly useful for forms with lots of fields... Niels Andersen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Since input from a form are strings, you can check like this: if ($_POST['your_input_name'] == '') // field is empty Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there an easy way to scan through an array of values sent from a form to see if any of them are empty? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] Re: Checking for empty values sent from a form
foreach($HTTP_POST_VARS as $val) if($val==) { do something } - Original Message - From: shaun [EMAIL PROTECTED] To: Sent: Thursday, March 06, 2003 7:45 AM Subject: [PHP] Re: Checking for empty values sent from a form thanks for your reply but I was wondering if there was a way to check through all of the form entries with an easier way that if ($_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' ) //etc // field is empty this would be particularly useful for forms with lots of fields... Niels Andersen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Since input from a form are strings, you can check like this: if ($_POST['your_input_name'] == '') // field is empty Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there an easy way to scan through an array of values sent from a form to see if any of them are empty? -- 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] Re: Checking for empty values sent from a form
You can write a function and when using it in a script insert $HTTP_POST_VARS as the argument: function filled_out($form_vars) { foreach ($form_vars as $key = $value) { if (!isset($key) || ($value == )) { return false; } } return true; } (I think this is from the Welling and Thomson book -- PHP and MySQL Web Development.) -- Lowell Allen From: shaun [EMAIL PROTECTED] Date: Thu, 6 Mar 2003 13:45:52 - To: [EMAIL PROTECTED] Subject: [PHP] Re: Checking for empty values sent from a form thanks for your reply but I was wondering if there was a way to check through all of the form entries with an easier way that if ($_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' ) //etc // field is empty this would be particularly useful for forms with lots of fields... Niels Andersen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Since input from a form are strings, you can check like this: if ($_POST['your_input_name'] == '') // field is empty Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there an easy way to scan through an array of values sent from a form to see if any of them are empty? -- 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] Problem updating
Been on this a couple of hours... anyone see what I'm doing wrong? I get a result of 1 when I echo $result but it doesn't want to update at all. The action of this form index.php?action=update-account is just a switch case Which asks you to use the function update_subscriber_account() below... form method='post' action='index.php?action=update-account' input type='hidden' name='old_id' value='$email' tr th colspan = 2 bgcolor = '#5B69A6' $title /th /tr tr tdReal Name:/td tdinput type = text name='new_realname' maxlength = 100 value ='$realname'/td /tr tr tdPreferred Name:/td tdinput type = text name='new_nickname' maxlength = 100 value ='$nickname'/td /tr tr tdCompany:/td tdinput type = text name='new_company' maxlength = 100 value ='$company'/td /tr tr tdEmail Address:/td tdinput type = text name='new_email' maxlength = 100 value ='$email'/td /tr tr tdRequested Email Format:/td; echo tdselect name='new_mimetype'option; if ($mimetype == 'T') echo selected; echo Text Onlyoption; if ($mimetype == 'H') echo selected; echo HTML/select/td; print /tr tr td colspan=2 align=center; display_form_button('save-changes'); print /td/tr/form/table/centerbr; } } function update_subscriber_account() { db_connect(); $query = update subscribers set email = '$new_email', nickname = '$new_nickname', fullname = '$new_realname', company = '$new_company', mimetype = '$new_mimetype' where email = '$old_id'; $result = mysql_query($query)or die(Error: Could not update queryBR$queryBR.mysql_error()); if (!$result) { echo An error occurred when trying to update the DB; } else { echo $result Successfully updated the details; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Checking for empty values sent from a form
You usually don't want spaces either foreach($_POST as $val) { if(strlen(trim($val)) 1) // do what you want } Rick Emery [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] foreach($HTTP_POST_VARS as $val) if($val==) { do something } - Original Message - From: shaun [EMAIL PROTECTED] To: Sent: Thursday, March 06, 2003 7:45 AM Subject: [PHP] Re: Checking for empty values sent from a form thanks for your reply but I was wondering if there was a way to check through all of the form entries with an easier way that if ($_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' ) //etc // field is empty this would be particularly useful for forms with lots of fields... Niels Andersen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Since input from a form are strings, you can check like this: if ($_POST['your_input_name'] == '') // field is empty Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there an easy way to scan through an array of values sent from a form to see if any of them are empty? -- 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] Problem updating
Is this HTML in a print or echo statement? If not, then the variables will not display. You can View Source to verify this. - Original Message - From: Steve Jackson [EMAIL PROTECTED] To: PHP General [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:27 AM Subject: [PHP] Problem updating Been on this a couple of hours... anyone see what I'm doing wrong? I get a result of 1 when I echo $result but it doesn't want to update at all. The action of this form index.php?action=update-account is just a switch case Which asks you to use the function update_subscriber_account() below... form method='post' action='index.php?action=update-account' input type='hidden' name='old_id' value='$email' tr th colspan = 2 bgcolor = '#5B69A6' $title /th /tr tr tdReal Name:/td tdinput type = text name='new_realname' maxlength = 100 value ='$realname'/td /tr tr tdPreferred Name:/td tdinput type = text name='new_nickname' maxlength = 100 value ='$nickname'/td /tr tr tdCompany:/td tdinput type = text name='new_company' maxlength = 100 value ='$company'/td /tr tr tdEmail Address:/td tdinput type = text name='new_email' maxlength = 100 value ='$email'/td /tr tr tdRequested Email Format:/td; echo tdselect name='new_mimetype'option; if ($mimetype == 'T') echo selected; echo Text Onlyoption; if ($mimetype == 'H') echo selected; echo HTML/select/td; print /tr tr td colspan=2 align=center; display_form_button('save-changes'); print /td/tr/form/table/centerbr; } } function update_subscriber_account() { db_connect(); $query = update subscribers set email = '$new_email', nickname = '$new_nickname', fullname = '$new_realname', company = '$new_company', mimetype = '$new_mimetype' where email = '$old_id'; $result = mysql_query($query)or die(Error: Could not update queryBR$queryBR.mysql_error()); if (!$result) { echo An error occurred when trying to update the DB; } else { echo $result Successfully updated the details; } } -- 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] Problem updating
Hi, Friday, March 7, 2003, 12:27:27 AM, you wrote: SJ Been on this a couple of hours... anyone see what I'm doing wrong? SJ I get a result of 1 when I echo $result but it doesn't want to update at SJ all. SJ The action of this form index.php?action=update-account is just a switch SJ case SJ Which asks you to use the function update_subscriber_account() below... SJ form method='post' action='index.php?action=update-account' SJinput type='hidden' name='old_id' value='$email' SJtr SJ th colspan = 2 bgcolor = '#5B69A6' SJ $title SJ /th SJ/tr SJtr SJ tdReal Name:/td SJ tdinput type = text name='new_realname' maxlength = 100 SJ value ='$realname'/td SJ/tr SJtr SJ tdPreferred Name:/td SJ tdinput type = text name='new_nickname' maxlength = 100 SJ value ='$nickname'/td SJ/tr SJtr SJ tdCompany:/td SJ tdinput type = text name='new_company' maxlength = 100 SJ value ='$company'/td SJ/tr SJtr SJ tdEmail Address:/td SJ tdinput type = text name='new_email' maxlength = 100 SJ value ='$email'/td SJ/tr SJtr SJ tdRequested Email Format:/td; SJ echo tdselect name='new_mimetype'option; SJif ($mimetype == 'T') SJ echo selected; SJecho Text Onlyoption; SJif ($mimetype == 'H') SJ echo selected; SJecho HTML/select/td; SJ print /tr SJ tr SJ td colspan=2 align=center; SJ display_form_button('save-changes'); SJ print /td/tr/form/table/centerbr; SJ } SJ } SJ function update_subscriber_account() SJ { SJ db_connect(); SJ $query = update subscribers SJ set email = '$new_email', SJ nickname = '$new_nickname', SJ fullname = '$new_realname', SJ company = '$new_company', SJ mimetype = '$new_mimetype' SJ where email = '$old_id'; SJ $result = mysql_query($query)or die(Error: Could not update SJ queryBR$queryBR.mysql_error()); SJ if (!$result) SJ { SJ echo An error occurred when trying to update the DB; SJ } SJ else SJ { SJ echo $result Successfully updated the details; SJ } SJ } You will need to use the global vars and also escape quotes like this: function update_subscriber_account() { $new_email = addslashes($_POST['new_email']); . . . $query = update subscribers set email = '$new_email', . . -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Checking for empty values sent from a form[Scanned]
Have you tried echoing out the $query just to ensure that all the expected values are being passed to this? If the old_email field is blank I think it will carry out the update but no rows will be affected. Michael -Original Message- From: Leendert [mailto:[EMAIL PROTECTED] Sent: 06 March 2003 14:24 To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Checking for empty values sent from a form[Scanned] You usually don't want spaces either foreach($_POST as $val) { if(strlen(trim($val)) 1) // do what you want } Rick Emery [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] foreach($HTTP_POST_VARS as $val) if($val==) { do something } - Original Message - From: shaun [EMAIL PROTECTED] To: Sent: Thursday, March 06, 2003 7:45 AM Subject: [PHP] Re: Checking for empty values sent from a form thanks for your reply but I was wondering if there was a way to check through all of the form entries with an easier way that if ($_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' || $_POST['your_input_name'] == '' ) //etc // field is empty this would be particularly useful for forms with lots of fields... Niels Andersen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Since input from a form are strings, you can check like this: if ($_POST['your_input_name'] == '') // field is empty Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there an easy way to scan through an array of values sent from a form to see if any of them are empty? -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem updating
Actually it didn't need the globals, But I did need to pass the variables into the function! Update_subscriber_account($var1, $var2 etc) I feel a right plonker now! Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -Original Message- From: Tom Rogers [mailto:[EMAIL PROTECTED] Sent: 6. maaliskuuta 2003 16:28 To: Steve Jackson Cc: PHP General Subject: Re: [PHP] Problem updating Hi, Friday, March 7, 2003, 12:27:27 AM, you wrote: SJ Been on this a couple of hours... anyone see what I'm doing wrong? I SJ get a result of 1 when I echo $result but it doesn't want to update SJ at all. The action of this form index.php?action=update-account is SJ just a switch case SJ Which asks you to use the function update_subscriber_account() below... SJ form method='post' action='index.php?action=update-account' SJinput type='hidden' name='old_id' value='$email' SJtr SJ th colspan = 2 bgcolor = '#5B69A6' SJ $title SJ /th SJ/tr SJtr SJ tdReal Name:/td SJ tdinput type = text name='new_realname' maxlength = 100 SJ value ='$realname'/td SJ/tr SJtr SJ tdPreferred Name:/td SJ tdinput type = text name='new_nickname' maxlength = 100 SJ value ='$nickname'/td SJ/tr SJtr SJ tdCompany:/td SJ tdinput type = text name='new_company' maxlength = 100 SJ value ='$company'/td SJ/tr SJtr SJ tdEmail Address:/td SJ tdinput type = text name='new_email' maxlength = 100 SJ value ='$email'/td SJ/tr SJtr SJ tdRequested Email Format:/td; SJ echo tdselect name='new_mimetype'option; SJif ($mimetype == 'T') SJ echo selected; SJecho Text Onlyoption; SJif ($mimetype == 'H') SJ echo selected; SJecho HTML/select/td; SJ print /tr SJ tr SJ td colspan=2 align=center; SJ display_form_button('save-changes'); SJ print /td/tr/form/table/centerbr; SJ } SJ } SJ function update_subscriber_account() SJ { SJ db_connect(); SJ $query = update subscribers SJ set email = '$new_email', SJ nickname = '$new_nickname', SJ fullname = '$new_realname', SJ company = '$new_company', SJ mimetype = '$new_mimetype' SJ where email = '$old_id'; SJ $result = mysql_query($query)or die(Error: Could not update SJ queryBR$queryBR.mysql_error()); SJ if (!$result) SJ { SJ echo An error occurred when trying to update the DB; SJ } SJ else SJ { SJ echo $result Successfully updated the details; SJ } SJ } You will need to use the global vars and also escape quotes like this: function update_subscriber_account() { $new_email = addslashes($_POST['new_email']); . . . $query = update subscribers set email = '$new_email', . . -- regards, Tom -- 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] new to PHP
New to php and looking to by this book PHP For the World Wide Web: A Visual QuickStart Guide by Larry Ullman Peachpit Press, April 2001, ISBN 0-201-72787-0, 278 pages The book says it covers PHP version 4.04. I currently have php-4.2.2-8.0.7 running on RH 8.0. Will this book be current enough for me to pick up and learn while using php-4.2.2-8.0.7 or is there a big difference between php version 4.04. and php-4.2.2-8.0.7 Thank you, Juan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem updating[Scanned]
Join the club. I spent some time looking at your original post - submitted a response - but associated it with the wrong thread! Apologies to all! Michael -Original Message- From: Steve Jackson [mailto:[EMAIL PROTECTED] Sent: 06 March 2003 15:00 To: 'Tom Rogers' Cc: 'PHP General' Subject: RE: [PHP] Problem updating[Scanned] Actually it didn't need the globals, But I did need to pass the variables into the function! Update_subscriber_account($var1, $var2 etc) I feel a right plonker now! Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -Original Message- From: Tom Rogers [mailto:[EMAIL PROTECTED] Sent: 6. maaliskuuta 2003 16:28 To: Steve Jackson Cc: PHP General Subject: Re: [PHP] Problem updating Hi, Friday, March 7, 2003, 12:27:27 AM, you wrote: SJ Been on this a couple of hours... anyone see what I'm doing wrong? I SJ get a result of 1 when I echo $result but it doesn't want to update SJ at all. The action of this form index.php?action=update-account is SJ just a switch case SJ Which asks you to use the function update_subscriber_account() below... SJ form method='post' action='index.php?action=update-account' SJinput type='hidden' name='old_id' value='$email' SJtr SJ th colspan = 2 bgcolor = '#5B69A6' SJ $title SJ /th SJ/tr SJtr SJ tdReal Name:/td SJ tdinput type = text name='new_realname' maxlength = 100 SJ value ='$realname'/td SJ/tr SJtr SJ tdPreferred Name:/td SJ tdinput type = text name='new_nickname' maxlength = 100 SJ value ='$nickname'/td SJ/tr SJtr SJ tdCompany:/td SJ tdinput type = text name='new_company' maxlength = 100 SJ value ='$company'/td SJ/tr SJtr SJ tdEmail Address:/td SJ tdinput type = text name='new_email' maxlength = 100 SJ value ='$email'/td SJ/tr SJtr SJ tdRequested Email Format:/td; SJ echo tdselect name='new_mimetype'option; SJif ($mimetype == 'T') SJ echo selected; SJecho Text Onlyoption; SJif ($mimetype == 'H') SJ echo selected; SJecho HTML/select/td; SJ print /tr SJ tr SJ td colspan=2 align=center; SJ display_form_button('save-changes'); SJ print /td/tr/form/table/centerbr; SJ } SJ } SJ function update_subscriber_account() SJ { SJ db_connect(); SJ $query = update subscribers SJ set email = '$new_email', SJ nickname = '$new_nickname', SJ fullname = '$new_realname', SJ company = '$new_company', SJ mimetype = '$new_mimetype' SJ where email = '$old_id'; SJ $result = mysql_query($query)or die(Error: Could not update SJ queryBR$queryBR.mysql_error()); SJ if (!$result) SJ { SJ echo An error occurred when trying to update the DB; SJ } SJ else SJ { SJ echo $result Successfully updated the details; SJ } SJ } You will need to use the global vars and also escape quotes like this: function update_subscriber_account() { $new_email = addslashes($_POST['new_email']); . . . $query = update subscribers set email = '$new_email', . . -- regards, Tom -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] new to PHP
From: juan [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 9:36 AM Subject: [PHP] new to PHP New to php and looking to by this book PHP For the World Wide Web: A Visual QuickStart Guide The book says it covers PHP version 4.04. Will this book be current enough for me Get something newer ... Something at least at 4.1.2, because of changes in register_globals and enhancements. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still having a problem with IF/ELSE Statement
Maybe throw in the code where $status or $Row[status] get initialized. but i would do it like this: if( $status == 'active' ) { echo active line\n; } else { echo inactive line\n; } or if( $Row['status'] == 'active' ) { echo active line\n; } else { echo inactive line\n; } One of those should work based on the code. However, based on the variables $Row and $status that might not be the case. -- Ray On Thu, 2003-03-06 at 05:31, Hunter, Jess wrote: I want to tahnk those that responded to my previous post, seems I was doing this all the wrong way. I am still having an issue with the syntax: if($status=='active'){ echo(active line\n); }else{ echo(inactive line\n); }; When I display an employee record that has the employment status $Row[status] of active, then the active line displays no problem, when I display an employee record of an inactive employee, I still get the active line. I have also tried to do it this way but to no avail: if($Row[status]=='active'){ echo(active line\n); }else{ echo(inactive line\n); }; Not to mention numerous ways of adding/removing/changing double quotes and single quotes around. Any and all help would be greatly appreciated Jess -- 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] PEAR problems
You might want to jump on the horde mailing list seeing that it is an issue with horde and not fully with PEAR. Horde uses PEAR for error and logging capabilities. And there are some really good people on the horde list. -- Ray On Thu, 2003-03-06 at 05:41, José Manuel Valente wrote: Hi, I´ve compiled php-4.2.3 in my Red Hat 8 box and everything is fine. But When I took a look at horde´s test page, It tells me PEAR is OK, Recent PEAR is OK, mail is OK, BD is OK but Log is not OK. And I need that log feature for my webmail (horde + imp). what can I do to fix this? What´s wrong? Thanks, José Manuel Valente [EMAIL PROTECTED] Key ID = 0x4EB0F0BB +55 18 33228400 SRI Tecnologia de Informação -- 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] Uploading file problem
I'm very new to PHP, so I hope no one is offended by reading my very basic questions. I have created a web form that saves some data to a database and uploads three files, copies them to a new directory, and renames them. From my work machine and home machine, it works great for me - there are never any errors. When my boss tries it, two of the files work fine, but the other fails at the copy. I have watched him do it, and it's not user error. What could the problem be? I'm stumped! I can include code or links if needed. Thanks, Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File Download
Hello I have a script that after login gives the user access to one directory. The directory depends on their login. After login a list of files is displayed with a check box in front of each file. Under the list of files there are several buttons, Copy, Delete, Rename, Upload, and Download. When you check a box, and select a a button, lets say copy, you are given a new window to enter the new name. Once entered and you select continue the a copy is made and the list of files is refreshed, displaying also the new file. All the buttons function this way except the download which is where I have problems. I a file management class I have a function for each operation. The code for the download function is as follows: function downloadFile($filename) { $result = ; if(file_exists($this-_memberDir . / . $filename)) { header(Content-type: application/octet-stream); header(Content-Disposition: attachment; filename=$filename); header(Pragma: no-cache); if (!readfile($this-_memberDir . / . $filename)) $result = $filename . successfully downloadedbr; } else { $result = Download Failed for . $filename . , does not existbr; } return $result; } When this function runs, I get the download box that allows the user to select where they want to save there file and a file gets saved. After this code returns the $result should be printed at the top of the browser window and the list of files displayed again. What happens is the results and the list of files, the html code for the next screen, is appended to the end of the file that was downloaded. I can put an exit() inplace of return and I get the correct file size downloaded but I still don't get my screen refreshed. I would think that I should be able to put another header statement after the download to indicate the no more data goes into the file but is to be displayed by the browser. I can't figure out how to get this to work. Thanks David Miller -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Still having a problem with IF/ELSE Statement
Jess, In your statement; if($status=='active'){ the conditional inside quotations is treated as a string and not evaluated, remove the outer double quotes :- hope this helps, Warren Vail [EMAIL PROTECTED] -Original Message- From: Ray Hunter [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:02 AM To: Hunter, Jess Cc: PHP Mailing List Subject: Re: [PHP] Still having a problem with IF/ELSE Statement Maybe throw in the code where $status or $Row[status] get initialized. but i would do it like this: if( $status == 'active' ) { echo active line\n; } else { echo inactive line\n; } or if( $Row['status'] == 'active' ) { echo active line\n; } else { echo inactive line\n; } One of those should work based on the code. However, based on the variables $Row and $status that might not be the case. -- Ray On Thu, 2003-03-06 at 05:31, Hunter, Jess wrote: I want to tahnk those that responded to my previous post, seems I was doing this all the wrong way. I am still having an issue with the syntax: if($status=='active'){ echo(active line\n); }else{ echo(inactive line\n); }; When I display an employee record that has the employment status $Row[status] of active, then the active line displays no problem, when I display an employee record of an inactive employee, I still get the active line. I have also tried to do it this way but to no avail: if($Row[status]=='active'){ echo(active line\n); }else{ echo(inactive line\n); }; Not to mention numerous ways of adding/removing/changing double quotes and single quotes around. Any and all help would be greatly appreciated Jess -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] setting phprc
hi i need to set one directory on my server with global_variables turned on. i'm running apache i've read that by setting the environment variable PHPRC, I can point a directory to a different php.ini file. however, i'm having trouble finding out how to go about doing this. is this something i set within php? or is this an apache variable that i set? any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Connection Broken after fread()
I'm a new php studient. I have downloaded a webmail example that's have a error. When i attach a file in a newmessage, the browser send me a error, On MSIE i receive page not found and on KDE i receive Connection Broken. This occurs after this command: fread($fd, filesize($path)); I have do make a die() before it so isolate it. My question. Why php stop process and dont send a error message ? How to test file read before a error ocurrs ? Thanks in advance -- Edison Goncalez -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is this possible? Group related results from mysql to one field
Hi! Perhaps this is a little bit of topic, but if it's not possible to fix directly when the result is returning from mysql I need some tips on an intelligent solution... This is the problem: I'm searching the database for files and i get some results. In the sql I have a LIMIT to split the result up. Every file can have none, one or several categories associated with it. This is done by having an extra table between the table with the references to the files and the table with the categories. What I want to do is to get all categories associated with an file concatenated and returned in _one_ field together with the other data. Look below for visualisation. I'm having this main table with references to files in it: files +-+-+ | id | filename | +-+-+ |168 |v008-12.jpg| +-+-+ Then I have this table to relate one file to one or several categories: relatedtable +-++--+ |id | fromid | toid | +-++--+ |4| 1 | 2 | | 257 | 2 | 2 | +-++--+ Which lies in this table for categories: categories ++--+ | id | categoryname | stickword ++--+ | 5 | demonstrations | | 6 |people | ++--+ The following sql: SELECT DISTINCT files.id, files.filename, categories.categoryname FROM files LEFT JOIN relatedtable ON files.id = relateratabell.fromid LEFT JOIN kategorier ON relatedtable.toid = categories.id WHERE (relatedtable.fromid IS NULL OR relatedtable.fromid IS NOT NULL) AND files.stickword LIKE '%basta%' //for example ORDER BY filename; Gives the following result: +---+---+--+ | id | filename | categoryname| +---+---+--+ | 166| v007-86.jpg | demonstrations | | 166| v007-86.jpg | people | | 167| v008-03.jpg | demonstrations | | 167| v008-03.jpg | people | +---+---+--+ This is what I expected it to, but I'ld rather get a result as this one: +---+---+--+ | id | filename | categoryname| +---+---+--+ | 166| v007-86.jpg | demonstrations, people| | 167| v008-03.jpg | demonstrations, people| +---+---+--+ Where the categories have been collected together into the same field, so that I don't get multiple rows for the same file Is this possible to achieve? Many many thanks to the one who can give me some input! Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR problems
Thanks! You might want to jump on the horde mailing list seeing that it is an issue with horde and not fully with PEAR. Horde uses PEAR for error and logging capabilities. And there are some really good people on the horde list. -- Ray On Thu, 2003-03-06 at 05:41, José Manuel Valente wrote: Hi, I´ve compiled php-4.2.3 in my Red Hat 8 box and everything is fine. But When I took a look at horde´s test page, It tells me PEAR is OK, Recent PEAR is OK, mail is OK, BD is OK but Log is not OK. And I need that log feature for my webmail (horde + imp). what can I do to fix this? What´s wrong? Thanks, José Manuel Valente [EMAIL PROTECTED] Key ID = 0x4EB0F0BB +55 18 33228400 SRI Tecnologia de Informação -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading file problem
I'm very new to PHP, so I hope no one is offended by reading my very basic questions. I have created a web form that saves some data to a database and uploads three files, copies them to a new directory, and renames them. From my work machine and home machine, it works great for me - there are never any errors. When my boss tries it, two of the files work fine, but the other fails at the copy. I have watched him do it, and it's not user error. What could the problem be? I'm stumped! I can include code or links if needed. Thanks, Amanda From what you say above I'd check the permissions on the 3rd target directory to check if it allows writes by the web server process. Are all 3 files going into the same directory? Is the server *nix or Windows? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 PHP 4.2.2 issues: server keeps working after clientdisconnects, session_start() blocks until other session scripts complete
I can answer my own #2 now. It is because I was trying to start_session() from the same machine/browser and it must require that only one user use a session at a time (duh). Works fine if I use two browsers that are logged in with different account names/sessions. Still working on #1, I am definately sending data all the time during my 2 minute script, so it should be able to detect the connection has closed. But, maybe apache is not configured right Cheers, Mike On Wed, 2003-03-05 at 17:37, Michael Kedl wrote: On Wed, 2003-03-05 at 16:15, Rasmus Lerdorf wrote: Hello all, I have 2 questions that have come up because I have several long reports that can take 1-2 minutes to run. These are run from any web client thru our linux - apache - php - mysql system. 1)server keeps working after client disconnects If a php script is running and it may take 1-3 minutes, and I hit escape or close my web browser window, the script keeps running. I can see it in top, consuming lots of cpu and sometimes ram. Why doesn't apache and the php4.so notice the closed tcp connection and abort the script? Is there a way to make this happen? Yes, this happens by default, but we can only catch it if we try to write something to the socket and get an error back. If you are processing and not outputting anything, there is no way for us to tell. If you are able to write out some sort of progress indicator during your processing then it would work. I am actually looping in the php code: while(!done) { mysql query send some data to the client to see } So this output should trigger the detection that the socket closed? I will try some flushes and make sure it is not caching it till the end later. (but I see the data appear in my browser over the whole 1-3 minutes, so I think it is sending right away) 2)session_start() blocks This sounds odd. session_start() should not be blocking. What sort of backend datastore are you using for your sessions? I just saw someone else post about the same thing! I am just letting it stick directories in /tmp for each session. Thanks! Any more ideas? Mike -- Michael Kedl [EMAIL PROTECTED] -- Michael Kedl [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to redirect form results to different server?
Hello, I've got a form here: http://www.winnefox.org/ccbc.html Which I have running this: form method=get action=http://email.winnefox.org/wals/support/formmail.php; In that form, I also have it redirect the results to: http://www.winnefox.org/form_results.php What I get when I submit the form is this: Notice: Undefined variable: Name (there's one for each line) On that results page, I have this: ?php echo bYour Name:/b $Name br /; ? Any ideas as to what the problem may be? is it possible to make that round trip and have submitted info carry form one server to the other? -- Jody Cleveland ([EMAIL PROTECTED]) Winnefox Library System Computer Support Specialist -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Garbage
Hi, I recently upgraded PHP to version 4.3.1, however I have some problems with it. When I open some PHP files it shouts garbage at me + some html or just a blank screen, when i look at the file on the server nothing has changed, I already tried uploading the files to another location, keep getting the same. Someone who had the same problems and/or can help me? Thanks in advance. Bas Verhoeven -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading file problem
The files go to different directories, but I checked the permissions on all of the directories, and they are all '777'. I am able to upload files, so I think the directory is ok. The server is unix. I am going to ask my boss to send me the files he is trying to upload to see if the files are the problem. If they are, what sort of problems would I look for? On Thu, 6 Mar 2003, Rich Gray wrote: I'm very new to PHP, so I hope no one is offended by reading my very basic questions. I have created a web form that saves some data to a database and uploads three files, copies them to a new directory, and renames them. From my work machine and home machine, it works great for me - there are never any errors. When my boss tries it, two of the files work fine, but the other fails at the copy. I have watched him do it, and it's not user error. What could the problem be? I'm stumped! I can include code or links if needed. Thanks, Amanda From what you say above I'd check the permissions on the 3rd target directory to check if it allows writes by the web server process. Are all 3 files going into the same directory? Is the server *nix or Windows? Rich -- 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] Pages refresh on submission on RedHat Server - POST problem
Its a rather strange thing. I tested all my pages on my Win2000-Apache configuration and uploaded them to my clients RedHat server. There, on submission, all pages just refresh themselves. All my forms are set to submit to the same page and I check in the beginning for the submit button variable. If its set, the form data is processed - else its assumed that its the first time that the page is being viewed. I loaded the pages on another RedHat server and all pages work perfectly there. I experimented a bit and found that if I change the action of forms to GET, they work. But with passwords and file uploads, I cant do that for all pages. Have tried $HTTP_POST_VARS also - doesnt work. Any idea of what could be the problem? If the submit button is named submit_login, I am checking as follows: if ($submit_login ) to see if the form has been submitted. Hve tried isset also. Thanks, Arijit -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to redirect form results to different server?
Jody, on frommail.php: Depending on your version of PHP I would guess you are running PHP 4.2 or greater with register_globals = off. That would create the errors that you are getting: Notice: Undefined variable: Name To get around this error Use this $_GET[Name] this should return the value of name. For your form_results.php You need to do 2 things. 1.) when you reroute from formmail.php to form_results.php you need to include your variable values in the URL string like so. header(Location: http://www.winnefox.org/ form_results.php?Name=urlencode($Name)Add=urlencode($Add)); encodes spaces and special characters for transfer over a URL. http://www.php.net/manual/en/function.urlencode.php Then on your form_results.php page to get the variable type this $Name = urldecode($_GET[Name]); http://www.php.net/manual/en/function.urldecode.php That should enable you to do what you where wanting to do. Jonathan Pitcher On Thursday, March 6, 2003, at 11:30 AM, Jody Cleveland wrote: Hello, I've got a form here: http://www.winnefox.org/ccbc.html Which I have running this: form method=get action=http://email.winnefox.org/wals/support/formmail.php; In that form, I also have it redirect the results to: http://www.winnefox.org/form_results.php What I get when I submit the form is this: Notice: Undefined variable: Name (there's one for each line) On that results page, I have this: ?php echo bYour Name:/b $Name br /; ? Any ideas as to what the problem may be? is it possible to make that round trip and have submitted info carry form one server to the other? -- Jody Cleveland ([EMAIL PROTECTED]) Winnefox Library System Computer Support Specialist -- 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
Fw: [PHP] Pages refresh on submission on RedHat Server - POST problem
You wouldn't by chance be using $PHP_SELF as the action field of the form? - Kevin - Original Message - From: Arijit Chaudhuri [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:56 AM Subject: [PHP] Pages refresh on submission on RedHat Server - POST problem Its a rather strange thing. I tested all my pages on my Win2000-Apache configuration and uploaded them to my clients RedHat server. There, on submission, all pages just refresh themselves. All my forms are set to submit to the same page and I check in the beginning for the submit button variable. If its set, the form data is processed - else its assumed that its the first time that the page is being viewed. I loaded the pages on another RedHat server and all pages work perfectly there. I experimented a bit and found that if I change the action of forms to GET, they work. But with passwords and file uploads, I cant do that for all pages. Have tried $HTTP_POST_VARS also - doesnt work. Any idea of what could be the problem? If the submit button is named submit_login, I am checking as follows: if ($submit_login ) to see if the form has been submitted. Hve tried isset also. Thanks, Arijit -- 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] File Download
have the file download in a popup window. after the down load the window will be gone. Then you don't have to worry about the refreshing of the main window. Jim - Original Message - From: David Miller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:30 AM Subject: [PHP] File Download Hello I have a script that after login gives the user access to one directory. The directory depends on their login. After login a list of files is displayed with a check box in front of each file. Under the list of files there are several buttons, Copy, Delete, Rename, Upload, and Download. When you check a box, and select a a button, lets say copy, you are given a new window to enter the new name. Once entered and you select continue the a copy is made and the list of files is refreshed, displaying also the new file. All the buttons function this way except the download which is where I have problems. I a file management class I have a function for each operation. The code for the download function is as follows: function downloadFile($filename) { $result = ; if(file_exists($this-_memberDir . / . $filename)) { header(Content-type: application/octet-stream); header(Content-Disposition: attachment; filename=$filename); header(Pragma: no-cache); if (!readfile($this-_memberDir . / . $filename)) $result = $filename . successfully downloadedbr; } else { $result = Download Failed for . $filename . , does not existbr; } return $result; } When this function runs, I get the download box that allows the user to select where they want to save there file and a file gets saved. After this code returns the $result should be printed at the top of the browser window and the list of files displayed again. What happens is the results and the list of files, the html code for the next screen, is appended to the end of the file that was downloaded. I can put an exit() inplace of return and I get the correct file size downloaded but I still don't get my screen refreshed. I would think that I should be able to put another header statement after the download to indicate the no more data goes into the file but is to be displayed by the browser. I can't figure out how to get this to work. Thanks David Miller -- 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] Pages refresh on submission on RedHat Server - POST problem
Arijit, Are you clicking on the button or pressing Enter on a field to send the data? AFAIK, if you click, it will set the var. If you just press Enter, it will submit the form, but won't set the var. I personally use a hidden var, and I check for that one. HTH. -- Un gran saludo/Big regards... Arturo Barajas, IT/Systems PPG MX (SJDR) (427) 271-9918, x448 -Original Message- From: Arijit Chaudhuri [mailto:[EMAIL PROTECTED] Sent: Jueves, 06 de Marzo de 2003 11:57 a.m. To: [EMAIL PROTECTED] Subject: [PHP] Pages refresh on submission on RedHat Server - POST problem Its a rather strange thing. I tested all my pages on my Win2000-Apache configuration and uploaded them to my clients RedHat server. There, on submission, all pages just refresh themselves. All my forms are set to submit to the same page and I check in the beginning for the submit button variable. If its set, the form data is processed - else its assumed that its the first time that the page is being viewed. I loaded the pages on another RedHat server and all pages work perfectly there. I experimented a bit and found that if I change the action of forms to GET, they work. But with passwords and file uploads, I cant do that for all pages. Have tried $HTTP_POST_VARS also - doesnt work. Any idea of what could be the problem? If the submit button is named submit_login, I am checking as follows: if ($submit_login ) to see if the form has been submitted. Hve tried isset also. Thanks, Arijit -- 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] strange problem with size of uploaded files..
I've searched all over for the answer to this problem.. but haven't found anything.. I have a script that i use to upload files to a webserver and download them via my phone.. problem is, the files end up being about twice the size of the original file.. for example,i upload a midi that is 22022 bytes, on the server it ends up being 42762 bytes. they are mostly midi and jpeg files.. this has worked fine in for the last 3 or 4 months on a different server. i recently moved my script to my other server and this started happening.. the old server was on linux, Apache/1.3.27 PHP Version 4.3.0 the new server is on linux, Apache/2.0.44 PHP Version 4.3.1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $HTTP_POST_FILES
Nifty. To share my finding ... Thanks, John html head titleUpload File/title /head body C:\WINDOWS\Bureau\microweb\ERIC.TXTbr ?php if(!$userfile){ ? form enctype=multipart/form-data action=uploadintostring.php method=post divRead this file: input name=userfile type=file/div divinput type=submit value=Read File/div /form ?php }else{ # $fh=fopen($_FILES['userfile']['tmp_name'], 'r'); $fh=fopen($HTTP_POST_FILES['userfile']['tmp_name'], 'r'); if(!$fh) { phpinfo(); die('could not open file for reading'); } # $fileContents=fread($fh, filesize($_FILES['userfile']['tmp_name'])); $fileContents=fread($fh, filesize($HTTP_POST_FILES['userfile']['tmp_name'])); fclose($fh); ? h1Upload Results/h1 pYour file contained: ?php echo form\n; echo textarea cols=50 rows=6 nowrap$fileContents/textarea\n; echo /form\n; #echo ($fileContents); ? /p ?php } ? prefile_uploads = 1 upload_max_filesize = 2M upload_tmp_dir = no vlaue HTTP_POST_FILES[userfile] Array ( [name] = ERIC.TXT [type] = text/plain [tmp_name] = C:\WINDOWS\TEMP\phpD3.TMP [size] = 2492 )/pre /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] _FILES
$HTTP_POST_FILES as opposed to $_FILES is older syntax? $HTTP_POST_FILES is still compliant? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pharse file random work with -n lines
Yes I did all what you suggested ! tried all value carrieres and none has a value as well tried print_r($line); and it gives me the last random line number from 10 random line numbers displayed already if I use $line The sdcript dosn't grab the line only the random numbers are ready Can somebody expierenced give advice please, so I can display listed value carrierers. // Code start $i = 0; $fp = fopen (./../../cgi-bin/Classifieds/data/ads.data, r); while($tmp= fgetcsv($fp,5,\|)) { $array[]=$tmp; } fclose ($fp); $rand_array=array_rand($array, 10); foreach($rand_array as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = ($content); echo font face=\Verdana\ size=\1\a href=\../../cgi-bin/Classifieds/classifieds.cgi?session_key=search_and_dis play_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3 /abr$line/font; } // Code end -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading file problem
What do you mean by fails at the copy? Have you verified that the filename and path you're copying to is valid? Otherwise, if the filename that is failing is consistently the same, and if it's attempting to overwrite an existing file, it could be a permissions problem. Just a couple of guesses... mh. On Thu, 6 Mar 2003, Amanda McComb wrote: I'm very new to PHP, so I hope no one is offended by reading my very basic questions. I have created a web form that saves some data to a database and uploads three files, copies them to a new directory, and renames them. From my work machine and home machine, it works great for me - there are never any errors. When my boss tries it, two of the files work fine, but the other fails at the copy. I have watched him do it, and it's not user error. What could the problem be? I'm stumped! I can include code or links if needed. Thanks, Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reading last -n lines array is emty
How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file(data/ads.data); for ($i = count($file); $i count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); print $i a href=\classifieds.cgi?session_key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/a br; }; // Code end
[PHP] reading last -n lines array is emty
How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file(data/ads.data); for ($i = count($file); $i count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); print $i a href=\classifieds.cgi?session_key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/a br; }; // Code end
[PHP] reading last -n lines array is emty
How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file(data/ads.data); for ($i = count($file); $i count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); print $i a href=\classifieds.cgi?session_key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/a br; }; // Code end
[PHP] read -n lines from end of file - Empty array ?
How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file(data/ads.data); for ($i = count($file); $i count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); print $i a href=\classifieds.cgi?session_key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/a br; }; // Code end
Re: [PHP] Uploading file problem
Well, I have a statement that says: if ([EMAIL PROTECTED]($photo, $long_path . speakers/ . $photo_name)) { echo an error }else{ proceed with renaming the file } The error that is echoed after the copy is the one that pops up. So, it could be some other problem, but I'm not sure what to look for. On Thu, 6 Mar 2003, Mark Heintz PHP Mailing Lists wrote: What do you mean by fails at the copy? Have you verified that the filename and path you're copying to is valid? Otherwise, if the filename that is failing is consistently the same, and if it's attempting to overwrite an existing file, it could be a permissions problem. Just a couple of guesses... mh. On Thu, 6 Mar 2003, Amanda McComb wrote: I'm very new to PHP, so I hope no one is offended by reading my very basic questions. I have created a web form that saves some data to a database and uploads three files, copies them to a new directory, and renames them. From my work machine and home machine, it works great for me - there are never any errors. When my boss tries it, two of the files work fine, but the other fails at the copy. I have watched him do it, and it's not user error. What could the problem be? I'm stumped! I can include code or links if needed. Thanks, Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading file problem
Well, I have a statement that says: if ([EMAIL PROTECTED]($photo, $long_path . speakers/ . $photo_name)) { echo an error }else{ proceed with renaming the file } The error that is echoed after the copy is the one that pops up. So, it could be some other problem, but I'm not sure what to look for. Take out the @ sign so you can see what the PHP error message is. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading last -n lines array is emty
You could do it reading back to front the way you propose but I think it will work much better in a proper for loop. // the number of elements in the array. $num_lines = count($file); // the line we want to start the loop at. if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; // loop through the array for ($i=$start_line; $i$num_lines; $i++) { echo Line #$i.\n; //do your work here.. } Hope that helps. Also please don't spam the list. Check your email program make sure you're sending out only one copy. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 3:24 PM Subject: [PHP] reading last -n lines array is emty How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file(data/ads.data); for ($i = count($file); $i count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); print $i a href=\classifieds.cgi?session_key=search_and_display_db_button=ondb_id=$a dnrquery=retrieval\ target=\_blanko\$Endzwei $End3/a br; }; // Code end -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading file problem
On Friday 07 March 2003 03:28, Amanda McComb wrote: Well, I have a statement that says: if ([EMAIL PROTECTED]($photo, $long_path . speakers/ . $photo_name)) { echo an error }else{ proceed with renaming the file } The copy() function allows you to specify a destination filename so there is no need for the extra step of renaming the file. -- 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 -- /* People usually get what's coming to them ... unless it's been mailed. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: _FILES
Yes, $HTTP_POST_FILES is depricated, but it still works in PHP 4. John Taylor-Johnston [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] $HTTP_POST_FILES as opposed to $_FILES is older syntax? $HTTP_POST_FILES is still compliant? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help me
Do You Know java mail list? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading file problem
Thanks!! I'll give that a try! On Thu, 6 Mar 2003, 1LT John W. Holmes wrote: Well, I have a statement that says: if ([EMAIL PROTECTED]($photo, $long_path . speakers/ . $photo_name)) { echo an error }else{ proceed with renaming the file } The error that is echoed after the copy is the one that pops up. So, it could be some other problem, but I'm not sure what to look for. Take out the @ sign so you can see what the PHP error message is. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: read -n lines from end of file - Empty array ?
$file = file('filename'); $line = end($file); for ($i=0; $line $i10;$++) { list (. and so on... $line = prev($file); } Webdev [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file(data/ads.data); for ($i = count($file); $i count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); print $i a href=\classifieds.cgi?session_key=search_and_display_db_button=ondb_id=$a dnrquery=retrieval\ target=\_blanko\$Endzwei $End3/a br; }; // Code end -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pages refresh on submission on RedHat Server - POST problem
You wouldn't by chance be using $PHP_SELF as the action field of the form? I am - though not by using $PHP_SELF but using the same file name in action - holds for all my files. Any way to get around it? Have not got this problem on any other server earlier. Thanks, Arijit Kevin Stone [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You wouldn't by chance be using $PHP_SELF as the action field of the form? - Kevin - Original Message - From: Arijit Chaudhuri [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:56 AM Subject: [PHP] Pages refresh on submission on RedHat Server - POST problem Its a rather strange thing. I tested all my pages on my Win2000-Apache configuration and uploaded them to my clients RedHat server. There, on submission, all pages just refresh themselves. All my forms are set to submit to the same page and I check in the beginning for the submit button variable. If its set, the form data is processed - else its assumed that its the first time that the page is being viewed. I loaded the pages on another RedHat server and all pages work perfectly there. I experimented a bit and found that if I change the action of forms to GET, they work. But with passwords and file uploads, I cant do that for all pages. Have tried $HTTP_POST_VARS also - doesnt work. Any idea of what could be the problem? If the submit button is named submit_login, I am checking as follows: if ($submit_login ) to see if the form has been submitted. Hve tried isset also. Thanks, Arijit -- 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] read -n lines from end of file - Empty array ?
On Friday 07 March 2003 06:25, WebDev wrote: How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file(data/ads.data); for ($i = count($file); $i count($file) - 10; $i--) foreach($i as $line) { foreach() works on an array, $i is not an array. If you have error reporting on you would have caught this. In any case if you're using an outer for-loop as you're doing here then there is no need for a foreach(). OK, you can try this: $file = file(data/ads.data); for ($i = 1; $i = 10; $i++) { $line = array_pop($file); // the following have been copied verbatim from your post list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $line); print $i a href=\classifieds.cgi?session_key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/a br; } ** Untested, use with caution ** -- 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 -- /* No wonder you're tired! You understood so much today. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pages refresh on submission on RedHat Server - POST problem
You wouldn't by chance be using $PHP_SELF as the action field of the form? I am - though not by using $PHP_SELF but using the same file name in action - holds for all my files. Any way to get around it? Have not got this problem on any other server earlier. Thanks, Arijit Kevin Stone [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You wouldn't by chance be using $PHP_SELF as the action field of the form? - Kevin - Original Message - From: Arijit Chaudhuri [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:56 AM Subject: [PHP] Pages refresh on submission on RedHat Server - POST problem Its a rather strange thing. I tested all my pages on my Win2000-Apache configuration and uploaded them to my clients RedHat server. There, on submission, all pages just refresh themselves. All my forms are set to submit to the same page and I check in the beginning for the submit button variable. If its set, the form data is processed - else its assumed that its the first time that the page is being viewed. I loaded the pages on another RedHat server and all pages work perfectly there. I experimented a bit and found that if I change the action of forms to GET, they work. But with passwords and file uploads, I cant do that for all pages. Have tried $HTTP_POST_VARS also - doesnt work. Any idea of what could be the problem? If the submit button is named submit_login, I am checking as follows: if ($submit_login ) to see if the form has been submitted. Hve tried isset also. Thanks, Arijit -- 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] Help me
On Friday 07 March 2003 03:42, Cavallaro, Vito wrote: Do You Know java mail list? I don't, but I bet google does. -- 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 -- /* Reality is bad enough, why should I tell the truth? -- Patrick Sky */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Php File/Dir Protection
Hello All My application is based on PHP / MySQL. I am using Sessions to validate users before they can access the SIte. I need to use the same login to allow the users to gain access to a secret Dir. This directory is within the webfolder. I have gone through many previous threads and figured out a way. I need to make sure that it is correct: 1. Take the secret dir out of the website and place it on the ISP server i.e. ~/my_web_site/www/secret_dir would be changed to make it ~/my_web_site/www.secret_dir 2. Check if a valid session in the name of a user exists 3. If seesion exists , I would fopen() the file provided the correct file name is passed to the script Thanks Pushpinder Singh Garcha _ Web Architect : www.MasterStream.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading last -n lines array is emty
I again have no values in my list names $adnr, $user, $date, $listed, $hlong, $eins, $zwei, . themn are always emty no matter what I do with your code my code // code start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); echo Line #$i.\n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // Code end - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 11:42 AM Subject: Re: [PHP] reading last -n lines array is emty You could do it reading back to front the way you propose but I think it will work much better in a proper for loop. // the number of elements in the array. $num_lines = count($file); // the line we want to start the loop at. if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; // loop through the array for ($i=$start_line; $i$num_lines; $i++) { echo Line #$i.\n; file://do your work here.. } Hope that helps. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 3:24 PM Subject: [PHP] reading last -n lines array is emty How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file(data/ads.data); for ($i = count($file); $i count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); print $i a href=\classifieds.cgi?session_key=search_and_display_db_button=ondb_id=$a dnrquery=retrieval\ target=\_blanko\$Endzwei $End3/a br; }; // Code end -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php list via email
shit i'm a dope this is the email address [EMAIL PROTECTED], as i access the group via newsgroup i never knew :|, but what i am saying is , as like mysql it is downloading all the messages to my inbox i cannot do this with the php list i can only post, and can only read them in the newsgroup viewer, and also what i'm saying is the firewall dude has blocked newsgroup port access so i cant access it and the fool wont open it up for me. -Original Message- From: David T-G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:53 PM To: PHP General list Cc: electroteque Subject: Re: [PHP] php list via email Daniel -- ...and then electroteque said... % % hi there , is there any way to possibly get the list via email ? i can only ... Um, yeah. Look at the bottom of every post, including the very one you just made: % -- % PHP General Mailing List (http://www.php.net/) % To unsubscribe, visit: http://www.php.net/unsub.php If accessing via the web doesn't float your boat (like it just plain sinks mine), try the old-fashioned methods. When you get down the list to mailing [EMAIL PROTECTED] you'll get a confirmation response. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading last -n lines array is emty
On Friday 07 March 2003 07:09, WebDev wrote: I again have no values in my list names $adnr, $user, $date, $listed, $hlong, $eins, $zwei, . themn are always emty no matter what I do with your code my code $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); That's because you haven't defined $buffer. It looks as if it should be set to $file[$i]. -- 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 -- /* MacDonald has the gift on compressing the largest amount of words into the smallest amount of thoughts. -- Winston Churchill */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php list via email
Dan -- ...and then Dan Rossi said... % % shit i'm a dope this is the email address [EMAIL PROTECTED], as i No problem :-) % access the group via newsgroup i never knew :|, but what i am saying is , as No problem! So you don't see the footer at the bottom of everyone else's list posts when they get to your newsgroup? % like mysql it is downloading all the messages to my inbox i cannot do this % with the php list i can only post, and can only read them in the newsgroup % viewer, and also what i'm saying is the firewall dude has blocked newsgroup % port access so i cant access it and the fool wont open it up for me. So ditch news and subscribe to the mailing list and get 'em all in your mailbox. I do :-) HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
[PHP] Help Needed
Hello All I am writing again with reference to my dir Protection PHP script. The scenario is explained below. Whenever a user clicks a particular URL, it triggers a php file which first checks if the user's session exists or not. If the user's session exists, it should fopen() the particular file for him. My question is: after checking for the session, how does the php script know what file to open..meaning what file was linked by that URL. Please help! Pushpinder Singh Garcha _ Web Architect : www.MasterStream.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading last -n lines array is emty
still empty Got the code like you described: // start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split('\|', $line[$i]); echo Line #$i. \n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // end - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: browseabit [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:15 PM Subject: Re: [PHP] reading last -n lines array is emty $buffer is undefined in your code. Do split('|', $line[$i]); - Kevin - Original Message - From: browseabit [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:09 PM Subject: Re: [PHP] reading last -n lines array is emty I again have no values in my list names $adnr, $user, $date, $listed, $hlong, $eins, $zwei, . themn are always emty no matter what I do with your code my code // code start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); echo Line #$i.\n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // Code end - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 11:42 AM Subject: Re: [PHP] reading last -n lines array is emty You could do it reading back to front the way you propose but I think it will work much better in a proper for loop. // the number of elements in the array. $num_lines = count($file); // the line we want to start the loop at. if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; // loop through the array for ($i=$start_line; $i$num_lines; $i++) { echo Line #$i.\n; file://do your work here.. } Hope that helps. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 3:24 PM Subject: [PHP] reading last -n lines array is emty How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file(data/ads.data); for ($i = count($file); $i count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); print $i a href=\classifieds.cgi?session_key=search_and_display_db_button=ondb_id=$a dnrquery=retrieval\ target=\_blanko\$Endzwei $End3/a br; }; // Code end -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A Refreshing Problem
My PHP-based pages intially work, but will not refresh when I go through Microsoft IIS Web Server. The identical PHP-based pages work and refresh correctly when I go through Apache. My environment is . . . Microsoft Windows XP Professional Microsoft IIS Web Server Apache Web Server (on a port other than 80) PHP 4.3.1 I noticed older posts (PHP Bugs: #9232, etc.) about this problem, but can't find a resolution. Any help would be greatly appreciated. * Peter Goldenberg [mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading last -n lines array is emty
No you did not do it as I described. Here's what I wrote: split('|', $line[$i]); Here's what you wrote: split('\|', $line[$i]); See the difference? Remember single quotes denote a literal. You do not have to limit the pipe character when you use single quotes. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:33 PM Subject: Re: [PHP] reading last -n lines array is emty still empty Got the code like you described: // start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split('\|', $line[$i]); echo Line #$i. \n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // end - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: browseabit [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:15 PM Subject: Re: [PHP] reading last -n lines array is emty $buffer is undefined in your code. Do split('|', $line[$i]); - Kevin - Original Message - From: browseabit [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:09 PM Subject: Re: [PHP] reading last -n lines array is emty I again have no values in my list names $adnr, $user, $date, $listed, $hlong, $eins, $zwei, . themn are always emty no matter what I do with your code my code // code start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); echo Line #$i.\n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // Code end - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 11:42 AM Subject: Re: [PHP] reading last -n lines array is emty You could do it reading back to front the way you propose but I think it will work much better in a proper for loop. // the number of elements in the array. $num_lines = count($file); // the line we want to start the loop at. if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; // loop through the array for ($i=$start_line; $i$num_lines; $i++) { echo Line #$i.\n; file://do your work here.. } Hope that helps. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 3:24 PM Subject: [PHP] reading last -n lines array is emty How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file(data/ads.data); for ($i = count($file); $i count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); print $i a href=\classifieds.cgi?session_key=search_and_display_db_button=ondb_id=$a dnrquery=retrieval\ target=\_blanko\$Endzwei $End3/a br; }; // Code end -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
RE: [PHP] Uploading file problem
Thanks!! I'll give that a try! On Thu, 6 Mar 2003, 1LT John W. Holmes wrote: Well, I have a statement that says: if ([EMAIL PROTECTED]($photo, $long_path . speakers/ . $photo_name)) { echo an error }else{ proceed with renaming the file } The error that is echoed after the copy is the one that pops up. So, it could be some other problem, but I'm not sure what to look for. Take out the @ sign so you can see what the PHP error message is. ---John Holmes... Try using move_uploaded_file() as well... Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading last -n lines array is emty
If I remove the / then I get this error Warning: bad regular expression for split() in /home/virtual/browse/home/httpd/html/Classifieds/infobox2.php on line 14 - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:40 PM Subject: Re: [PHP] reading last -n lines array is emty No you did not do it as I described. Here's what I wrote: split('|', $line[$i]); Here's what you wrote: split('\|', $line[$i]); See the difference? Remember single quotes denote a literal. You do not have to limit the pipe character when you use single quotes. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:33 PM Subject: Re: [PHP] reading last -n lines array is emty still empty Got the code like you described: // start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split('\|', $line[$i]); echo Line #$i. \n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // end - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: browseabit [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:15 PM Subject: Re: [PHP] reading last -n lines array is emty $buffer is undefined in your code. Do split('|', $line[$i]); - Kevin - Original Message - From: browseabit [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:09 PM Subject: Re: [PHP] reading last -n lines array is emty I again have no values in my list names $adnr, $user, $date, $listed, $hlong, $eins, $zwei, . themn are always emty no matter what I do with your code my code // code start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); echo Line #$i.\n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // Code end - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 11:42 AM Subject: Re: [PHP] reading last -n lines array is emty You could do it reading back to front the way you propose but I think it will work much better in a proper for loop. // the number of elements in the array. $num_lines = count($file); // the line we want to start the loop at. if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; // loop through the array for ($i=$start_line; $i$num_lines; $i++) { echo Line #$i.\n; file://do your work here.. } Hope that helps. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 3:24 PM Subject: [PHP] reading last -n lines array is emty How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file(data/ads.data); for ($i = count($file); $i count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url,
Re: [PHP] reading last -n lines array is emty
Sorry that should be $file[$i] not $line[$i]. I failed to see your other mistake. Just trust me on the '|' thing. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:44 PM Subject: Re: [PHP] reading last -n lines array is emty If I remove the / then I get this error Warning: bad regular expression for split() in /home/virtual/browse/home/httpd/html/Classifieds/infobox2.php on line 14 - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:40 PM Subject: Re: [PHP] reading last -n lines array is emty No you did not do it as I described. Here's what I wrote: split('|', $line[$i]); Here's what you wrote: split('\|', $line[$i]); See the difference? Remember single quotes denote a literal. You do not have to limit the pipe character when you use single quotes. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:33 PM Subject: Re: [PHP] reading last -n lines array is emty still empty Got the code like you described: // start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split('\|', $line[$i]); echo Line #$i. \n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // end - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: browseabit [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:15 PM Subject: Re: [PHP] reading last -n lines array is emty $buffer is undefined in your code. Do split('|', $line[$i]); - Kevin - Original Message - From: browseabit [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:09 PM Subject: Re: [PHP] reading last -n lines array is emty I again have no values in my list names $adnr, $user, $date, $listed, $hlong, $eins, $zwei, . themn are always emty no matter what I do with your code my code // code start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); echo Line #$i.\n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // Code end - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 11:42 AM Subject: Re: [PHP] reading last -n lines array is emty You could do it reading back to front the way you propose but I think it will work much better in a proper for loop. // the number of elements in the array. $num_lines = count($file); // the line we want to start the loop at. if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; // loop through the array for ($i=$start_line; $i$num_lines; $i++) { echo Line #$i.\n; file://do your work here.. } Hope that helps. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 3:24 PM Subject: [PHP] reading last -n lines array is emty How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i
Re: [PHP] reading last -n lines array is emty
Holy crap looks like I was wrong! I just tested it and sure enough '|' does return an error.. how do you like that. So use split(\|, $file[$i]). - Kevin - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 1:50 PM Subject: Re: [PHP] reading last -n lines array is emty Sorry that should be $file[$i] not $line[$i]. I failed to see your other mistake. Just trust me on the '|' thing. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:44 PM Subject: Re: [PHP] reading last -n lines array is emty If I remove the / then I get this error Warning: bad regular expression for split() in /home/virtual/browse/home/httpd/html/Classifieds/infobox2.php on line 14 - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:40 PM Subject: Re: [PHP] reading last -n lines array is emty No you did not do it as I described. Here's what I wrote: split('|', $line[$i]); Here's what you wrote: split('\|', $line[$i]); See the difference? Remember single quotes denote a literal. You do not have to limit the pipe character when you use single quotes. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:33 PM Subject: Re: [PHP] reading last -n lines array is emty still empty Got the code like you described: // start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split('\|', $line[$i]); echo Line #$i. \n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // end - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: browseabit [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:15 PM Subject: Re: [PHP] reading last -n lines array is emty $buffer is undefined in your code. Do split('|', $line[$i]); - Kevin - Original Message - From: browseabit [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:09 PM Subject: Re: [PHP] reading last -n lines array is emty I again have no values in my list names $adnr, $user, $date, $listed, $hlong, $eins, $zwei, . themn are always emty no matter what I do with your code my code // code start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); echo Line #$i.\n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // Code end - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 11:42 AM Subject: Re: [PHP] reading last -n lines array is emty You could do it reading back to front the way you propose but I think it will work much better in a proper for loop. // the number of elements in the array. $num_lines = count($file); // the line we want to start the loop at. if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; // loop through the array for ($i=$start_line;
[PHP] session_set_save_handler problem
Hi, i just tried the session_set_save_handler script from Sterling Hughes PHP Cookbook, which allows to save the session in a MySQL database. However, i ran into a problem: The script works just fine and also saves the session in the database, but it doesn't update the value of the saved data. I browsed google for additional examples, but only to find out, that the exact same problem appeared. So, my guess is, that my script has some kind of logical error, but i am unable to spot it. Any help is more than welcome (regarding my starting headache ;) ) Here is the script: If the session_set_save_handler function is commented (as seen below), then the script starts the session and continues to display the increasing $counter variable with every page reload. However, once you uncomment the session_set_save_handler function, the session gets saved in the MySQL database, but the counter variable won't increase and always stays at 1. (as i said, i tried this with several scripts already, but all resulted in the same problem) So, i think the problem is either in the on_session_write() part, where the value doesn't increase, or -as already pointed out- i am having a logical error with the $counter variable. ...just to clarify: $counter++; also means that it should be increased in the MySQL database, right? Or would i have to do s.th. else to update the session values in the MySQL database? The script: ? function on_session_start($save_path, $session_name) { // nothing } function on_session_end() { // nothing } function on_session_read($key) { $db = mysql_connect(DB_HOST,DB_USER,DB_PASS); mysql_select_db(DB_DATABASE); if ($db) { $query = mysql_query('SELECT session_data FROM sessions WHERE session_id='.$key.' AND session_expiration now()'); $row = mysql_fetch_row($query); } return $row[0]; mysql_close(); } function on_session_write($key, $val) { $val = addslashes($val); $db = mysql_connect(DB_HOST,DB_USER,DB_PASS); mysql_select_db(DB_DATABASE); if ($db) { $query = mysql_query('INSERT INTO sessions VALUES('.$key.', '.$val.', now() + 3600)'); if (!$query) $queryb = mysql_query('UPDATE sessions SET session_data='.$val.', session_expiration=now()+3600 WHERE session_id='.$key.''); if (!$queryb) die(sprintf($val - $key)); } mysql_close(); } function on_session_destroy($key) { $db = mysql_connect(DB_HOST,DB_USER,DB_PASS); mysql_select_db(DB_DATABASE); if ($db) { mysql_query('DELETE FROM sessions WHERE session_id='.$key.''); } mysql_close(); } function on_session_gc($max_lifetime) { $db = mysql_connect(DB_HOST,DB_USER,DB_PASS); mysql_select_db(DB_DATABASE); if ($db) { mysql_query('DELETE FROM sessions WHERE session_expiration now()'); } mysql_close(); } /* session_set_save_handler('on_session_start', 'on_session_end', 'on_session_read', 'on_session_write', 'on_session_destroy', 'on_session_gc'); */ session_start(); session_register('counter'); $counter++; print $counter; //session_destroy(); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading last -n lines array is emty
Buitiful it works finaly thanks to your help Could you be so nice and as well look what I am doing wrong with the random array display I send it today to the list already again with the lates code it uses the same data file but only random line numbers is all what I get - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:55 PM Subject: Re: [PHP] reading last -n lines array is emty Holy crap looks like I was wrong! I just tested it and sure enough '|' does return an error.. how do you like that. So use split(\|, $file[$i]). - Kevin - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 1:50 PM Subject: Re: [PHP] reading last -n lines array is emty Sorry that should be $file[$i] not $line[$i]. I failed to see your other mistake. Just trust me on the '|' thing. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:44 PM Subject: Re: [PHP] reading last -n lines array is emty If I remove the / then I get this error Warning: bad regular expression for split() in /home/virtual/browse/home/httpd/html/Classifieds/infobox2.php on line 14 - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: WebDev [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:40 PM Subject: Re: [PHP] reading last -n lines array is emty No you did not do it as I described. Here's what I wrote: split('|', $line[$i]); Here's what you wrote: split('\|', $line[$i]); See the difference? Remember single quotes denote a literal. You do not have to limit the pipe character when you use single quotes. - Kevin - Original Message - From: WebDev [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:33 PM Subject: Re: [PHP] reading last -n lines array is emty still empty Got the code like you described: // start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split('\|', $line[$i]); echo Line #$i. \n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // end - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: browseabit [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 12:15 PM Subject: Re: [PHP] reading last -n lines array is emty $buffer is undefined in your code. Do split('|', $line[$i]); - Kevin - Original Message - From: browseabit [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:09 PM Subject: Re: [PHP] reading last -n lines array is emty I again have no values in my list names $adnr, $user, $date, $listed, $hlong, $eins, $zwei, . themn are always emty no matter what I do with your code my code // code start $file = file(data/ads.data); $num_lines = count($file); if ($num_lines 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split (\|, $buffer); echo Line #$i.\n br; print a href=\http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=search_and_display_db_button=ondb_id=$adnrquery=retrieval\ target=\_blanko\$Endzwei $End3/abr; } // Code end - Original Message -
Re: [PHP] reading last -n lines array is emty
Holy crap looks like I was wrong! I just tested it and sure enough '|' does return an error.. how do you like that. So use split(\|, $file[$i]). For a regular expression | means OR. You could use explode(|,$file[$i]) for the sam effect. Benchmark split() vs. explode() and see which is faster... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Modifying a string
I need to modify a string that contains image links like img src=http://www.somedomain/directory/graphics/filename.jpg; to image links like img src=graphics/filename.jpg How can I do this? Luis