Re: [PHP] predifined functions
I d/l php and i searched through like i did before and i didnt find anything usefull. I couldnt find anything that had functions in it. except for the pear stuff. thx for replying though. -- Dark |++| Darkobjects.com Justin French [EMAIL PROTECTED] wrote in message news:B9E1C49C.1569A%justin;indent.com.au... on 27/10/02 2:31 PM, Jason Wong ([EMAIL PROTECTED]) wrote: On Sunday 27 October 2002 10:40, DaRk--ObJeCtS wrote: alright i wanna know where i could see the source of predifened functions like session_register. Thx. the manual? errr, no the SOURCE... download it from php.net... did around, do some multi-file search thingies... justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Form element names starting with the + character????
I have a simple method of creating easy form processing I thought I came up with the idea (I am not claiming to be the first) to have form elements I want to update via MySQL starting with either - or +. Example: +name=DAN [EMAIL PROTECTED] -notes= id=1 The first 2 are required and will be updated, the 3rd is optional and will be updated and the 4th (id) is simply passed as form data. The idea here is that I parse the $_POST variable to auto create a UPDATE table SET name = 'Dan', email = '[EMAIL PROTECTED]' WHERE = 1 string for MySQL. The issue is that if I use the + to indicate a required field for error trapping my $_POST array ends up like this: +namD=AN [EMAIL PROTECTED] -notes= id=1 Either this is a PHP / HTTP bug or I am up against some strange post naming restriction. I searched the web, the PHP site (includeing the bugs) and could not spot an obvious reference. Any ideas out there? Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble with switch statements
Hello, eNetwizard Developers Team [EMAIL PROTECTED] wrote: Use $_GET[select] for the switch statement Some of the people on this list would even recommend you make another variable first, such as $userselect = $_GET[select] and use $userselect as your switch statement, though I think it pointless. Perhaps, in a simple switch($_GET[select]) statement. But there are times that it makes more sense to assign a $_GET[''] or $_POST[''] to another variable ;) - E ...[snip]... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form element names starting with the + character????
Hello, Are you sure you want to do something like this? This seems like a good candidate for an SQL injection... (Well, I'm not really sure how you're doing it so I could be wrong.) Just wondering... - E Dan Tappin [EMAIL PROTECTED] wrote: I have a simple method of creating easy form processing I thought I came up with the idea (I am not claiming to be the first) to have form elements I want to update via MySQL starting with either - or +. Example: +name=DAN [EMAIL PROTECTED] -notes= id=1 The first 2 are required and will be updated, the 3rd is optional and will be updated and the 4th (id) is simply passed as form data. The idea here is that I parse the $_POST variable to auto create a UPDATE table SET name = 'Dan', email = '[EMAIL PROTECTED]' WHERE = 1 string for MySQL. The issue is that if I use the + to indicate a required field for error trapping my $_POST array ends up like this: +namD=AN [EMAIL PROTECTED] -notes= id=1 Either this is a PHP / HTTP bug or I am up against some strange post naming restriction. I searched the web, the PHP site (includeing the bugs) and could not spot an obvious reference. Any ideas out there? Dan -- 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] Mail Delivery errors when posting here ???
I also receive this kind of message. What's happening? - E Monty [EMAIL PROTECTED] wrote: For some reason I get the following e-mail every time I make a post here recently and not sure why: --- This message was created automatically by mail delivery software (Exim). A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: [EMAIL PROTECTED] SMTP error from remote mailer after MAIL FROM: [EMAIL PROTECTED] SIZE=6478: host yun.yagibdah.de [192.168.0.1]: 550 rejected: administrative prohibition --- This is followed by a copy of my posting to the newsgroup which does get posted. Not sure why it's being rejected and where this is coming from. Any clues?? Monty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: predifined functions
http://cvs.php.net/co.php/php4/ext/session/session.c?login=2r=1.336 G DaRk--ObJeCtS [EMAIL PROTECTED] wrote in message news:20021027024001.28357.qmail;pb1.pair.com... alright i wanna know where i could see the source of predifened functions like session_register. Thx. -- Dark |++| Darkobjects.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie: php/mysql
Hey... I have a little problem... i want to read an encrypted field from mysql database to a php variable... what is the code line that i must enter? (ex: password validation in a login form) Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anyone used Luke Welling Laura Thompsons shopping cart?
I am developing a shopping cart based on the above authors shopping cart fom their book. (Book is a must by the way). I am still pretty new to PHP and MySQL and need some help with the cart. Basically I need to add a form to adjust the quantity in the cart instead of just incrementing by one and then allowing the user to change the amount when she gets there. I have tried unsuccessfully for the last three days to do this. the code that increments the cart is this but if anyone has used the shopping module and knows how to adjust the code to add this fairly simple procedure I'd appreciate it. if($new) { //new item selected if(!session_is_registered(cart)) { $cart = array(); session_register(cart); $items = 0; session_register(items); $total_price = 0.00; session_register(total_price); } if($cart[$new]) $cart[$new]++; else $cart[$new] = 1; $total_price = calculate_price($cart); $items = calculate_items($cart); }
[PHP] java integration
Hi, I have an ssl class which does not work when called within php but works from console. I reported this as a bug to php.net. (Algorithm [Sun bla bla] not found) But while the bug is examined, I have to use this class from my website. 1. Do someone knows how can I integrate my site with java? 2. Is jsp like php? 3. What extras should I install to use jsp from linux/apache? 4. Does jsp works with php on the same server? 5. If so, can I exchange variables between jsp and php? Thanx...
[PHP] Error?
I get the following error and I don't know why this is the code: if($new) { $details = get_product_details($new); if($details[catid]) $target = show_cat.php?catid=.$details[catid]; //line 55 is the bracket below. } $path = $PHP_SELF; $path = str_replace(show_cart.php, , $path); Error: Warning: Can only count STRING and INTEGER values! in /www/u1255/shop_testing/show_cart.php on line 55 Any ideas? all I'm trying to do is pass a qty from a form?
Re: [PHP] Anyone used Luke Welling Laura Thompsons shopping cart?
Hello, What is your PHP version? Perhaps, the problem has something to do with register_globals? What exactly is the problem you're having? Any error messages? - E PS. The book is really great--it's part of my library :) Steve Jackson [EMAIL PROTECTED] wrote: I am developing a shopping cart based on the above authors shopping cart fom their book. (Book is a must by the way). I am still pretty new to PHP and MySQL and need some help with the cart. Basically I need to add a form to adjust the quantity in the cart instead of just incrementing by one and then allowing the user to change the amount when she gets there. I have tried unsuccessfully for the last three days to do this. the code that increments the cart is this but if anyone has used the shopping module and knows how to adjust the code to add this fairly simple procedure I'd appreciate it. if($new) { //new item selected if(!session_is_registered(cart)) { $cart = array(); session_register(cart); $items = 0; session_register(items); $total_price = 0.00; session_register(total_price); } if($cart[$new]) $cart[$new]++; else $cart[$new] = 1; $total_price = calculate_price($cart); $items = calculate_items($cart); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] java integration
Hello, A3-Mail Proxy Handler [EMAIL PROTECTED] wrote: Hi, I have an ssl class which does not work when called within php but works from console. I reported this as a bug to php.net. (Algorithm [Sun bla bla] not found) But while the bug is examined, I have to use this class from my website. 1. Do someone knows how can I integrate my site with java? I'm not sure if I understand your question correctly but perhaps it has something to do with #3? 2. Is jsp like php? Well, it depends on what you mean. One thing is for sure: they're both programming languages :) er, scripting languages ;) Judge for yourself: http://java.sun.com/products/jsp/ 3. What extras should I install to use jsp from linux/apache? http://jakarta.apache.org/tomcat/ ? 4. Does jsp works with php on the same server? Yes. 5. If so, can I exchange variables between jsp and php? I'm not sure. But I'm sure it's not impossible... - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Error?
The error is probably coming from line 39 in the show_cart.php file where you're using the array_count_values() function. I'm not sure why it says line 55 in the error if that's the actual file you're using. Read the manual page on array_count_values for a possible explanation. www.php.net/array_count_values ---John Holmes... -Original Message- From: Steve Jackson [mailto:steve;webpage.co.uk] Sent: Sunday, October 27, 2002 9:00 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Error? here are the 3 files. the main problem i have is to adjust a shopping cart using a form field so I'll send you all three pages. The output_fns page has display cart and category functions. Show_cart page is the one where I'm getting the error and product_fns has a calculation of the items in the cart. -Original Message- From: John W. Holmes [mailto:holmes072000;charter.net] Sent: 27 October 2002 15:56 To: 'Steve Jackson' Subject: RE: [PHP] Error? Can you send me the entire file to look at? -Original Message- From: Steve Jackson [mailto:steve;webpage.co.uk] Sent: Sunday, October 27, 2002 7:14 AM To: Php-General Subject: [PHP] Error? I get the following error and I don't know why this is the code: if($new) { $details = get_product_details($new); if($details[catid]) $target = show_cat.php?catid=.$details[catid]; //line 55 is the bracket below. } $path = $PHP_SELF; $path = str_replace(show_cart.php, , $path); Error: Warning: Can only count STRING and INTEGER values! in /www/u1255/shop_testing/show_cart.php on line 55 Any ideas? all I'm trying to do is pass a qty from a form? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form element names starting with the + character????
Dan Tappin wrote: I have a simple method of creating easy form processing I thought I came up with the idea (I am not claiming to be the first) to have form elements I want to update via MySQL starting with either - or +. Example: +name=DAN [EMAIL PROTECTED] -notes= id=1 The first 2 are required and will be updated, the 3rd is optional and will be updated and the 4th (id) is simply passed as form data. The idea here is that I parse the $_POST variable This would be a BIG secuirty issue...as the input is 'tainted' until otherwise proven safe. If you want to do this approach as you go through each POST var, make sure you have a list of valid fields for the table and make sure the field you're setting from POST actually IS a field in the table. I see what you're trying to do, I've done something somewhat similar and it doesn't require a + or -. I wrote a db class which builds my queries for me. Example snippit: /* -- db.conf -- (table definitions) */ dbNewConn('conn', 'user:password@host'); dbNewDb('database', 'conn'); dbNewTable('my_table', 'database.table_name'); /* -- My script.php -- */ $d = array( 'name' = $_POST['name'], 'email' = $_POST['email']); dbUpdate('my_table', $d, id='{$_POST['id']}'); As dbUpdate gets executed, if the connection isn't up, it connects to the db server, next if it doesn't have a list of fields for the table it lists the fields and 'caches' them during the script execution. And finally it builds the query string. The resulting query is: UPDATE database.table_name SET `name`='The Name', `email`='[EMAIL PROTECTED]' WHERE id=1; It handles all escaping, mysql functions etc. (so I could do: 'name' = 'PASSWORD('.$_POST['name'].')' and it would be escaped propperly). This code is running in a production application and have no had any performance problems. -js to auto create a UPDATE table SET name = 'Dan', email = '[EMAIL PROTECTED]' WHERE = 1 string for MySQL. The issue is that if I use the + to indicate a required field for error trapping my $_POST array ends up like this: +namD=AN [EMAIL PROTECTED] -notes= id=1 Either this is a PHP / HTTP bug or I am up against some strange post naming restriction. I searched the web, the PHP site (includeing the bugs) and could not spot an obvious reference. Any ideas out there? Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Form element names starting with the + character????
I wrote a db class which builds my queries for me. Example snippit: /* -- db.conf -- (table definitions) */ dbNewConn('conn', 'user:password@host'); dbNewDb('database', 'conn'); dbNewTable('my_table', 'database.table_name'); /* -- My script.php -- */ $d = array( 'name' = $_POST['name'], 'email' = $_POST['email']); dbUpdate('my_table', $d, id='{$_POST['id']}'); How do you differentiate between string updates and integer/float updates? Or do you just put quotes around the numbers, too? As dbUpdate gets executed, if the connection isn't up, it connects to the db server, next if it doesn't have a list of fields for the table it lists the fields and 'caches' them during the script execution. And finally it builds the query string. The resulting query is: UPDATE database.table_name SET `name`='The Name', `email`='[EMAIL PROTECTED]' WHERE id=1; Wouldn't the 1 have quotes around it? It handles all escaping, mysql functions etc. (so I could do: 'name' = 'PASSWORD('.$_POST['name'].')' and it would be escaped propperly). This code is running in a production application and have no had any performance problems. How would you escape that? The contents of the PASSWORD function needs to be surrounded by quotes (unless you're passing a column). So you'd need 'name' = PASSWORD(' . $_POST['name'] . ') wouldn't you? So if the name is O'mallery you'd end up with 'name' = PASSWORD('O'mallery') How do you escape that without also escaping the quotes that delimit the string? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Trouble with switch statements
Edward, Try Case 1: . Break; -Original Message- From: Edward Kehoe [mailto:emkehoe;learn.senecac.on.ca] Sent: Friday, October 25, 2002 6:47 PM To: [EMAIL PROTECTED] Subject: [PHP] Trouble with switch statements Ok...I just recently installed Apache1 and PHP 4.2.3 on my computer and I've configured everything. However, I can't seem to get my switch statements to accept variable values from the address bar. So if I type in: http://www.my-site.com/index.php?select=1 It displays the text in the default part of the switch statement. I also seem to get the following error message every time: Notice: Undefined variable: select in c:\apache\apache\htdocs\index.php on line 51 Here's the code for my switch statement as well: switch($select) { case 1: print About Stuff Goes Here.; break; case 2: print Music Goes Here.; break; default:print Testing...; break; } -- 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] Can anyone help please.
I have two test carts online at the moment. This one works fine: http://www.violasystems.com/shop/ this one is the one I want to get working http://www.violasystems.com/shop_testing/ The code for the first shop basically increments the cart by one when the submit button is added using the commented out code. $qty = $formqty; if($cart[$new]) //$cart[$new]++; $cart[$new] = $cart[$new] + $qty; else $cart[$new] = 1; $total_price = calculate_price($cart); $items = calculate_items($cart); I have added the rest (taking a variable from the form $formqty and adding it to the cart) Can anyone see why doesn't this work?
Re: [PHP] Can anyone help please.
Hi, Monday, October 28, 2002, 1:44:37 AM, you wrote: SJ I have two test carts online at the moment. SJ This one works fine: SJ http://www.violasystems.com/shop/ SJ this one is the one I want to get working SJ http://www.violasystems.com/shop_testing/ SJ The code for the first shop basically increments the cart by one when the SJ submit button is added using the commented out code. SJ $qty = $formqty; SJ if($cart[$new]) SJ //$cart[$new]++; SJ$cart[$new] = $cart[$new] + $qty; SJ else SJ $cart[$new] = 1; SJ $total_price = calculate_price($cart); SJ $items = calculate_items($cart); SJ I have added the rest (taking a variable from the form $formqty and adding SJ it to the cart) SJ Can anyone see why doesn't this work? You seem to have other problems than the code here .. Warning: Invalid argument supplied for foreach() in /www/u1255/shop_testing/show_cart.php on line 30 -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Error?
if($new) { $details = get_product_details($new); if($details[catid]) $target = show_cat.php?catid=.$details[catid]; //line 55 is the bracket below. } $path = $PHP_SELF; $path = str_replace(show_cart.php, , $path); Error: Warning: Can only count STRING and INTEGER values! in /www/u1255/shop_testing/show_cart.php on line 55 Any ideas? all I'm trying to do is pass a qty from a form? Maybe it's me, but shouldn't there be a { on or around this line: if($details[catid]) ? $target = show_cat.php?catid=.$details[catid]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form element names starting with the + character????
John W. Holmes wrote: I wrote a db class which builds my queries for me. Example snippit: /* -- db.conf -- (table definitions) */ dbNewConn('conn', 'user:password@host'); dbNewDb('database', 'conn'); dbNewTable('my_table', 'database.table_name'); /* -- My script.php -- */ $d = array( 'name' = $_POST['name'], 'email' = $_POST['email']); dbUpdate('my_table', $d, id='{$_POST['id']}'); How do you differentiate between string updates and integer/float updates? Or do you just put quotes around the numbers, too? On the 'input' side I use is_numeric() to test if the data is numeric. But I haven't considered testing the field type itself. It's easy enough to add. This hasn't come up yet in any of our development. As dbUpdate gets executed, if the connection isn't up, it connects to the db server, next if it doesn't have a list of fields for the table it lists the fields and 'caches' them during the script execution. And finally it builds the query string. The resulting query is: UPDATE database.table_name SET `name`='The Name', `email`='[EMAIL PROTECTED]' WHERE id=1; Wouldn't the 1 have quotes around it? Yes it would, that was my typo... it should be id='1' but id I'm going to assume is an int auto_increment, so the correct where clause should be id={$_POST['id']} It handles all escaping, mysql functions etc. (so I could do: 'name' = 'PASSWORD('.$_POST['name'].')' and it would be escaped propperly). This code is running in a production application and have no had any performance problems. How would you escape that? The contents of the PASSWORD function needs to be surrounded by quotes (unless you're passing a column). There's a private function which escapes all data and tests for the function etc. In the example data below: PASSOWRD('O'mallery') it would do: 1) Determine if it is a function: Substr up to first '(' and see if the strtoupper of it is in_array() which has all of the mysql functions. 2) Since it know's it's a function, it then takes the next char after the '(' and if it's either a ' or it does the next step. 3) Takes first part PASSWORD( and then the data portion O'mallery and replaces quote with \quote in data. (This takes into account if you passed the string 'PASSWORD(O'Mallery)' it would not escape the '.) Next it rebuilds the string PASSWORD(quote$DATAquote) Here is the code: function dbPrepValue($value) { global $_DB_; if ( is_numeric($value) ) { return $value; } else { $tmp = strtoupper($value); if ( 0 ($t = strpos($tmp, '(') ) ) { $tmp = substr($tmp, 0, ($t - 1) ); } if ( in_array( $tmp, $_DB_['mysqlFunc'] ) ) { $q = substr($tmp, ($t + 1), 1); if ( $q == ' || $q == '' ) { $func = substr($value, 0, $t); $data = substr($value, ($t + 1), -2); $value = {$func}{$q} . str_replace($q, \{$q}, $data) . {$q}); } return $value; } else { return '{$value}'; } } } While this code does not take into account EVERY valid query statement, for those conditions you can just pass a raw query to dbQuery(). I'll post a link to the class sometime this week. -js So you'd need 'name' = PASSWORD(' . $_POST['name'] . ') wouldn't you? So if the name is O'mallery you'd end up with 'name' = PASSWORD('O'mallery') How do you escape that without also escaping the quotes that delimit the string? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to prevent failure email from being sent?
Hey guys, My service sends out emails every few days to members who wish to have stats sent to them. The problem is once an email becomes inactive, I the webmaster gets a failure email sent to me. This is starting to add up and I can get upwards of 20 of these a day. It just seems likea waste of space and bandwidth... is there anyway I can prevent this? If i delete the webmaster email key in php.ini will my emails not have a reply address? Thanks! - Noah [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is it possible using mysql alone
Hi, I want to know if it is possible to do the following in Mysql 3.xx or do i have to write out a php script. table1 has a columns A,B,C table2 also has columns A,B,C. The data in column A is differnt in both tables (though 90% is identical) i want to update B,C in table2 where table1.A = table2.A. ANY CLUES ? here is what i tried - insert into table1 (B) select t1.B from table1 t1, table2 t2 where t1.A = t2.A THIS is only for column B- but it tells me i cant have table2 in the from clause thx in advance gamin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 27 Oct 2002 17:35:57 -0000 Issue 1669
php-general Digest 27 Oct 2002 17:35:57 - Issue 1669 Topics (messages 121577 through 121602): Mac OS X EI TEXTAREA Problem 121577 by: Dan Tappin Trouble with switch statements 121578 by: Edward Kehoe 121579 by: Thoenen, Peter Mr. EPS 121580 by: eNetwizard Developers Team 121583 by: . Edwin 121596 by: Gareth Hastings Re: predifined functions 121581 by: DaRk--ObJeCtS 121586 by: George William Smith Form element names starting with the + character 121582 by: Dan Tappin 121584 by: . Edwin 121594 by: Jonathan Sharp 121595 by: John W. Holmes 121600 by: Jonathan Sharp Re: Mail Delivery errors when posting here ??? 121585 by: . Edwin newbie: php/mysql 121587 by: Mr. BuNgL3 Anyone used Luke Welling Laura Thompsons shopping cart? 121588 by: Steve Jackson 121591 by: . Edwin java integration 121589 by: A3-Mail Proxy Handler 121592 by: . Edwin Error? 121590 by: Steve Jackson 121593 by: John W. Holmes 121599 by: Tony Crockford Can anyone help please. 121597 by: Steve Jackson 121598 by: Tom Rogers How to prevent failure email from being sent? 121601 by: Noah Spitzer-Williams is it possible using mysql alone 121602 by: gamin Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- I am setting a MySQL update page where a user is provided a HTML form to update with data auto poulated from a MySQL database via PHP. All the form element work except for TEXTAREA. No matter what encoding I use (htmlspecial, htmlentities etc) I get the browser displaying garbeld text. Example: MySQL data: Headquartered in ABC Building in Anytown, Any Province, ABC Inc. employs approximately 2,500 people and holds almost $9 billion in quality growth assets. A fully integrated oil and gas company, ABC ranks second in production and third in reserves relative to Canada's four other integrated oil and gas companies and is the fourth-largest downstream retailer. HTML TEXTAREA Source: Headquartered in ABC Building in Anytown, Any Province, ABC Inc. employs approximately 2,500 people and holds almost $9 billion in quality growth assets. A fully integrated oil and gas company, ABC ranks second in production and third in reserves relative to Canada's four other integrated oil and gas companies and is the fourth-largest downstream retailer. TEXTAREA Data: 5{d in ABC Building in Anytown, Any Province, ABC Inc. employs approximately 2,500 people and holds almost $9 billion in quality growth assets. A fully integrated oil and gas company, ABC ranks second in production and third in reserves relative to Canada's four other integrated oil and gas companies and is the fourth-largest downstream retailer. Or pd in ABC Building in Anytown, Any Province, ABC Inc. employs approximately 2,500 people and holds almost $9 billion in quality growth assets. A fully integrated oil and gas company, ABC ranks second in production and third in reserves relative to Canada's four other integrated oil and gas companies and is the fourth-largest downstream retailer. I can't get the same results in Netscape 7 Mac or either Windows versions. I will blame Microsoft unless there is some obscure encoding issue I can't find. :^) Thanks, Dan ---End Message--- ---BeginMessage--- Ok...I just recently installed Apache1 and PHP 4.2.3 on my computer and I've configured everything. However, I can't seem to get my switch statements to accept variable values from the address bar. So if I type in: http://www.my-site.com/index.php?select=1 It displays the text in the default part of the switch statement. I also seem to get the following error message every time: Notice: Undefined variable: select in c:\apache\apache\htdocs\index.php on line 51 Here's the code for my switch statement as well: switch($select) { case 1: print About Stuff Goes Here.; break; case 2: print Music Goes Here.; break; default:print Testing...; break; } ---End Message--- ---BeginMessage--- switch($_GET['select']){ case 1: .. -Peter -Original Message- From: Edward Kehoe [mailto:emkehoe;learn.senecac.on.ca] Sent: Friday, October 25, 2002 19:47 To: [EMAIL PROTECTED] Subject: [PHP] Trouble with switch statements Ok...I just recently installed Apache1 and PHP 4.2.3 on my computer and I've configured everything. However, I can't seem to get my switch statements to accept variable values from the address bar. So if I type in: http://www.my-site.com/index.php?select=1 It displays the text in the default part of the switch statement. I also seem
[PHP] Here's a weird one!
I've been trying for ages to add a form field qty to an array to pass it to my shopping cart and have finally managed it but not quite. Please check this cart: http://www.violasystems.com/shop_testing/ When you add an item using the form text box it doesn't add more than 1 on the first submit. However if you go back and then add further items it's will add the multiple products to the cart? I have three functions which control this and can't see where I'm going wrong: Submitting the form: echo table width ='760' background='images/shopbg.gif'form action='show_cart.php' method='post'trtd width='380'nbsp;/td; echo td width='200' align='right'; echo bQuantity required: /binput type='text' name='formqty' value='1' size='3'/td; echo td width='180' align='left'; echo input type='hidden' name='new' value='$ItemCode'; echo input type='image' src='images/add-to-cart.gif' border ='0' alt ='Add to cart'; echo /td/tr/form/table; echo table width='760' background='images/shopbg.gif'trtd width='200'nbsp;/tdtdimg src='images/lower.gif'/td/tr/table; Processing the form: ? include ('products_sc_fns.php'); // The shopping cart needs sessions, so start one session_start(); if($new) { //new item selected if(!session_is_registered(cart)) { $cart = array(); session_register(cart); $items = 0; session_register(items); $total_price = 0.00; session_register(total_price); } $qty = $formqty; if($cart[$new]) //$cart[$new]++; $cart[$new] = $cart[$new] + $qty; else $cart[$new] = 1; $total_price = calculate_price($cart); $items = calculate_items($cart); } if($save) { foreach ($cart as $ItemCode = $qty) { if($$ItemCode==0) unset($cart[$ItemCode]); else $cart[$ItemCode] = $$ItemCode; } $total_price = calculate_price($cart); $items = calculate_items($cart); } do_html_header(Your shopping cart); //array de-bug //print_r($cart); if($cartarray_count_values($cart)) display_cart($cart); else { echo table width='760' cellpadding='0' background='images/shopbg.gif'trtd width='200'nbsp;/tdtdThere are no items in your cart; echo /td/tr/table; } $target = index.php; // if we have just added an item to the cart, continue shopping in that category if($new) { $details = get_product_details($new); if($details[catid]) $target = show_cat.php?catid=.$details[catid]; } $path = $PHP_SELF; $path = str_replace(show_cart.php, , $path); echo table width='760' cellpadding='0' background='images/shopbg.gif'trtd width='200'nbsp;/tdtd align='left'; display_button($target, continue-shopping, Continue Shopping); display_button(http://.$SERVER_NAME.$path.checkout.php;, go-to-checkout, Go To Checkout); echo /td/tr/table; do_html_footer(); ? And displaying the cart: function display_cart($cart, $change = true, $images = 1) { // display items in shopping cart // optionally allow changes (true or false) // optionally include images (1 - yes, 0 - no) global $items; global $total_price; echo table border = 0 width = 760 cellspacing = 0 background='images/shopbg.gif' form action = show_cart.php method = post trth width='200'nbsp;/thth colspan = . (1+$images) . bgcolor=\#146190\font face='Verdana,Arial' size='-1' color='White'Item/font/th th bgcolor=\#146190\font face='Verdana,Arial' size='-1' color='White'Price/font/thth bgcolor=\#146190\font face='Verdana,Arial' size='-1' color='White'Quantity/font/th th bgcolor=\#146190\font face='Verdana,Arial' size='-1' color='White'Total/font/th/tr; //display each item as a table row $qty = $formqty; foreach ($cart as $ItemCode = $qty) { $product = get_product_details($ItemCode); echo trtd width='200'nbsp;/td; if($images ==true) { echo td align = left; if (file_exists(images/$ItemCode.jpg)) { $size = GetImageSize(images/.$ItemCode..jpg); if($size[0]0 $size[1]0) { echo img src=\images/.$ItemCode..jpg\ border=0 ; echo width = . $size[0]/3 . height = .$size[1]/3 . ; } } else echo nbsp;; echo /td; } echo td align = left; echo a href = \show_products.php?ItemCode=.$ItemCode.\.$product[ItemName]./a (Code) .$product[ItemCode]; echo /tdtd align = center .number_format($product[price], 2); echo /tdtd align = center; // if we allow changes, quantities are in text boxes if ($change == true) echo input type='text' name='$ItemCode' value='$qty' size='3'; else echo $qty; echo /tdtd align = center .number_format($product[price]*$qty,2)./td/tr\n; } // display total row echo trth width='200'nbsp;/th th colspan = . (2+$images) . bgcolor=\#146190\nbsp;/th th align = center bgcolor=\#146190\font face='Verdana,Arial' size='-1' color='White' $items
[PHP] funny system()
Hi, RedHat 7.2 - PHP 4.0.6 i run this command on the console when im disconnected from the net and i get an immediate response : wget yahoo.com/ui.htm -O outfile -a logfile the logfile has the error mentioning that HOST NOT FOUND now if do something like this ---test.php--- #!/usr/bin/php -q ? system('wget yahoo.com/ui.htm -O outfile -a logfile'); ? the script seems to hang. it does not seem to result in anything for at least 4-5 minutes (i haven't tried more than that) What am i doing wrong ? gamin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: funny system()
I found the error, silly me i had $!/usr/bin/php -q instead of #!/usr/bin/php -q, sorry gamin. Gamin [EMAIL PROTECTED] wrote in message news:20021027181157.79883.qmail;pb1.pair.com... Hi, RedHat 7.2 - PHP 4.0.6 i run this command on the console when im disconnected from the net and i get an immediate response : wget yahoo.com/ui.htm -O outfile -a logfile the logfile has the error mentioning that HOST NOT FOUND now if do something like this ---test.php--- #!/usr/bin/php -q ? system('wget yahoo.com/ui.htm -O outfile -a logfile'); ? the script seems to hang. it does not seem to result in anything for at least 4-5 minutes (i haven't tried more than that) What am i doing wrong ? gamin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] oracle: updating clob causes error 600
I'm running oracle 8.1.7 w/ php 4.2. I use the oci8 functions to update clob columns, and maybe 1 out of every 15 or 20 times, updating a clob column causes the mysterious ora-600, internal error code. Anybody out there experienced this (and hopefully resolved it) who can shed some light? thanks /nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need a better way...
My coding is not very concise and I would appreciate suggestions on how to clean this up even though it works: /* MySQL to date */ function mysql_to_date($mysql) { $retval = ; if ($mysql) { $parts = explode(-, $mysql); $mo = $parts[1]; $dy = $parts[2]; $yr = $parts[0]; $parts = explode( , $dy); $dy = $parts[0]; $retval = $mo . / . $dy . / . $yr; } else { $retval = ; } return $retval; } -- Ariste Software, Petaluma, CA 94952
Re: [PHP] Need a better way...
function mysql_to_date($mysql) { return ( $mysql ? date('m/d/Y', strtotime($mysql) ) : '' ); } -js Todd Cary wrote: My coding is not very concise and I would appreciate suggestions on how to clean this up even though it works: /* MySQL to date */ function mysql_to_date($mysql) { $retval = ; if ($mysql) { $parts = explode(-, $mysql); $mo = $parts[1]; $dy = $parts[2]; $yr = $parts[0]; $parts = explode( , $dy); $dy = $parts[0]; $retval = $mo . / . $dy . / . $yr; } else { $retval = ; } return $retval; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] defining a variable
Hi All, I am have trouble getting $address to print the URL that is in the db. td class=\dtd\a href=\$address\ target=\_blank\%s/a/td is printing the url with the word address instead of the real address. The code is below. $sql =SELECT * FROM links ORDER BY owner; $sql_result = mysql_query($sql, $conn) or die (couldn't Connect); while ($myrow = mysql_fetch_array($sql_result)){ $address = 'address'; echo table width=\100%\ border=\0\ cellpadding=\2\ cellspacing=\0\ class=\dtd\\n; echotr td class=\tlt\Name/td td class=\tlt\Creator/td td class=\tlt\Category/td /tr\n; do { printf( tr td class=\dtd\a href=\$address\ target=\_blank\%s/a/td td class=\dtd\%s/td td class=\dtd\%s/td /tr\n, $myrow['tutorial'], $myrow['owner'], $myrow['category']); }while ($myrow = mysql_fetch_array($sql_result)); echo/table; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] defining a variable
- Original Message - From: Gary [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, October 27, 2002 2:00 PM Subject: [PHP] defining a variable Hi All, I am have trouble getting $address to print the URL that is in the db. td class=\dtd\a href=\$address\ target=\_blank\%s/a/td is printing the url with the word address instead of the real address. The code is below. $sql =SELECT * FROM links ORDER BY owner; $sql_result = mysql_query($sql, $conn) or die (couldn't Connect); while ($myrow = mysql_fetch_array($sql_result)){ $address = 'address'; ^ That's what you asking for here. Perhaps you're meaning to do a: printf( tr td class=\dtd\a href=\%s\ target=\_blank\%s/a/td td class=\dtd\%s/td td class=\dtd\%s/td /tr\n, $myrow['address'], $myrow['tutorial'], $myrow['owner'], $myrow['category']); }while ($myrow = mysql_fetch_array($sql_result)); Don't just try to change 'address' to $row['address'] abve, because you haven't fetched the result yet, and it will be blank everytime. It needs to be in the fetch() loop. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need a better way...
Why not use DATE_FORMAT in your query, then you don't have to do any extra PHP at all? ---John Holmes... -Original Message- From: Jonathan Sharp [mailto:js-lists;sharpmedia.net] Sent: Sunday, October 27, 2002 1:45 PM To: Todd Cary Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Need a better way... function mysql_to_date($mysql) { return ( $mysql ? date('m/d/Y', strtotime($mysql) ) : '' ); } -js Todd Cary wrote: My coding is not very concise and I would appreciate suggestions on how to clean this up even though it works: /* MySQL to date */ function mysql_to_date($mysql) { $retval = ; if ($mysql) { $parts = explode(-, $mysql); $mo = $parts[1]; $dy = $parts[2]; $yr = $parts[0]; $parts = explode( , $dy); $dy = $parts[0]; $retval = $mo . / . $dy . / . $yr; } else { $retval = ; } return $retval; } -- 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] defining a variable
Matt wrote: - Original Message - From: Gary [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, October 27, 2002 2:00 PM Subject: [PHP] defining a variable Don't just try to change 'address' to $row['address'] abve, because you haven't fetched the result yet, and it will be blank everytime. It needs to be in the fetch() loop. Thanks, I tried it in the loop earlier and I forgot %s. It is always the little things that jump up and bite ya. Thanks Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best way to store Votes for Survey app
I'm writing a survey app in PHP (4.2.2) that will allow people to view a set of photos and then rate each photo from 1-5 using a little dropdown under each photo. When they are done choosing their ratings, they click on SUBMIT to register all their votes at once. I thought the best way to record votes was to create a record for each member and each photo they voted on in MySQL. So, for example, if someone rates 9 photos, there will be 9 records created in the voting DB structured something like this: item_id // ID number of the photo being rated. member_id // ID of the member making the vote. date// Date vote made. rating // 1-5 While this system offers a lot of flexibility in calculating votes, I'm worried that the DB will become full fast with records because of the number of records created for each member when they vote. If there are 10 photos and 2,000 people rate those photos, that will create 20,000 new records in the DB for that one poll alone. So, I'm wondering if anyone has any suggestions for better ways to store votes like this without created so many DB records. I want to be able to calculate total votes for each photo as well as prevent members that have already voted from voting again. Any suggestions would be appreciated! Monty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] news related
I have set up my own news submission system, basically you write an article and it is posted into a mysql database and then anyone can use a couple of lines of java script to access the various news articles. I have noticed a bug though, in that when I put in particularly long articles and then click to view them only part of the article is shown. Now firstly I thought it might be the formatting of my show article page but its not and then I changed field in my database that stores the article from a text data type to a longtext which can handle a ridiculous amount of characters. So I'm not sure why this is happening, when I perform a select query in mysql the article is displayed but I can't see at what point it finishes, plus after text flashes up it is followed by the character - mulitple times. I'm not sure if this is normal. Not sure either if it has anything to do with my submission form. Think it must be something to do with storing it in the database because the show file would show all of what is in that field in the database. Here are the two files. add form: html head title Upload a News Article /title /head body bgcolor=#FF a href=http://www.testhouse.org.uk; img border=0 src=testhouse.gif /a form action=submitnews.php name=post input type=hidden name=articleId value=NOT NULL table border=0 cellpadding=0 cellspacing=0 bordercolor=#11 width=100% tr td width=100% bgcolor=#99 height=22 colspan=2 p style=margin-left: 10bfont face=Verdana size=2 color=#FF Upload a News Article/font/b/td /tr tr td width=100% bgcolor=#FFE300 height=22 colspan=2 br p style=margin-left: 10bfont face=Verdana size=2 color=#FF /font/b/td /tr tr td width=15% bgcolor=#FFE300 p style=margin-left: 10font face=Verdana size=2 Article Title:/font/td td width=85% bgcolor=#FFE300 input type=text name=title size=20 maxlength=20/td /tr tr td width=100% bgcolor=#FFE300 height=22 colspan=2 br p style=margin-left: 10bfont face=Verdana size=2 color=#FF /font/b/td /tr tr td width=15% bgcolor=#FFE300 p style=margin-left: 10font face=Verdana size=2 Article Body:/font/td td width=85% bgcolor=#FFE300 textarea name =content rows=16 cols=60 input type=text name=content/textarea/td /tr tr td width=15% bgcolor=#FFE300 p style=margin-left: 10font face=Verdana size=2 /font/td td width=85% bgcolor=#FFE300 br input type=submit name=submit value=Publish/td /tr tr td width=100% bgcolor=#FFE300 height=22 colspan=2 br p style=margin-left: 10bfont face=Verdana size=2 color=#FF /font/b/td /tr tr td width=100% bgcolor=#99 height=22 colspan=2 br p style=margin-left: 10bfont face=Verdana size=2 color=#FF /font/b/td /tr /table /form /body /html This is the show part, very simple. ?php mysql_connect (localhost); mysql_select_db (content); $result = mysql_query (select * FROM articles WHERE articleId='$articleId'); while ($row = mysql_fetch_row($result)) { printf (trtd%s/td/tr,nl2br($row[2])); } ? a href=getfile.phpback /a Probably something very simple but thanks in advance as usual. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question!
this is the first file continut.php html head titleContinut/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-2 style .spanstyle { position:absolute; visibility:visible; top:-50px; font-size:10pt; font-family:Verdana; font-weight:bold; color:yellow; } /style script var x,y var step=20 var flag=0 // Your snappy message. Important: the space at the end of the sentence!!! var message=TIC2000 Intraþi pe FORUM message=message.split() var xpos=new Array() for (i=0;i=message.length-1;i++) { xpos[i]=-50 } var ypos=new Array() for (i=0;i=message.length-1;i++) { ypos[i]=-50 } function handlerMM(e){ x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY flag=1 } function makesnake() { if (flag==1 document.all) { for (i=message.length-1; i=1; i--) { xpos[i]=xpos[i-1]+step ypos[i]=ypos[i-1] } xpos[0]=x+step ypos[0]=y for (i=0; imessage.length-1; i++) { var thisspan = eval(span+(i)+.style) thisspan.posLeft=xpos[i] thisspan.posTop=ypos[i] } } else if (flag==1 document.layers) { for (i=message.length-1; i=1; i--) { xpos[i]=xpos[i-1]+step ypos[i]=ypos[i-1] } xpos[0]=x+step ypos[0]=y for (i=0; imessage.length-1; i++) { var thisspan = eval(document.span+i) thisspan.left=xpos[i] thisspan.top=ypos[i] } } var timer=setTimeout(makesnake(),30) } /script link href=/css/cata.css rel=stylesheet type=text/css /head body background=imagini/bg1.gif leftmargin=5 topmargin=5 marginwidth=0 marginheight=0 onLoad=makesnake() style=width:100%;overflow-x:hidden;overflow-y:scroll script !-- Beginning of JavaScript - for (i=0;i=message.length-1;i++) { document.write(span id='span+i+' class='spanstyle') document.write(message[i]) document.write(/span) } if (document.layers){ document.captureEvents(Event.MOUSEMOVE); } document.onmousemove = handlerMM; // - End of JavaScript - -- /script ? $fisier=basename(__FILE__); echo a href=\amput_iso-8859-2.php?fisier=$fisier\ Fara diacritice /a ; ? ? $ip = $REMOTE_ADDR; //IP-ul celui care viziteaza site-ul if ( $ip == 192.168.0.3 ) { $nume = Cãtãlin;} elseif ( $ip == 192.168.0.4) { $nume = Florin;} elseif ( $ip == 192.168.0.2) { $nume = Ciprian;} elseif ( $ip == 192.168.0.14) { $nume = Mihai;} else { $nume = Cineva;} ? p align=justify span class=catalinstrongBine ai venit ? echo $nume; ? pe situl reþelei locale Reþea. Pentru început nu am inclus decât un buton în bara de navigare. Daca va fi nevoie voi include ºi alte butoane în viitor, dar nu cred./strong/span/p p align=justify class=catalinstrong Folosiþi forumul pentru a adresa întrebãri ºi eventuale reclamaþii celor care ne ocupãm de ea (Ciprian, Cãtãlin, adicã TIC2000 ºi Florin, adicã Pappy)./strong/p p align=justify class=catalinstrongMenþionez cã acest sit nu va funcþiona decât atunci când voi avea eu calculatorul deschis (adicã TIC2000), asta pânã vom schimba serverul ºi-l voi pune acolo pentru a fi accesat tot timpul./strong/p ? if ( $nume == Cineva ) {? p align=\justify\ class=\catalin\strongPentru a nu mai apãrea data viitoare ca Cineva a href=formular.php target=_blanktrimite-mi/a numele ºi ip-ul tãu (acesta fiind ? echo ($ip); ?) pe adresa de e-mail [EMAIL PROTECTED] ? } ? /strong/p p align=center class=catalinstrongVã mulþumesc pentru vizitã,/strong/p p align=center class=catalinstrong TIC2000/strong/p/body/html this is the second one amput_iso-8859-2.php ? $fp=fopen($fisier,r); if(!$fp){ echo Fisierul este nu poate fi deschis;} else{ while(!feof($fp)){ $c=fgetc($fp); switch($c) { case º: echo s; break;//ALT+0186 case þ: echo t; break;//ALT+0254 case ª: echo S; break;//ALT+0170 case Þ: echo T; break;//ALT+0222 case ã: echo a; break;//ALT+0227 case î: echo i; break;//ALT+140 case â: echo a; break;//ALT+131 case Ã: echo A; break;//ALT+0195 case Î: echo I; break;//ALT+0206 case Â: echo A; break;//ALT+0194 default: echo $c; } }} fclose($fp); ? I send them in the attachment too, you won't have the background, but it doesn't matter. I change letters like this ã in a, î in i, º in s, etc. I use apache 2.40 and php 4.2.3 -- Trasca Ion-Catalin Justin French [EMAIL PROTECTED] wrote in message news:B9E18359.154A1%justin;indent.com.au... That's impossible to answer!! My guess is that the few letters you change affect the way the script runs, so it's probably causing an error. Without seeing *WHAT* you change, I can only guess. Justin on 27/10/02 10:31 AM, Trasca Ion-Catalin ([EMAIL PROTECTED]) wrote: If I have a php file who calls another php file which change some letters on the first file, why my php code on the first file won't work anymore? I hope I was explicit enough in my question. -- Trasca Ion-Catalin begin 666 amput_iso-8859-2.php M/#\-B1F#UF;W!E;B@D9FES:65R+)R(BD[#0II9B@A)9P*7L-F5C:\@
RE: [PHP] Best way to store Votes for Survey app
That's the method I would use. You could try having a separate table for each poll, though. ---John Holmes... -Original Message- From: Monty [mailto:monty3;hotmail.com] Sent: Sunday, October 27, 2002 3:21 PM To: [EMAIL PROTECTED] Subject: [PHP] Best way to store Votes for Survey app I'm writing a survey app in PHP (4.2.2) that will allow people to view a set of photos and then rate each photo from 1-5 using a little dropdown under each photo. When they are done choosing their ratings, they click on SUBMIT to register all their votes at once. I thought the best way to record votes was to create a record for each member and each photo they voted on in MySQL. So, for example, if someone rates 9 photos, there will be 9 records created in the voting DB structured something like this: item_id // ID number of the photo being rated. member_id // ID of the member making the vote. date// Date vote made. rating // 1-5 While this system offers a lot of flexibility in calculating votes, I'm worried that the DB will become full fast with records because of the number of records created for each member when they vote. If there are 10 photos and 2,000 people rate those photos, that will create 20,000 new records in the DB for that one poll alone. So, I'm wondering if anyone has any suggestions for better ways to store votes like this without created so many DB records. I want to be able to calculate total votes for each photo as well as prevent members that have already voted from voting again. Any suggestions would be appreciated! Monty -- 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] Best way to store Votes for Survey app
Say item_id was a int(10) member_id was a int(10) date was a timestamp(14) rating was a int(1) then each record would take up 35bytes + a little overhead Neglecting the overhead 20,000 records would take up only 700kb of space. So size of the db shouldn't be a issue. But if it is then you could changed item_id and member_id to slightly smaller int types. If you are worried about speed of searchs etc, I'm pretty sure MySQL can handle it, but if you want to place some less work on MySQL make a table which stores the current Averages/Totals/Etc and update that whenever a new vote is made/changed/deleted. That way MySQL isn't adding up 20,000 records each time you want to display the current results, and this also leaves you the flexibility to do other statitisics on your data later. Hope this helps Andrew - Original Message - From: Monty [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, October 27, 2002 8:21 PM Subject: [PHP] Best way to store Votes for Survey app I'm writing a survey app in PHP (4.2.2) that will allow people to view a set of photos and then rate each photo from 1-5 using a little dropdown under each photo. When they are done choosing their ratings, they click on SUBMIT to register all their votes at once. I thought the best way to record votes was to create a record for each member and each photo they voted on in MySQL. So, for example, if someone rates 9 photos, there will be 9 records created in the voting DB structured something like this: item_id // ID number of the photo being rated. member_id // ID of the member making the vote. date// Date vote made. rating // 1-5 While this system offers a lot of flexibility in calculating votes, I'm worried that the DB will become full fast with records because of the number of records created for each member when they vote. If there are 10 photos and 2,000 people rate those photos, that will create 20,000 new records in the DB for that one poll alone. So, I'm wondering if anyone has any suggestions for better ways to store votes like this without created so many DB records. I want to be able to calculate total votes for each photo as well as prevent members that have already voted from voting again. Any suggestions would be appreciated! Monty -- 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] news related
So how do you store the text into the database? I didn't see that in here? ---John Holmes... -Original Message- From: [EMAIL PROTECTED] [mailto:php;erars.demon.co.uk] Sent: Sunday, October 27, 2002 3:23 PM To: [EMAIL PROTECTED] Subject: [PHP] news related I have set up my own news submission system, basically you write an article and it is posted into a mysql database and then anyone can use a couple of lines of java script to access the various news articles. I have noticed a bug though, in that when I put in particularly long articles and then click to view them only part of the article is shown. Now firstly I thought it might be the formatting of my show article page but its not and then I changed field in my database that stores the article from a text data type to a longtext which can handle a ridiculous amount of characters. So I'm not sure why this is happening, when I perform a select query in mysql the article is displayed but I can't see at what point it finishes, plus after text flashes up it is followed by the character - mulitple times. I'm not sure if this is normal. Not sure either if it has anything to do with my submission form. Think it must be something to do with storing it in the database because the show file would show all of what is in that field in the database. Here are the two files. add form: html head title Upload a News Article /title /head body bgcolor=#FF a href=http://www.testhouse.org.uk; img border=0 src=testhouse.gif /a form action=submitnews.php name=post input type=hidden name=articleId value=NOT NULL table border=0 cellpadding=0 cellspacing=0 bordercolor=#11 width=100% tr td width=100% bgcolor=#99 height=22 colspan=2 p style=margin-left: 10bfont face=Verdana size=2 color=#FF Upload a News Article/font/b/td /tr tr td width=100% bgcolor=#FFE300 height=22 colspan=2 br p style=margin-left: 10bfont face=Verdana size=2 color=#FF /font/b/td /tr tr td width=15% bgcolor=#FFE300 p style=margin-left: 10font face=Verdana size=2 Article Title:/font/td td width=85% bgcolor=#FFE300 input type=text name=title size=20 maxlength=20/td /tr tr td width=100% bgcolor=#FFE300 height=22 colspan=2 br p style=margin-left: 10bfont face=Verdana size=2 color=#FF /font/b/td /tr tr td width=15% bgcolor=#FFE300 p style=margin-left: 10font face=Verdana size=2 Article Body:/font/td td width=85% bgcolor=#FFE300 textarea name =content rows=16 cols=60 input type=text name=content/textarea/td /tr tr td width=15% bgcolor=#FFE300 p style=margin-left: 10font face=Verdana size=2 /font/td td width=85% bgcolor=#FFE300 br input type=submit name=submit value=Publish/td /tr tr td width=100% bgcolor=#FFE300 height=22 colspan=2 br p style=margin-left: 10bfont face=Verdana size=2 color=#FF /font/b/td /tr tr td width=100% bgcolor=#99 height=22 colspan=2 br p style=margin-left: 10bfont face=Verdana size=2 color=#FF /font/b/td /tr /table /form /body /html This is the show part, very simple. ?php mysql_connect (localhost); mysql_select_db (content); $result = mysql_query (select * FROM articles WHERE articleId='$articleId'); while ($row = mysql_fetch_row($result)) { printf (trtd%s/td/tr,nl2br($row[2])); } ? a href=getfile.phpback /a Probably something very simple but thanks in advance as usual. -- 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] One mail function, multiple recipients
You'll need to be careful with this method. In an effort to keep spam to a minimum, some ISP's may refuse messages with more than X number of email address attached. Then the question becomes: did everyone on the list actually receive the message? -Original Message- From: Justin French [EMAIL PROTECTED] To: Stephen [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Date: Friday, October 25, 2002 7:53 PM Subject: Re: [PHP] One mail function, multiple recipients instead of your while() loop calling mail() each time, use it to build a comma separated list of recipients, then pipe them into a Bcc (so as to not publicise everyone's email address), and send one email with all people in the Bcc list. UNTESTED code: ? $bcc = ''; $sql = SELECT email FROM mailingListTable; $result = mysql_query($sql); while($myrow = mysql_fetch_array($result)) { $bcc .= $myrow['email'].','; } // $bcc will now look like: // [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED], // trim off the trailing comma $bcc = substr($bcc, 0, -1); // prepare to send $to = '[EMAIL PROTECTED]'; $subject = 'My Mailing List'; $message = 'This is my email message'; $headers = 'From: [EMAIL PROTECTED]\r\n'; $headers .= Bcc: {$bcc}\r\n; // send mail($to, $subject, $message, $headers); ? Good luck -- like I said, untested code, so it may need some tweaking. Justin on 26/10/02 10:41 AM, Stephen ([EMAIL PROTECTED]) wrote: I'm pulling email addresses from a database, then emailing them a newsletter email. Right now, I'm calling the mail() function each time to send an email and that's slooow. How could I make it so all the emails are put into a BCC field then emailed all at once instead of multiple times? Thanks, Stephen Craton http://www.melchior.us http://php.melchior.us -- 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] PHP 4.3.0pre2
Hello, PHP 4.3.0pre2 is available for download from http://qa.php.net. This second pre-release incorporates a large number of bug fixes since the first one. Still, to help us catch as many bugs as possible, please download it and start testing. -Andrei http://www.gravitonic.com/ * Gun manufacturers don't make bad products, bad parents do. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] One mail function, multiple recipients
Hello, On 10/27/2002 06:23 PM, Dwalker wrote: You'll need to be careful with this method. In an effort to keep spam to a minimum, some ISP's may refuse messages with more than X number of email address attached. Then the question becomes: did everyone on the list actually receive the message? The ISP that refuse messages to many recipients in BCC, certainly will not allow you to send separate messages to the as many recipients because that overloads even more their servers. That has nothing to do with whether you are sending spam or solicited bulk mail like newsletters. Thas has to do with abusing the mail server resources compromising the quality of service to other customers . Whether you send separate messages or a single message with all recipients in Bcc, you need to ask your ISP if you are not infringing the acceptable use policy. In shared servers you are most likely abusing. Regards, Manuel Lemos -Original Message- From: Justin French [EMAIL PROTECTED] To: Stephen [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Date: Friday, October 25, 2002 7:53 PM Subject: Re: [PHP] One mail function, multiple recipients instead of your while() loop calling mail() each time, use it to build a comma separated list of recipients, then pipe them into a Bcc (so as to not publicise everyone's email address), and send one email with all people in the Bcc list. UNTESTED code: ? $bcc = ''; $sql = SELECT email FROM mailingListTable; $result = mysql_query($sql); while($myrow = mysql_fetch_array($result)) { $bcc .= $myrow['email'].','; } // $bcc will now look like: // [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED], // trim off the trailing comma $bcc = substr($bcc, 0, -1); // prepare to send $to = '[EMAIL PROTECTED]'; $subject = 'My Mailing List'; $message = 'This is my email message'; $headers = 'From: [EMAIL PROTECTED]\r\n'; $headers .= Bcc: {$bcc}\r\n; // send mail($to, $subject, $message, $headers); ? Good luck -- like I said, untested code, so it may need some tweaking. Justin on 26/10/02 10:41 AM, Stephen ([EMAIL PROTECTED]) wrote: I'm pulling email addresses from a database, then emailing them a newsletter email. Right now, I'm calling the mail() function each time to send an email and that's slooow. How could I make it so all the emails are put into a BCC field then emailed all at once instead of multiple times? Thanks, Stephen Craton http://www.melchior.us http://php.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Best way to store Votes for Survey app
Hi, Your solution is a good way (I use the same system for user contributions vote).. The size of the DB is not a problem... You can add an history table if you work month by month. Like this, your 'voting' table will only have current month value, and the history table will get results for each month.. No? Regards, P.E. Baroiller Monty [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] I'm writing a survey app in PHP (4.2.2) that will allow people to view a set of photos and then rate each photo from 1-5 using a little dropdown under each photo. When they are done choosing their ratings, they click on SUBMIT to register all their votes at once. I thought the best way to record votes was to create a record for each member and each photo they voted on in MySQL. So, for example, if someone rates 9 photos, there will be 9 records created in the voting DB structured something like this: item_id // ID number of the photo being rated. member_id // ID of the member making the vote. date// Date vote made. rating // 1-5 While this system offers a lot of flexibility in calculating votes, I'm worried that the DB will become full fast with records because of the number of records created for each member when they vote. If there are 10 photos and 2,000 people rate those photos, that will create 20,000 new records in the DB for that one poll alone. So, I'm wondering if anyone has any suggestions for better ways to store votes like this without created so many DB records. I want to be able to calculate total votes for each photo as well as prevent members that have already voted from voting again. Any suggestions would be appreciated! Monty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] You to prevent site hacking by 'pirates' ?
Hi everyone.. I would know what did you think of my method to prevent 'piracy'.. I do like this : - A Session is made for each user In the session, put 2 value : a flag userlogged and the userId - In a cookie, I put the session Id and an unique crypted value. When user go on private parts of the site, I check the session, the cookie and database fields for the user.. The crypted data contains some user values (the encryption is done with mcrypt lib). Is it a good way or is there a better way (without SSL)... ? Regards, P.E. Baroiller -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting server load?
I know there's a way to check the current server load... does anyone know how? 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] You to prevent site hacking by 'pirates' ?
I would know what did you think of my method to prevent 'piracy'.. I do like this : - A Session is made for each user In the session, put 2 value : a flag userlogged and the userId - In a cookie, I put the session Id and an unique crypted value. If you're using sessions, there is already a cookie with the session id in it. Why are you storing crypted values in a cookie? Why not just add the values to the session and not worry about encrypting it? ---John Holmes When user go on private parts of the site, I check the session, the cookie and database fields for the user.. The crypted data contains some user values (the encryption is done with mcrypt lib). Is it a good way or is there a better way (without SSL)... ? Regards, P.E. Baroiller -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A couple of questions..
I have two very newbie questions.. I want to be able to create a directory index view on my local Apache server other than the default Apache view (similar to Expow, but not as complex).. Can anyone recommend a simple script that you know of which can display Name, Type, Size and Modified Date columns as well as allow users to browse folders/directories and download the files within them? I was told browsing subdirectories on Win32 machines isn't possible with PHP, but I've seen it elsewhere (such as using Expow).. I assume I could make a simple directory view script myself, but I'm not familiar enough with PHP to feel comfortable about possible security issues.. Register globals is off if that has any impact on possible help.. The second question relates to the first, although it's more of an Apache question.. I hope someone could help me as I assume it'd be an easy fix, but I don't know what to search for.. I'm running Apache 1.3.27 on WinXP Pro with PHP 4.2.3 locally.. Whether I type in the SERVER_ADDR IP address, the computer name, localhost or 127.0.0.1, I still get this following problem.. If I view this: http://localhost/mp3/ I get the default Apache directory index view.. However, if I view this: http://localhost/mp3 (minus the trailing forward slash) I can't get a directory listing.. I get the default MSIE error page similar to no DNS found.. I have most every ErrorDocument number set correctly and working, but I don't even get an error # or page.. Is there something in Apache's httpd.conf that corrects this? I wasn't sure if the following has anything to do with this.. With my last setup (Win98/Apache 1.3.26/PHP 4.1.1), I don't remember having the php.exe Action ScriptAlias directive there.. As you probably have guessed, I'm no expert with Apache either.. When I started Apache in the past on my old setup, it'd start in console and tell me PHP was running as well.. IfModule mod_dir.c DirectoryIndex index.html index.o0o index.php AddType application/x-httpd-php .php .o0o AddType application/x-httpd-php-source .phps Action application/x-httpd-php /php/php.exe ScriptAlias /php/ D:/Server/PHP/ /IfModule FYI: It's not a fulltime, always on server by any means, just something to let friends grab files from me and allows me to locally test php scripts when I run it.. Any help is appreciated.. TIA.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] You to prevent site hacking by 'pirates' ?
I work with double cookie to add a security... If the user try to change de sessionId, I check with the current sessionId stored into my own cookie.. But.. It may not to be usefull... :) The cookie is basically a crypted copy of the session content (with a different encryption method). I'm looking for a good way to protect a private part of a site and... I was thinking this method would be more efficient than only the session cookie.. But ... perhaps I'm on the bad way... John W. Holmes [EMAIL PROTECTED] a écrit dans le message de news: 002501c27e08$40567040$[EMAIL PROTECTED] I would know what did you think of my method to prevent 'piracy'.. I do like this : - A Session is made for each user In the session, put 2 value : a flag userlogged and the userId - In a cookie, I put the session Id and an unique crypted value. If you're using sessions, there is already a cookie with the session id in it. Why are you storing crypted values in a cookie? Why not just add the values to the session and not worry about encrypting it? ---John Holmes When user go on private parts of the site, I check the session, the cookie and database fields for the user.. The crypted data contains some user values (the encryption is done with mcrypt lib). Is it a good way or is there a better way (without SSL)... ? Regards, P.E. Baroiller -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting server load?
assuming linux and 'server load' to equal 'entire server[read computer] load' try 'uptime' and look at last three #'s try man uptime for more details -js Leif K-Brooks wrote: I know there's a way to check the current server load... does anyone know how? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] You to prevent site hacking by 'pirates' ?
BAROILLER Pierre-Emmanuel wrote: I work with double cookie to add a security... This is a common technique and does strengthen security somewhat. If the user try to change de sessionId, I check with the current sessionId stored into my own cookie.. But.. It may not to be usefull... :) The cookie is basically a crypted copy of the session content (with a different encryption method). You might want to consider using only one piece of session data rather than the whole thing. For example, many people who use this type of approach will have an extra validation key stored in the session that is used to create the second cookie (or URL variable or whatever). If you focus too much on strengthening security, or make your extra steps too complex, you risk making your session mechanism very inefficient, and this can open you up to the risk of denial of service attacks. I'm looking for a good way to protect a private part of a site and... I was thinking this method would be more efficient than only the session cookie.. Not more efficient, but definitely a bit more secure. Here is a suggestion, however. Your method here is focused on preventing a guess attack, right? Well, the unique IDs generated by PHP are already extremely difficult to guess, and this is probably not the weakest point in your mechanism. What you might want to do is let your validation token be passed in the URL on each page. This way, for those with cookies enabled, the PHPSESSID will be in a cookie, and your validation token will be in the URL. Why use two different methods? Well, there are more dangers than someone trying to guess a valid cookie. Browsers have been known to have vulnerabilities that allow people to read cookies from any domain (IE 4.0 - 6.0 has this problem). Thus, a bad guy could get a good guy's cookies and then visit your site. Passing a validation token on the URL certainly doesn't make everything safe, but it makes the bad guy have to work harder, and that's what we want to do. Also, with a combination of methods, you almost force the bad guy to have to intercept the HTTP request itself. If someone can intercept the HTTP transactions, then your only real protection is something like SSL, so if you're not using SSL, you can feel pretty good knowing that you've made things about as difficult for the bad guy as you can. Happy hacking. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OCDB Connection from unix box
can any one point me to a good tutorial or article that has web server on a unix box and a win2k server with access on it? is there anything other than the ocdb_connect... that i need to get/use to connect to it? Cheers Peter the only dumb question is the one that wasn't asked -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OCDB Connection from unix box
Hi Peter, Check out the PHP-ODBC HOWTO's on http://www.iodbc.org, this will help you get the *nix side set up. You will also need an appropriate driver to install on the *nix box - OpenLink has 30 day trials if you require one. Best regards, Andrew Hill Director of Technology Evangelism - OpenLink Software Universal Data Access and the Virtuoso Universal Server http://www.openlinksw.com/virtuoso/whatis.htm On Sunday, October 27, 2002, at 07:56 PM, Peter Houchin wrote: can any one point me to a good tutorial or article that has web server on a unix box and a win2k server with access on it? is there anything other than the ocdb_connect... that i need to get/use to connect to it? Cheers Peter the only dumb question is the one that wasn't asked -- 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] OCDB Connection from unix box
Thanks Andrew :D -Original Message- From: Andrew Hill [mailto:ahill;openlinksw.com] Sent: Monday, 28 October 2002 12:10 PM To: Peter Houchin Cc: php_gen Subject: Re: [PHP] OCDB Connection from unix box Hi Peter, Check out the PHP-ODBC HOWTO's on http://www.iodbc.org, this will help you get the *nix side set up. You will also need an appropriate driver to install on the *nix box - OpenLink has 30 day trials if you require one. Best regards, Andrew Hill Director of Technology Evangelism - OpenLink Software Universal Data Access and the Virtuoso Universal Server http://www.openlinksw.com/virtuoso/whatis.htm On Sunday, October 27, 2002, at 07:56 PM, Peter Houchin wrote: can any one point me to a good tutorial or article that has web server on a unix box and a win2k server with access on it? is there anything other than the ocdb_connect... that i need to get/use to connect to it? Cheers Peter the only dumb question is the one that wasn't asked -- 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] What is this??
Hi guys, I was doing a script to insert data on a table, and the following message appeared me when testing the form for data insertion: Column count doesn't match value count at row 1 I lsaw the PHP manual and some other resources that I have, but couldn't find anything about it... Any hint from someone?? Cheers Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What is this??
It means you are most likely performing an insert and have more fields specified than values given. If you give us your SQL we can help you out. Regards Jarrad Kabral -Original Message- From: Miguel Brás [mailto:molino26;netcabo.pt] Sent: Monday, 28 October 2002 1:40 PM To: [EMAIL PROTECTED] Subject: [PHP] What is this?? Hi guys, I was doing a script to insert data on a table, and the following message appeared me when testing the form for data insertion: Column count doesn't match value count at row 1 I lsaw the PHP manual and some other resources that I have, but couldn't find anything about it... Any hint from someone?? Cheers Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is this??
My guess is that you're doing something like insert into table(col1,col2,col3) values('val1','val2'). You need to have an equal ammount of columns and values. Miguel Brás wrote: Hi guys, I was doing a script to insert data on a table, and the following message appeared me when testing the form for data insertion: Column count doesn't match value count at row 1 I lsaw the PHP manual and some other resources that I have, but couldn't find anything about it... Any hint from someone?? Cheers Miguel -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is this??
Ok I found the problem. I also had a column on my table and I was not using it, so I deleted her. I had also one more field on my form and forgot to add him to the query. Thx for the hint Best Miguel Leif K-Brooks [EMAIL PROTECTED] escreveu na mensagem news:3DBCA42E.9070608;buyer-brokerage.com... My guess is that you're doing something like insert into table(col1,col2,col3) values('val1','val2'). You need to have an equal ammount of columns and values. Miguel Brás wrote: Hi guys, I was doing a script to insert data on a table, and the following message appeared me when testing the form for data insertion: Column count doesn't match value count at row 1 I lsaw the PHP manual and some other resources that I have, but couldn't find anything about it... Any hint from someone?? Cheers Miguel -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Here's a weird one!
Hello, I think the problem lies here: $qty = $formqty; if($cart[$new]) //$cart[$new]++; $cart[$new] = $cart[$new] + $qty; else $cart[$new] = 1; $total_price = calculate_price($cart); $items = calculate_items($cart); } It seems like you should be adding the $qty on the else part and NOT here: -- $cart[$new] = $cart[$new] + $qty; However, I just checked the site and it seems like it's working fine. I'm using Netscape 7, by the way... - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Library question
Hi all. I would like to know what does it mean by I need to have a certain library to have access to a certain function such as encrypt and decrypt? And how do I install these library? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Library question
Hi, Monday, October 28, 2002, 2:52:47 PM, you wrote: MK Hi all. MK I would like to know what does it mean by I need to have a certain library MK to have access to a certain function such as encrypt and decrypt? MK And how do I install these library? Those are a collection of functions that PHP will call for encryption and such. In windows they will be something like mcrypt.dll or for unix libmcrypt. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions are acting strangely
Hi there, Im looking for ANY help regarding his problem - I find this interesting to say the least. I recently switched to a new hosting company - they are running php 4.1.2 - register globals is ON. the sessions automatically expire without closing the window. if you load index.php and wait past 30 seconds - the session variables are empty - Sometimes - although not reliably - if you wait another 30 seconds - the variables are back? - this is very strange? - here are the files I have setup to illustrate this problem. Im using the default php-ini file - so no weird session expires or garbage collections stuff. Ive set up 3 basic files: index.php: ?php session_start(); session_register('var1','var2'); $var1 = cat; $var2 = dog; echo Click a href=\sess2.php\here/a to view the session vars on page 2; ? --- sess2.php: ?php session_start(); echo Var1 = $var1, var2 = $var2; echo Click a href=\sess3.php\here/a to view the session vars on page 3; ? -- sess3.php: ?php session_start(); echo Var1 = $var1, var2 = $var2; echo Click a href=\sess2.php\here/a to view the session vars on page 2; echo brbrbrbrClick a href=\index.php\here/a to go back to page 1 to reset the session vars; ? Does anyone know if 4.1.2 had any session bugs? Thanks for reading this ;-) Paul paul AT triplethree DOT com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 28 Oct 2002 05:50:44 -0000 Issue 1670
php-general Digest 28 Oct 2002 05:50:44 - Issue 1670 Topics (messages 121603 through 121640): Here's a weird one! 121603 by: Steve Jackson 121637 by: . Edwin funny system() 121604 by: gamin 121605 by: gamin oracle: updating clob causes error 600 121606 by: Nick Eby Need a better way... 121607 by: Todd Cary 121608 by: Jonathan Sharp 121611 by: John W. Holmes defining a variable 121609 by: Gary 121610 by: Matt 121612 by: Gary PHP 4.3.0pre2 121613 by: Andrei Zmievski Best way to store Votes for Survey app 121614 by: Monty 121617 by: John W. Holmes 121618 by: Andrew Brampton 121622 by: BAROILLER Pierre-Emmanuel news related 121615 by: php.erars.demon.co.uk 121619 by: John W. Holmes Re: Question! 121616 by: Trasca Ion-Catalin Re: One mail function, multiple recipients 121620 by: dwalker 121621 by: Manuel Lemos You to prevent site hacking by 'pirates' ? 121623 by: BAROILLER Pierre-Emmanuel 121625 by: John W. Holmes 121627 by: BAROILLER Pierre-Emmanuel 121629 by: Chris Shiflett Getting server load? 121624 by: Leif K-Brooks 121628 by: Jonathan Sharp A couple of questions.. 121626 by: eriol OCDB Connection from unix box 121630 by: Peter Houchin 121631 by: Andrew Hill 121632 by: Peter Houchin What is this?? 121633 by: Miguel Brás 121634 by: Jarrad Kabral 121635 by: Leif K-Brooks 121636 by: Miguel Brás Library question 121638 by: Muhammad Khairuzzaman 121639 by: Tom Rogers Sessions are acting strangely 121640 by: Paul Marais Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- I've been trying for ages to add a form field qty to an array to pass it to my shopping cart and have finally managed it but not quite. Please check this cart: http://www.violasystems.com/shop_testing/ When you add an item using the form text box it doesn't add more than 1 on the first submit. However if you go back and then add further items it's will add the multiple products to the cart? I have three functions which control this and can't see where I'm going wrong: Submitting the form: echo table width ='760' background='images/shopbg.gif'form action='show_cart.php' method='post'trtd width='380'nbsp;/td; echo td width='200' align='right'; echo bQuantity required: /binput type='text' name='formqty' value='1' size='3'/td; echo td width='180' align='left'; echo input type='hidden' name='new' value='$ItemCode'; echo input type='image' src='images/add-to-cart.gif' border ='0' alt ='Add to cart'; echo /td/tr/form/table; echo table width='760' background='images/shopbg.gif'trtd width='200'nbsp;/tdtdimg src='images/lower.gif'/td/tr/table; Processing the form: ? include ('products_sc_fns.php'); // The shopping cart needs sessions, so start one session_start(); if($new) { //new item selected if(!session_is_registered(cart)) { $cart = array(); session_register(cart); $items = 0; session_register(items); $total_price = 0.00; session_register(total_price); } $qty = $formqty; if($cart[$new]) //$cart[$new]++; $cart[$new] = $cart[$new] + $qty; else $cart[$new] = 1; $total_price = calculate_price($cart); $items = calculate_items($cart); } if($save) { foreach ($cart as $ItemCode = $qty) { if($$ItemCode==0) unset($cart[$ItemCode]); else $cart[$ItemCode] = $$ItemCode; } $total_price = calculate_price($cart); $items = calculate_items($cart); } do_html_header(Your shopping cart); //array de-bug //print_r($cart); if($cartarray_count_values($cart)) display_cart($cart); else { echo table width='760' cellpadding='0' background='images/shopbg.gif'trtd width='200'nbsp;/tdtdThere are no items in your cart; echo /td/tr/table; } $target = index.php; // if we have just added an item to the cart, continue shopping in that category if($new) { $details = get_product_details($new); if($details[catid]) $target = show_cat.php?catid=.$details[catid]; } $path = $PHP_SELF; $path = str_replace(show_cart.php, , $path); echo table width='760' cellpadding='0' background='images/shopbg.gif'trtd width='200'nbsp;/tdtd align='left'; display_button($target, continue-shopping, Continue Shopping); display_button(http://.$SERVER_NAME.$path.checkout.php;, go-to-checkout, Go To Checkout); echo /td/tr/table; do_html_footer(); ? And displaying the cart: function display_cart($cart, $change =
[PHP] A newbie on Board!
Hi, I have just started off myself to learn PHP. I have installed PHP 4.2.3 and Apache 1.3.27. I have built some sample pages which are running fine. But now I want to integrate PHP with Oracle. Can somebody help me how to do it ? Subodh Gupta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form element names starting with the + character????
I figured it was something like that. Thanks, Dan On Sunday, October 27, 2002, at 01:41 AM, eNetwizard Developers Team wrote: My understanding is since $+ is illegal, PHP strips the illegal characters from the post variables when creating the post array. I once read it somewhere and if I recall correctly it either strips them entirely or turns them into underscores. -Samuel | http://enetwizard.net -Original Message- From: Dan Tappin [mailto:dan;wavefront.ca] Sent: Sunday, October 27, 2002 2:20 AM To: [EMAIL PROTECTED] Subject: [PHP] Form element names starting with the + character I have a simple method of creating easy form processing I thought I came up with the idea (I am not claiming to be the first) to have form elements I want to update via MySQL starting with either - or +. Example: +name=DAN [EMAIL PROTECTED] -notes= id=1 The first 2 are required and will be updated, the 3rd is optional and will be updated and the 4th (id) is simply passed as form data. The idea here is that I parse the $_POST variable to auto create a UPDATE table SET name = 'Dan', email = '[EMAIL PROTECTED]' WHERE = 1 string for MySQL. The issue is that if I use the + to indicate a required field for error trapping my $_POST array ends up like this: +namD=AN [EMAIL PROTECTED] -notes= id=1 Either this is a PHP / HTTP bug or I am up against some strange post naming restriction. I searched the web, the PHP site (includeing the bugs) and could not spot an obvious reference. Any ideas out there? Dan -- 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] Form element names starting with the + character????
Hello Edwin, What do you mean by SQL injection...? Thanks, Dan On Sunday, October 27, 2002, at 01:01 AM, @ Edwin wrote: Hello, Are you sure you want to do something like this? This seems like a good candidate for an SQL injection... (Well, I'm not really sure how you're doing it so I could be wrong.) Just wondering... - E Dan Tappin [EMAIL PROTECTED] wrote: I have a simple method of creating easy form processing I thought I came up with the idea (I am not claiming to be the first) to have form elements I want to update via MySQL starting with either - or +. Example: +name=DAN [EMAIL PROTECTED] -notes= id=1 The first 2 are required and will be updated, the 3rd is optional and will be updated and the 4th (id) is simply passed as form data. The idea here is that I parse the $_POST variable to auto create a UPDATE table SET name = 'Dan', email = '[EMAIL PROTECTED]' WHERE = 1 string for MySQL. The issue is that if I use the + to indicate a required field for error trapping my $_POST array ends up like this: +namD=AN [EMAIL PROTECTED] -notes= id=1 Either this is a PHP / HTTP bug or I am up against some strange post naming restriction. I searched the web, the PHP site (includeing the bugs) and could not spot an obvious reference. Any ideas out there? Dan -- 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] steganographie or digital watermarking
Hallo, does anybody know a class or function (or module) in php to do some simple digital watermarking or steganoraphie. Perhaps in combination with the image functions? Thanks in advance, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form element names starting with the + character????
On Sun, Oct 27, 2002 at 11:18:28PM -0700, Dan Tappin wrote: What do you mean by SQL injection...? Well, to use your example of updating a user record, what if they added form variables? +admin=1 +paid_until=2102 +balance=10 Of course, not all will be applicable, but there's almost certainly fields in your tables you don't want the entire world editing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A newbie on Board!
Hi, Please start by looking in the manual... I simply typed http://php.net/oracle into my browser, which resulted in this page: http://www.php.net/manual/en/ref.oracle.php Seems to document all the functions, and there are user-contributed notes down the bottom which seem to provide even more help, and sample scripts. THEN if you need some more help, I'm sure there are some people on this list who can help :) Justin on 28/10/02 4:17 PM, Subodh Gupta ([EMAIL PROTECTED]) wrote: Hi, I have just started off myself to learn PHP. I have installed PHP 4.2.3 and Apache 1.3.27. I have built some sample pages which are running fine. But now I want to integrate PHP with Oracle. Can somebody help me how to do it ? Subodh Gupta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] A newbie on Board!
jump along to php.net/manual/en and have a look in there and it will show ya how to connect to oracle ( I can't remember :D ) also check out phpbuilder.com and phpbeginner.com they'll both have tutorials for connecting to oracle from memory :) Cheers -Original Message- From: Subodh Gupta [mailto:Subodh.Gupta;seepz.tcs.co.in] Sent: Monday, 28 October 2002 5:18 PM To: [EMAIL PROTECTED] Subject: [PHP] A newbie on Board! Hi, I have just started off myself to learn PHP. I have installed PHP 4.2.3 and Apache 1.3.27. I have built some sample pages which are running fine. But now I want to integrate PHP with Oracle. Can somebody help me how to do it ? Subodh Gupta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: What is this??
You only have a difference into your insert query like this : insert into table (x,y,z) values(x,y) .. Miguel BráS [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Hi guys, I was doing a script to insert data on a table, and the following message appeared me when testing the form for data insertion: Column count doesn't match value count at row 1 I lsaw the PHP manual and some other resources that I have, but couldn't find anything about it... Any hint from someone?? Cheers Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Please Wait
Just curious if anyone out there knows how to do a Please wait type screen while the script is running in the background.. Like say PHP is doing a large select from a database, while the user waits for the script I'd like a graphic or something saying to wait... Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form element names starting with the + character????
Hello Dan, I'm sure you can google for it. Try: sql injection as your keyword. You'll find many interesting articles about it. Like this: (found at the end of results page) http://www.webmasterbase.com/article/794 HTH, - E Dan Tappin [EMAIL PROTECTED] wrote: Hello Edwin, What do you mean by SQL injection...? ...[snip]... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Please Wait
Hello, James Taylor [EMAIL PROTECTED] wrote: Just curious if anyone out there knows how to do a Please wait type screen while the script is running in the background.. Like say PHP is doing a large select from a database, while the user waits for the script I'd like a graphic or something saying to wait... Any ideas? I'm sure something like this was discussed many times recently. Check the archives: http://marc.theaimsgroup.com/?l=php-general And search for: progress bar or, animated gifs or any keyword that you think is relevant. HTH, - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] A newbie on Board!
Hi all, thanks for the prompt reply. The problem is not that I don't know how to use functions and all. I tried using various function. But I get fatal error everytime I use some function. I think, some extensions (dll files are missing in my installation of php.) how can I figure this out? Subodh Gupta Peter Houchin To: Subodh Gupta [EMAIL PROTECTED], [EMAIL PROTECTED][EMAIL PROTECTED] .au cc: Subject: RE: [PHP] A newbie on Board! 28/10/2002 12:02 PM jump along to php.net/manual/en and have a look in there and it will show ya how to connect to oracle ( I can't remember :D ) also check out phpbuilder.com and phpbeginner.com they'll both have tutorials for connecting to oracle from memory :) Cheers -Original Message- From: Subodh Gupta [mailto:Subodh.Gupta;seepz.tcs.co.in] Sent: Monday, 28 October 2002 5:18 PM To: [EMAIL PROTECTED] Subject: [PHP] A newbie on Board! Hi, I have just started off myself to learn PHP. I have installed PHP 4.2.3 and Apache 1.3.27. I have built some sample pages which are running fine. But now I want to integrate PHP with Oracle. Can somebody help me how to do it ? Subodh Gupta -- 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] general
hi, How do you refresh a php page , from within your code. i know that asp uses somthing buffer and expire = 0 or something. How do i test if a browser supports cookies or not? When i post a form and i push back , there is an page has expired message - why does it happen + what does it mean? Thanks Shaun -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cutted values after posting multiple select list
It doesn't work with $_POST and it doesn't work with $_GET... actually I thought there is no difference between the values in $_POST and $_REQUEST Does the example work on your box? Heiko Rick Emery wrote: use $_POST, not $_REQUEST - Original Message - From: Heiko Mundle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 25, 2002 10:39 AM Subject: [PHP] cutted values after posting multiple select list Hi i struggling with multiple select lists in HTML forms. The resulting $_REQUEST array cuts some characters from the values. If the value is value=99 i will get 99 after posting... my php file: *** htmlhead/head ?php echo {$_SERVER['REQUEST_URI']} br; echo First: {$_REQUEST['msel'][0]} br; echo Count: . count($_REQUEST['msel']) . brhr; $i = 0; foreach ($_REQUEST['msel'] as $v) { echo $i: $v br; $i++; } ? form method=GET action=?= $_SERVER['PHP_SELF'] ? select name=msel[] size=6 multiple=multiple option value=99erwin/option option value=9admin/option option value=hm10/option option value=999hm30/option option value=99muhe/option option value=9hannes/option /select input type=submit /form /body/html *** The result after selecting all: /PARAMOUNT/multisel2.php?msel%5B%5D=99msel%5B%5D=9msel%5B%5D=msel%5B%5D=999 msel%5B%5D=99msel%5B%5D=9 First: 99 Count: 6 0: 99 1: 9 2: 3: 999 4: 99 5: 9 MY system: PHP Version 4.2.3 Apache/1.3.26 SuSE Linux 8.1 When I use the same php file on a MS windows apache, it works Regards Heiko -- 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