[PHP] image button problem
Hi, I am trying to create an HTML form that has several image buttons on it and the resulting action depends on which button is pressed. I first tried using but from IE on the PHP side I only get $_POST['test_x'] and $_POST['test_y'] defined. I therefore don't know which of the buttons on the form was actually pressed. I then tried using the The buttons render fine but when pressed I get $_POST['test'] being the HTML code between the tags and not the value="mytest" that I defined. (In Mozilla I get the result as expected). Is there are a better way of doing this? All I want is to know which button has been clicked on the form. (The form has to be method=POST) Regards, -- Abdul-Wahid Paterson Lintrix Networking & Communications ltd. Web: http://www.lintrix.net/ Tel: +44 20 8904 2348 Email/Jabber: [EMAIL PROTECTED] Web-Hosting | Development | Security | Consultancy | Domains -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image button problem
Hi, > What do you mean you don't know what button was pressed? You have 'test_x' > and 'test_y' so you know the "test" button was pressed. If you give the > other buttons a different name, you'll have different _x and _y variable > names, so you can still tell which one was pressed. Yes, I should have specified more accurately. I have quite a few of these buttons on one page (approx 30) and really wanted to have the same name="" for each one and only the value change. The reasoning for that is most parts of the page are generated from cached content due to heavy processing requirements on making the whole page. It is therefore quite difficult for me to change it to something like a series of name="test1" and name="test2" for all the buttons as the form being POST'd to would have a hard job trying to work out which names were valid for the POSTing form. Regards, AW -- Abdul-Wahid Paterson Lintrix Networking & Communications ltd. Web: http://www.lintrix.net/ Tel: +44 20 8904 2348 Email/Jabber: [EMAIL PROTECTED] Web-Hosting | Development | Security | Consultancy | Domains signature.asc Description: This is a digitally signed message part
Re: [PHP] Re: Encrypt data to base for authentication...
On Tue, 2003-03-18 at 21:14, Scott Fletcher wrote: > Groan, I meant 'Basic' not 'Base'.. > > I am trying to figure out how to encrypt the data using the base only. > > The webserver use the base authentication. I have been searching the PHP > > manual and I only saw base64_encode() but it is not the right algorithm. > > Does anyone know the php function for the Base encryption? In basic authentication the password goes across the network in plain text and the server therefore has a choice in how it stores the password. There are different ways of doing this usually involving a). DES b). md5 both injected with a bit of salt. Different implementations use different amounts of salt etc. Anyway, the function you are looking for is probably crypt: http://uk.php.net/manual/en/function.crypt.php Regards, Abdul-Wahid -- Abdul-Wahid Paterson Lintrix Networking & Communications ltd. Web: http://www.lintrix.net/ Tel: +44 7801 070621 Email/Jabber: [EMAIL PROTECTED] Web-Hosting | Development | Security | Consultancy | Domains signature.asc Description: This is a digitally signed message part
Re: [PHP] How to define a path of download file in header?
On Tue, 2003-03-18 at 23:45, Ruo Zhang wrote: > I use the following headers to force open a download dialog box. However, my > download files are located in other directories/subdirectories. How can I specify a > download path in the header? The 'Content-Location' header does not work in this > case. Can someone please help? > > header("Content-type: application/octet-stream"); > header("Content-Length: $filelength"); > header("Content-Disposition: attachment; filename=$fname;"); > Why don't you do: readfile($filename); straight after your header statements. That will read in the file and pass it straight through to the browser. Regards, AW -- Abdul-Wahid Paterson Lintrix Networking & Communications ltd. Web: http://www.lintrix.net/ Tel: +44 7801 070621 Email/Jabber: [EMAIL PROTECTED] Web-Hosting | Development | Security | Consultancy | Domains signature.asc Description: This is a digitally signed message part
RE: [PHP] random letter/character?[Scanned]
Hi, It is not a good idea to seed the random number generator inside the for loop. It should only be seeded once during the execution of a script. Your function could be susceptible to time attacks as it may not be difficult to guess the seeding pattern and hence guess what random numbers were actually produced (in this case always the first random number in a given sequence). Also, note from the documentation Note: Since PHP 4.2.0 it's no longer necessary to seed the random number generator before using it. Regards, Abdul-Wahid On Wed, 2003-03-19 at 08:30, Michael Egan wrote: > I put together the following function to give me a password consisting of random > letters and numbers. It should be fairly clear as to how you'd need to tweak it to > just give you the characters you'd need interspersed with spaces. > > Hope this helps - I also hope anybody else is fairly gentle with their criticisms > and pointers to whatever is wrong with the script - this is the first time I've > ventured to include something like this in a response to an email on the list :-( > > >function get_password() >{ > // Create the password variable as an array > $temp_password = array(); > // Create an array of the letters of the alphabet > $letters = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", >"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", >"w", "x", "y", "z"); > // Get the first three alpha characters of the password > for($row = 0; $row < 3; $row ++) > { > srand ((double) microtime() * 100); > $rand_number = rand(0, 25); > $letter = $letters[$rand_number]; > array_push($temp_password, $letter); > } > // Get five numeric characters to complete the password > for($row = 0; $row < 5; $row ++) > { > srand ((double) microtime() * 100); > $rand_number = rand(0, 9); > array_push($temp_password, $rand_number); > } > // Convert the array into a single string > for ($row = 0; $row < count($temp_password); $row ++) > { > $password .= $temp_password[$row]; > } > // Return the password to the script that called the function > return $password; >} > > > By the way - I put this together one evening after consuming five pints of Jameson's > with one arm tied behind my back and whilst wearing a blindfold! > > > Michael Egan > > > > -Original Message- > From: Bryan Koschmann - GKT [mailto:[EMAIL PROTECTED] > Sent: 19 March 2003 07:44 > To: PHP General > Subject: [PHP] random letter/character?[Scanned] > > > Hi, > > I need to get a php script to print out a list of random characters. This > is the list: > > a' > b' > c' > d' > e' > f' > g' > a'' > b'' > c'' > d'' > e'' > f'' > g'' > > They would be printed to a maximum of 50 in a row separated by spaces. Can > anyone give me a pointer as to how to do this? Since the rand functions > are only for numbers, maybe assign each character group a number? > > Thanks in advance! > > Bryan > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Abdul-Wahid Paterson Lintrix Networking & Communications ltd. Web: http://www.lintrix.net/ Tel: +44 7801 070621 Email/Jabber: [EMAIL PROTECTED] Web-Hosting | Development | Security | Consultancy | Domains signature.asc Description: This is a digitally signed message part
RE: [PHP] random letter/character?[Scanned]
BTW, This is one of the functions I use you might find it helpful in trimming down your function. function gen_password($length = 8) { $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; for($i = 0; $i < $length; $i++) { $x = rand(0, strlen($chars) -1); $password .= $chars{$x}; } return $password; } > Hope this helps - I also hope anybody else is fairly gentle with their criticisms > and pointers to whatever is wrong with the script - this is the first time I've > ventured to include something like this in a response to an email on the list :-( > Peer review is the best way we can improve our programming. It is good to post code so that we can all get a better understanding of better techniques and tricks. Regards, AW -- Abdul-Wahid Paterson Lintrix Networking & Communications ltd. Web: http://www.lintrix.net/ Tel: +44 7801 070621 Email/Jabber: [EMAIL PROTECTED] Web-Hosting | Development | Security | Consultancy | Domains signature.asc Description: This is a digitally signed message part
Re: [PHP] register_globals per virtual host
Hi, I think you want to use: php_value register_globals Off I have this setup in VirtualHost's and in .htaccess files. The difference between php_value and php_admin_value is that php_admin_value can not be overridden in a .htaccess file or VirtualHost. So if you want to enforce some settings and allow users to change others you can force them with php_admin_value. -- Abdul-Wahid Paterson Lintrix Networking & Communications ltd. Web: http://www.lintrix.net/ Tel: +44 7801 070621 Email/Jabber: [EMAIL PROTECTED] Web-Hosting | Development | Security | Consultancy | Domains signature.asc Description: This is a digitally signed message part
Re: [PHP] Hmmm, and how to do THAT ? ;)
Hi, On Wed, 2003-03-19 at 22:28, Philarmon wrote: > > All security measures needs to happen on the server, not from what the > users > > web browser gives you. > > And how to do something like that on the server ? Is there a tutorial > somewhere about this or something ? A few words about that would be great ! > :) Perhaps you could generate a cookie when they fist enter your site and then check that that cookie is valid when retrieving the content. If then they don't have the cookie set you would know that they have linked to the page directly rather than from following a link on your site. The cookie would have to be some sort of random identifier that you also stored on the web server somewhere so that you could validate the cookie was authentic. Regards, AW -- Abdul-Wahid Paterson Lintrix Networking & Communications ltd. Web: http://www.lintrix.net/ Tel: +44 7801 070621 Email/Jabber: [EMAIL PROTECTED] Web-Hosting | Development | Security | Consultancy | Domains signature.asc Description: This is a digitally signed message part
[PHP] after postgres upgrade - ERROR: current transaction is aborted
Hi, I have had a site working for the last 2 years and have had no problems until at the weekend I replace my database server with a newer one. The database migration went like a dream and I had the whole db changed over in 1 hour. Since the upgrade I have been getting the following error message sporadically. ERROR: current transaction is aborted, queries ignored until end of transaction block I have the following setup Webserver: Apache 1.3.27 (Redhat 7.2) PHP 4.1.2 Database server (old): Postgres 7.1.3 Database server (new): Postgres 7.3.4 The PHP scripts have not changed. I am using PEAR::DB for database access. I think it is the PEAR::DB that is actually making the transactions because some times the error message some times gets generated when I don't even have a transaction. Not too sure about that though. The funny thing is, when I first start up the web-server I don't get any error messages and the site carries on working fine just as it did when using the old database server. However, after about an hour. I suddenly get 10 errors a minute from my site (average of course) with the majority of pages still accessing fine. After a bit more time, this doubles to 20 errors a minute. If I carry on leaving the site, I eventually get error messages every second. The error message seem to be generated from completely unrelated bits of my code. When I restart Apache the error messages go away and the site functions as normal. My theory is, since I am using persistent connections in PHP, a connection is some how becoming...unstable...for the want of a better word. That connection then returns an error on every single request. To put my theory to test, I have turned off the persistent connections on my site and everything appears to be working fine now. I now need to work out where to go from here as my server load is high and I would prefer to use persistent connections. Has anyone experienced any similar problems with changing Postgres versions? Do I need to upgrade my PHP on the web-server as the RedHat postgres the PHP was built against was Postgres 7.1.3? Anyone have any suggestions on how I can fix this? Regards, -- Abdul-Wahid Paterson Lintrix Networking & Comms. ltd. Web: http://www.lintrix.net/ Tel: +44 (0) 870 285 4703Mobile: +44 (0)7971 506177 Fax: 0870 133 0433 Email/Jabber: [EMAIL PROTECTED] Web-Hosting | Development | Security | Consultancy | Domains signature.asc Description: This is a digitally signed message part
Re: [PHP] how to redirect ?
What errors is it giving? It should work fine. However, remember that since it is part of the HTTP header information it has to come before any of the main output of the script. Do you have a code sample and the error message? Abdul-Wahid On Fri, 13 Aug 2004 16:03:29 -0700, CBharadwaj <[EMAIL PROTECTED]> wrote: > Hi > > I have used > Header (Location:PATH) function for redirection. > it is giving some errors. > is there any other method other than HEADER() funtion for redirecting ? > > Bharadwaj > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing HTML files
No easy way of doing it, regex somthing like: $id = preg_replace("/.*/", $1, $string); where $string is a line from your input'd HTML page Abdul-Wahid On Fri, 10 Sep 2004 12:54:37 +0200, Nick Wilson <[EMAIL PROTECTED]> wrote: > Hi all, > > I was wondering if any classes/functions could help me with this little > challenge, (im hopeless at regex ;-) > > > > I want to extract the value of 'id' from a webpage. Any simple way to do > this or am I down to sweating of the regex functions? > > Much thanks > -- > Nick W > > -- > 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] perl's Config::Ini File Module equivalent in PHP
Hi, http://uk2.php.net/function.parse-ini-file On Wed, 9 Feb 2005 14:57:33 +0530, Nikhil M <[EMAIL PROTECTED]> wrote: > Hi All, > I just wanted to know if there is an equivalent of Perl's Config::Ini = > Module in PHP > > Thanks, > Nikhil. > > -- > 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] sorting associative array
Hi, How about this foreach ($data as $key => $row) { $scores[$key] = $row['scores']; } array_multisort($scores, SORT_ASC, $data); Abdul-Wahid On Mon, 24 Jan 2005 00:39:17 +1100, Jeffery Fernandez <[EMAIL PROTECTED]> wrote: > I have the following multi-dimentional array and I want to sort it by > the "score" key value > > print_r($data); > > Array > ( > [0] => Array > ( > [video_id] => 71 > [old_id] => 7854 > [title] => When the fire comes > [video_copies] => 1 > [running_time] => 48 > [date_published] => 06/02 > [place_published] => Australia > [abstract] => ABC TV Gives details on many aspects of bushfires: > ... > [library_medium_id] => 5 > [library_type] => 4 > [score] => 6.3310546875 > ) > > [1] => Array > ( > [video_id] => 9 > [old_id] => 7792 > [title] => Fire awareness > [video_copies] => 1 > [running_time] => 15 > [date_published] => > [place_published] => Victoria > [abstract] => Safetycare Australia A general video lookin. > [library_medium_id] => 5 > [library_type] => 4 > [score] => 3.1997931003571 > ) > > ) > > any ideas. Thanks > > Jeffery > > -- > 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] Web shopping cart
I would agree with that. Is relatively easy to install and configure. Although the templating is not perfect...I have seen better ways of doing it. It works well though in doing what it is meant to do. regards, Abdul-Wahid On Thu, 27 Jan 2005 07:32:44 -0600, Afan Pasalic <[EMAIL PROTECTED]> wrote: > I use osCommerce and they are not bad at all. > > -afan > > > Rick Lim wrote: > > >Can anyone recommend a freeware shopping card app in php? > >Thanks. > > > > > > > > -- > 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