Re: [PHP] Nested foreach ?

2004-10-17 Thread Stuart Felenstein
. Also I had only filled in 3 of the 5 for each. Thank you Stuart --- Robby Russell [EMAIL PROTECTED] wrote: On Sun, 2004-10-17 at 09:53 -0700, Stuart Felenstein wrote: I have 3 arrays. 3 for 3 fields in a table (all part of 1 record) array1 - field1 array2 - field2 array3

Re: [PHP] Nested foreach ?

2004-10-17 Thread Stuart Felenstein
] wrote: On Sun, 2004-10-17 at 12:40 -0700, Stuart Felenstein wrote: Robby Here is the printout : Using- print_r ($skills); print_r ($skys); print_r ($slus); Array ( [0] = skillone [1] = skilltwo [2] = skillthree [3] = [4] = ) Array ( [0] = 2 [1] = 3 [2] = 4 [3] = [4

Re: [PHP] Nested foreach ?

2004-10-17 Thread Stuart Felenstein
, 2004-10-17 at 13:08 -0700, Stuart Felenstein wrote: They are related in the sense that they are part of one record in the database. Fields Skill YearsUsed LastUsed When you say array of arrays you are referring to a multi-dimensional ? I'm not sure what you mean

Re: [PHP] Nested foreach ?

2004-10-17 Thread Stuart Felenstein
['slus'] = $_POST['slu']; So I need to grab the input and enter into database where each set of skill, sky , slu is a new record. I hope this is clearer. Stuart --- John Holmes [EMAIL PROTECTED] wrote: Stuart Felenstein wrote: Here is the printout : Using- print_r ($skills); print_r

Re: [PHP] Nested foreach ?

2004-10-18 Thread Stuart Felenstein
Not working. foreach($_SESSION['skills'] as $key = $skill) { $query = INSERT INTO table (skill, sky, sku) VALUES ('$skill', {$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]}); //run query } The foreach is generating an invalid argument. I'm just going to show again what I have

RE: [PHP] Nested foreach ?

2004-10-18 Thread Stuart Felenstein
Wish I had better news. Warning: Invalid argument supplied for foreach() in /home/lurkkcom/public_html/TestMultiTrans2.php on line 90 INSERT INTO LurkProfiles_Skicerts (ProfileID, SkilCerts, NumYear, Lused) VALUES () line 90: foreach($skills as $key = $skill) To confirm : I changed to this:

RE: [PHP] Nested foreach ?

2004-10-18 Thread Stuart Felenstein
Guess what , it's working ! The key (after yours and John's iteration lines) was adding these into the script: $skills = $_SESSION['skills']; $skys = $_SESSION['skys']; $slus = $_SESSION['slus']; A big thank you! to all who helped out here and for hanging in. Graham, thank you for continuing

[PHP] RE: [PHP-DB] Question: Putting separate form elements into an array

2004-10-17 Thread Stuart Felenstein
is the current situation? Iterating through the 3 arrays or inserting into MySQL? Graham -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: 17 October 2004 16:14 To: Stuart Felenstein; Graham Cossey; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Question

[PHP] Help: Suggestions for multi page form validation

2004-10-19 Thread Stuart Felenstein
I have a multi-page form that ends in the last page as a transaction to mysql. In the transaction there are a number of steps, i.e. query1 = Insert into .. run query1 query2 = Insert into . run query 2 query3 = Insert into .. run query 3 Then an if / else statement that

RE: [PHP] Help: Suggestions for multi page form validation

2004-10-19 Thread Stuart Felenstein
If it's okay I'll throw out two more questions then. 1-Probably a silly question, but is a faux pas if I don't do client side [javascript] validations ? 2a- Textboxes - provided I'm not allowing special characters (only alphanumeric) does this alone protect me from things like sql injections ?

RE: [PHP] Help: Suggestions for multi page form validation

2004-10-19 Thread Stuart Felenstein
-Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: 19 October 2004 10:26 To: Graham Cossey; [EMAIL PROTECTED] Subject: RE: [PHP] Help: Suggestions for multi page form validation If it's okay I'll throw out two more questions then. 1-Probably

[PHP] Extracting relevant text from a text file

2004-10-19 Thread Stuart Felenstein
Best way for me to explain this is by example - I just applied for a job and cut and past my resume into a textarea. After submitting it had extracted all the information and placed them into textfields. So my first name was now in the first name textfield, city was in the city field. Also ,

[PHP] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
After some back and forth posts here I had finally thought my array issue was over, but! To review I have 30 form elements on a page 10 are skill[] 10 are sky[] 10 are slu[] I pass them as session variables $_SESSION['skills'] = $_POST['skill']; $_SESSION['skys'] = $_POST['sky'];

RE: [PHP] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
statement within your foreach loop. If so, why use $_POST[skill[]] when you have $skill which is that current element being iterated? Did you read the foreach doc? http://uk2.php.net/manual/en/control-structures.foreach.php HTH Graham -Original Message- From: Stuart

RE: [PHP] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
= $_SESSION['skills']; Same for skys and slus. Graham -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: 20 October 2004 14:06 To: Graham Cossey; [EMAIL PROTECTED] Subject: RE: [PHP] Validation problem with array. My problem is not related to the insert

Re: [PHP] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
of echoing you would do your validation or substitution. On Oct 20, 2004, at 8:35 AM, Stuart Felenstein wrote: After some back and forth posts here I had finally thought my array issue was over, but! To review I have 30 form elements on a page 10 are skill[] 10 are sky[] 10 are slu

Re: [PHP] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
an associative array when you do that. In and input form, skill[0] and skill[a] are actually no different, aside from the name you are using for that element. On Oct 20, 2004, at 9:41 AM, Stuart Felenstein wrote: Brent, Thank you , I can't do an associative because it part

RE: [PHP] Validation problem with array.

2004-10-21 Thread Stuart Felenstein
See below: --- Graham Cossey [EMAIL PROTECTED] wrote: Also, this line : foreach($_SESSION['skills'] as $key = $skill) could read foreach($skills as $key = $skill) as you have the line: $skills = $_SESSION['skills']; Same for skys and slus. Graham Graham, I've read this over and over and

Re: [PHP] Validation problem with array.

2004-10-21 Thread Stuart Felenstein
You mean why do i have $_SESSION['skills'] in the foreach ? Stuart --- Andre Dubuc [EMAIL PROTECTED] wrote: Hi Stuart, I haven't followed your thread too closely, but I did see something that might be the cause of your problems: [snip] Let me show you how I set it all up. Remember

RE: [PHP] Validation problem with array.

2004-10-21 Thread Stuart Felenstein
Graham, I'm going to make those changes. Not sure if that was creating some crazy behaviour. See inline: --- Graham Cossey [EMAIL PROTECTED] wrote: { if ($skill != '') // Has this skill been entered? I don't know if I care if it's been entered. My main concern would

RE: [PHP] Validation problem with array.

2004-10-21 Thread Stuart Felenstein
See inline: --- Graham Cossey [EMAIL PROTECTED] wrote: In other words I need to figure out how to check that each line is complete. right now, it is matching all the values/inputs correctly. If someone just chose a slus, seems the database But is this due to the sql statement being

[PHP] Question: Validation on select boxes and lists.

2004-10-21 Thread Stuart Felenstein
Hope this is not off topic, and it might be a dumb question, but I'm new. For drop down menus, list boxes, selects etc, would validation be needed to check the string , say for special characters ? (as a security precaution) Thank Stuart -- PHP General Mailing List (http://www.php.net/) To

RE: [PHP] Question: Validation on select boxes and lists.

2004-10-21 Thread Stuart Felenstein
Graham, Thank you. Actually , you suggested this site to me the other day and it's great! I have read through a number of documents and have a few more to get through. How would a hacker pass an HTTP message ? That is interesting. Stuart --- Graham Cossey [EMAIL PROTECTED] wrote: [snip]

RE: [PHP] Question: Validation on select boxes and lists.

2004-10-22 Thread Stuart Felenstein
I just remembered something (smacks myself in the head) In both my multi select and select menus I use dynamic options (meaning the options available come from a table. So: Table for states would look like this: +--+---+ | StateID | State [Label|

[PHP] Question: Simpler loop

2004-10-22 Thread Stuart Felenstein
I have rows of input fields Each row contains 3 fields. The user must fill out the entire row (all 3 fields) for things to work right. I want to generate an error in case they have only filled in 1 or 2 of the boxes. Thinking I might use something like this: foreach($skills as $key = $skill)

RE: [PHP] Question: Simpler loop

2004-10-22 Thread Stuart Felenstein
Yes, I think that will work, as soon as I can figure out where on the page it should go. On error should post to itself, on success it moves to next page. I put the loop on top and am getting an invalid argument for the foreach. Stuart --- Ford, Mike [EMAIL PROTECTED] wrote: In which case:

[PHP] RE: Redirect - was Question: Simpler loop

2004-10-22 Thread Stuart Felenstein
I put the loop at the top of the next page, before any output to the browser: ?php if ($skill!='' $skys[$key]!='' $slus[$key] !='') { // row is valid -- do stuff } else { header(Location: http://www.2soon2show.com/TestMulti4a.php; ); print You have

[PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
I'm not quite sure how to get an error message to print out after a redirect. I know it's possible. Now page1 moves to page2, check below is on page2 If I leave it on page2 (without redirect), it prints error to user fine. Once it redirects no print. I also tried leaving it on form1, at the

RE: [PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
Now why didn't I think of that ! Thank you Jay! Stuart --- Jay Blanchard [EMAIL PROTECTED] wrote: [snip] { header(Location: http://www.xx.com/page1.php; ); print You have errors; exit; } } [/snip] You either need to carry info about the error in a

RE: [PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
This isn't working: Page2 (after page1 has been posted): else { $_SESSION['er'] = 'Please make sure to fill in all 3 corresponding values .'; header(Location: http://www.x.com/TestMulti4a.php; ); exit; } } Page1: Opening after session_start $_SESSION['er'] =

RE: [PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
Sorry, all fixed now! Thank you for the help! Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
See below: --- Jason Wong [EMAIL PROTECTED] wrote: What are you trying to do here? Is 'Page1' == TestMulti4a.php? Are you trying to display $_SESSION['er'] as set in Page2? If so why are you assigning $_POST['er'] to $_SESSION['er']? All you need to do is echo $_SESSION['er']. Yes

Re: [PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
The only problem I'm having here is that if a user goes backwards, the error from the session variable will show up. I put an unset $.. underneath the echo but that seems to have no effect. Stuart --- Stuart Felenstein [EMAIL PROTECTED] wrote: See below: --- Jason Wong [EMAIL PROTECTED

Re: [PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
Brent - Thank you I will try that method. Can you elaborate more on below. I take it to mean you have one page/script that your pages are going to do all the checks. This form is 5 pages long. So I chose session variables just to keep it neat and maybe, more secure. Stuart --- Brent

[PHP] Form madness maybe OT

2004-10-23 Thread Stuart Felenstein
I've tried about everything and have analyzed every bit of code but I can't seem to resolve this issue. It might be off topic since I can't say for sure if this is a php problem. The issue - I have a multi page form. One page seems to throw a wrench in the whole process every time I make a simple

Re: [PHP] Form madness maybe OT

2004-10-23 Thread Stuart Felenstein
--- Andre Dubuc [EMAIL PROTECTED] wrote: Stuart, I'm no expert, but did you flush your browser? Hth, Andre Andre, thank you for the response. I'm not sure what you mean by flush the browser ? Here is what I've been doing. First, I have denied cookies from the site. Second, I've

Re: [PHP] Form madness maybe OT

2004-10-23 Thread Stuart Felenstein
--- Andre Dubuc [EMAIL PROTECTED] wrote: Stuart, Go to your browser settings, under 'Cache' (or something similar) then clear the cache. I struggled with a similar problem for days . . . Andre I did that, and didn't change the situation. Also I think the fact that using the

Re: [PHP] Form madness maybe OT

2004-10-23 Thread Stuart Felenstein
Call off the troops. I reconstructed the form, step by step checking each step. All seems to be working. Stuart --- Stuart Felenstein [EMAIL PROTECTED] wrote: --- Andre Dubuc [EMAIL PROTECTED] wrote: Stuart, Go to your browser settings, under 'Cache' (or something similar

[PHP] Help: Database search and results

2004-10-24 Thread Stuart Felenstein
I have created a database search and results set. Things seem to work fine until I add the join statements into the results page query string. If I don't use the joins , the search works great. It returns the correct results based on the criteria input. If I add the joins in, then basically all

[PHP] SOLVED Re: [PHP] Help: Database search and results

2004-10-24 Thread Stuart Felenstein
Wow~! I'm getting good. --- Stuart Felenstein [EMAIL PROTECTED] wrote: I have created a database search and results set. Things seem to work fine until I add the join statements into the results page query string. If I don't use the joins , the search works great. It returns the correct

Re: [PHP] Help: Database search and results

2004-10-24 Thread Stuart Felenstein
Ooops, not solved yet. --- Stuart Felenstein [EMAIL PROTECTED] wrote: I have created a database search and results set. Things seem to work fine until I add the join statements into the results page query string. If I don't use the joins , the search works great. It returns the correct results

[PHP] Validation and session variables

2004-10-26 Thread Stuart Felenstein
Having some odd behaviour. First , let me mention this is a multi page form using session variables. (This might be important) So I am doing a page by page validation, and have tried putting the code before session_start or after. Either way my session variables are getting lost. Now in order

Re: [PHP] Validation and session variables

2004-10-26 Thread Stuart Felenstein
to the page itself ($PHP_SELF or putting in the path). Is the session variables being set using $SESSION['']? Respectfully, Ligaya Turmelle Stuart Felenstein wrote: Having some odd behaviour. First , let me mention this is a multi page form using session variables. (This might

RE: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein
See inline: --- Ford, Mike [EMAIL PROTECTED] wrote: The only circumstance under which I can think this might happen is if the session id is not being propagated by cookie -- either because they're blocked in the browser, or because you have them switched off in php.ini. They are not

Re: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein
Yes I do have session_start on every page at the top. Stuart --- Marek Kilimajer [EMAIL PROTECTED] wrote: Stuart Felenstein wrote: Yes the session variables are set with $SESSION[''}. The way it works is the variable gets set on the follwing pages: So, example on page 1: I have

RE: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein
Okay, I altered the code. Same thing, session variables gone. I then deleted the session only cookie. Also took the rule out in the browser , so browser is accepting all cookies from site. Still no change. Not to be redundant but here is the code again:(I xxx'ed out some fields in the restrict

Re: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein
--- Chris Shiflett [EMAIL PROTECTED] wrote: So, the first thing to try is using a proper Location header: header('Location: http://example.org/success.php'); Hope that helps. Chris Thank Chris , but met with same behaviour. 2 Questions: 1- Should I drop the $url line ? I tried both

Re: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein
,$WAFV_Errors,page2); or is it solely in: session_write_close() if ($_SERVER[REQUEST_METHOD] == POST) { $url = TestMulti3.php; Header ('Location: http://www.mysite.com/page3.php); Thank you , Stuart --- Jason Wong [EMAIL PROTECTED] wrote: On Wednesday 27 October 2004 11:31, Stuart Felenstein

Re: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein
--- Chris Shiflett [EMAIL PROTECTED] wrote: On each page, it might be good to add some debugging information near the top (where session_start() is): ?php session_start(); echo 'pre' . htmlentities(print_r($_COOKIE, true)) . '/pre'; echo 'pre' . htmlentities(print_r($_GET, true)) .

Re: [PHP] Validation and session variables

2004-10-27 Thread Stuart Felenstein
--- Chris Shiflett [EMAIL PROTECTED] wrote: This is most likely due to your malformed Location header. It requires an absolute URL, and some browsers (notably several versions of IE, but there may be others) do not send the proper Cookie header when requesting the new URL if you use a

Re: [PHP] SOLVED - Validation and session variables

2004-10-27 Thread Stuart Felenstein
I guess this was the one thing I overlooked. Since the page had to return to itself if validation errors, it was already set in the validation script to do so. So, as I had shown in my original post the form action was blank ..well Simple solution to keeping my session vars, set action to

[PHP] Validation and session variables

2004-10-28 Thread Stuart Felenstein
I guess my resolution was a fluke. Recap: Adding validation kills my session variables Now I tested a few things, SID is consistent across pages, so a new sid and cookie are not being generated. Perhaps it's a bug, Im on PHP 4.3.8 Here is the code again, perhaps something will jump out. ?php

RE: [PHP] Validation and session variables

2004-10-28 Thread Stuart Felenstein
--- Graham Cossey [EMAIL PROTECTED] wrote: I think we need to know what happens when this function returns the user to the script upon finding an error. Are all the form field values passed back? Doesn't seem that they are. I tripped an error on page1 , had an echo set for the first

RE: [PHP] Validation and session variables

2004-10-28 Thread Stuart Felenstein
--- Graham Cossey [EMAIL PROTECTED] wrote: I think we need to know what happens when this function returns the user to the script upon finding an error. Are all the form field values passed back? Does it do anything at all with the session? Does it pass the SID? I want to append my

[PHP] Code help on a multi select list

2004-10-29 Thread Stuart Felenstein
I want to do a server side trap if a user selects more from a mult select list then allowed. Just unsure and didn't find any examples. Seems people rely more on javascript these days. So here is how I grab the array: if ( is_array( $_REQUEST['LurkerIndustry'] ) ) { $_SESSION['l_industry'] =

RE: [PHP] Code help on a multi select list

2004-10-29 Thread Stuart Felenstein
--- Reinhart Viane [EMAIL PROTECTED] wrote: I would choose javascript to to check this This response I don't understand. There are 50 options and the intent is to allow 3 of those 50. Then some genius comes along and turns off javascripting and chooses all 50. I KNOW it will happen. I

RE: [PHP] Code help on a multi select list

2004-10-29 Thread Stuart Felenstein
--- Jay Blanchard [EMAIL PROTECTED] wrote: What is not to understand here...you are the one who said, I want to do a server side trap. JavaScript would be the only way to do that. Sorry, I used the wrong terminology. I think my statement was interpreted as using javascript at the server

Re: [PHP] Code help on a multi select list

2004-10-29 Thread Stuart Felenstein
--- Greg Donald [EMAIL PROTECTED] wrote: Bah.. Mountain Dew and a couple of Sudafed is where it's at. :) That just doesn't sound right. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Session and validation

2004-10-29 Thread Stuart Felenstein
I had this thread going yesterday. Then basically think it reached a stalemate. I'm wondering has anyone setup forms using session variables and validation. Validation where the validating is done on the same page, and the redirected on success ? Maybe that is my problem , that session

Re: [PHP] Session and validation

2004-10-30 Thread Stuart Felenstein
--- Chris Shiflett [EMAIL PROTECTED] wrote: --- Stuart Felenstein [EMAIL PROTECTED] wrote: I had this thread going yesterday. Then basically think it reached a stalemate. I think you need to try to simplify your code to the most basic example that demonstrates the problem. By doing

RE: [PHP] Session and validation

2004-10-30 Thread Stuart Felenstein
--- Graham Cossey [EMAIL PROTECTED] wrote: So, if this is the result of a form submission how are you getting the POST variables? How/where is $industry being set? I appears that you are assuming that variables are 'maintained' within a script, they are not. You have to remember that

Re: [PHP] VOTE TODAY

2004-11-03 Thread Stuart Felenstein
--- Angelo Zanetti [EMAIL PROTECTED] wrote: [snip] session_start(); $_SESSION['foo']= screw all this political bullsh1t! who cares about the americans, they are just after oil and I dont care as long as bush doesnt win. long live iraq!!!; unset($foo); session_destroy(); --

[PHP] Lost session variables still confounding me

2004-11-04 Thread Stuart Felenstein
I think I've tried just about everything that I found googling. Still no luck. I'm throwing this out again, with the chance that something missed before maybe noticed. Page 1: //Start the Session - begin Block @session_start(); form method=POST name=form1 action=Page2.php input name=ListingName

Re: [PHP] Lost session variables still confounding me

2004-11-04 Thread Stuart Felenstein
--- Richard Davey [EMAIL PROTECTED] wrote: Unless I'm mistaken - you are redirecting back to Page 2 upon an error, right? Well according to the code posted, the second you hit Page 2 again, you are over-writing whatever is in the f1a session variable with the contents of the $_POST var,

Re: Re[2]: [PHP] Lost session variables still confounding me

2004-11-04 Thread Stuart Felenstein
--- Richard Davey [EMAIL PROTECTED] wrote: Before setting the session value in Page 2, check for the existence of the $_POST value first. if (isset($_POST['var'])) { $_SESSION['var'] = $_POST['var']; } When you now redirect to Page 2 upon an error, it'll skip this block because

RE: Re[2]: [PHP] Lost session variables still confounding me

2004-11-04 Thread Stuart Felenstein
--- Reinhart Viane [EMAIL PROTECTED] wrote: Suppose Richard means: If (isset($_POST['ListingName'])) { $_SESSION['f1a'] = $_POST['ListingName']; } Right, I've tried all three variations , none of which, I'm sorry to report, have helped. The variable is alive with any of the code

RE: Re[2]: [PHP] Lost session variables still confounding me

2004-11-04 Thread Stuart Felenstein
--- Reinhart Viane [EMAIL PROTECTED] wrote: So, if I understand correct, even with the isset code on the second page $_SESSION['f1a'] is set to empty? That's strange. Still I wonder why you are inputting the error messages and the redirect in a session variable. Yes, the isset is not

RE: Re[2]: [PHP] Lost session variables still confounding me

2004-11-04 Thread Stuart Felenstein
--- Ford, Mike [EMAIL PROTECTED] wrote: Page3: if (count($LurkerIndustry) 5) { $_SESSION['arrayerr'] = you have selected too many industries; $_SESSION['f1a'] = $_POST['ListingName']; header (Location: TestMulti2.php); exit; } Well, that's even worse -- because page3 can

Re: Re[4]: [PHP] Lost session variables still confounding me

2004-11-04 Thread Stuart Felenstein
--- Richard Davey [EMAIL PROTECTED] wrote: Try sticking this on Page 2 (ensure you have a session_start() at the top of the page and that you replace the 'var' text below with the correct ones. if (isset($_POST['var'])) { echo 'POST value found, setting the session var now';

RE: Re[2]: [PHP] Lost session variables still confounding me

2004-11-04 Thread Stuart Felenstein
--- Ford, Mike [EMAIL PROTECTED] wrote: Page 3: if (count($myarray) 5): $_SESSION['arrayerr'] = you have selected too many industries; session_write_close(); header (Location: Page2.php?.SID); exit; endif; Hope this helps. Mike, once again you've come

Re: Re[2]: [PHP] Lost session variables still confounding me

2004-11-04 Thread Stuart Felenstein
--- Jason Wong [EMAIL PROTECTED] wrote: Maybe what you had before was: if (count($myarray) 5) $_SESSION['arrayerr'] = you have selected too many industries; session_write_close(); header (Location: Page2.php?.SID); exit; And yes that has a totally

[PHP] Question: Validation on a text field

2004-11-04 Thread Stuart Felenstein
I have a field that is an actual Mysql Text column, aka like a blob. I'm wondering if doing a standard validation that checks for characters outside of the alphanumeric range is enough. I'm imagining some users will cut and paste from a Word or PDF doc into the field. I've done it myself and no

RE: [PHP] Question: Validation on a text field

2004-11-04 Thread Stuart Felenstein
It's a mysql text field. Stuart --- Jay Blanchard [EMAIL PROTECTED] wrote: [snip] Any thoughts ? [/snip] I thought I'd have lunch today, but I didn't. Is it a 'text' data type, or 'BLOB', (you said, actual Mysql Text column, aka like a blob) because the distinction is needed. --

RE: [PHP] Question: Validation on a text field

2004-11-04 Thread Stuart Felenstein
--- Vail, Warren [EMAIL PROTECTED] wrote: I also don't know if MySQL will police things input to a text column to make sure they are valid ascii text characters. No Mysql won't do it. PHP validation would have to be involved. Stuart -- PHP General Mailing List (http://www.php.net/) To

RE: [PHP] Question: Validation on a text field

2004-11-04 Thread Stuart Felenstein
May I ask why you are suggesting this function ? Stuart --- Jay Blanchard [EMAIL PROTECTED] wrote: [snip] It's a mysql text field. [/snip] You can use htmlentities() on the information placed into the field -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

RE: [PHP] Question: Validation on a text field

2004-11-04 Thread Stuart Felenstein
--- Jay Blanchard [EMAIL PROTECTED] wrote: [snip] May I ask why you are suggesting this function ? You can use htmlentities() on the information placed [/snip] Because it will convert things like quotes into their HTML counterparts before you place them into the table. I'm still a

Re: [PHP] Question: Validation on a text field

2004-11-04 Thread Stuart Felenstein
--- Ben Ramsey [EMAIL PROTECTED] wrote: You should also use mysql_real_escape_string() on the data from the client. Even though Magic Quotes GPC is turned on ? Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Initializing variables

2004-11-05 Thread Stuart Felenstein
I'm reading PHP security paper by Chris Shiflett. Trying to figure out what is meant by first initializing a variable. Now, just for the record, I'm not completely dumb. I know you can start with a $var = 2 What I want to know is if the variable assignment is unknown, as in a user form. Would

[PHP] Questions about mysql_real_escape_string and addslashes

2004-11-06 Thread Stuart Felenstein
First I'm a bit unsure , because in the manual it states that you must use mysql_real_escape_string on binary data. So first question, what constitutues binary data, a file or just an integer? Second question - Since magic_quote_gpc is enabled on my server (and I have no choice) - I gather I

Re: [PHP] Re: Questions about mysql_real_escape_string and addslashes

2004-11-06 Thread Stuart Felenstein
--- M. Sokolewicz [EMAIL PROTECTED] wrote: (http://www.php.net/manual/en/function.mysql-real-escape-string.php) I have my eye on example 3: The Quote_Smart function. Do I have to list all the variables out though or is there a way to have it check everything passing through ? What would nice

[PHP] Question: Passing error messages

2004-11-06 Thread Stuart Felenstein
I've started getting into the habit of passing error messages through session variables, particularly on redirects. From some peoples reaction on this list I gather it's not the best practice. What is an alternative way ? I believe it's through a URL. not sure how to go about that method Stuart

Re: [PHP] Re: Question: Passing error messages

2004-11-06 Thread Stuart Felenstein
--- Daniel Schierbeck [EMAIL PROTECTED] wrote: I'm not quite getting what you're saying - are you sending the error messages on to a new page?! The usual and simple way of doing this is the good 'ol OR operator: I'm saying, currently if there is an error and the script needs to exit,

Re: [PHP] Re: Question: Passing error messages

2004-11-06 Thread Stuart Felenstein
--- Daniel Schierbeck [EMAIL PROTECTED] wrote: Where are you redirecting the client to? An error page? Either an error page or back out to a main page. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Nested foreach ?

2004-10-17 Thread Stuart Felenstein
I have 3 arrays. 3 for 3 fields in a table (all part of 1 record) array1 - field1 array2 - field2 array3 - field3 What I've been doing which works good with one array: if ( is_array( $_SESSION['foo'] ) ) { foreach ( $_SESSION['foo'] as $x ) { sql .= INSERT INTO TABLE (...

[PHP] Help:escape_string and stripslashes

2004-11-07 Thread Stuart Felenstein
I asked a question yesterday about this but I think my question is now more fine tuned: Right now I have about 50+ session variables that will be inserted into my mysql database in a transaction. I need to do the mysql_real_escape_string and because magic_quotes_gpc is turned on stripslashes as

Re: [PHP] Help:escape_string and stripslashes

2004-11-07 Thread Stuart Felenstein
--- Jordi Canals [EMAIL PROTECTED] wrote: In the manual http://es2.php.net/manual/en/function.get-magic-quotes-gpc.php you have an example just for that. Take a look to the Example 2. Ok, that makes sense. Thank you . Stuart -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Help:escape_string and stripslashes

2004-11-07 Thread Stuart Felenstein
--- Stuart Felenstein [EMAIL PROTECTED] wrote: On second thought, I have a question. What is the $value in the example ? Does that mean I put in my own values ? Stuart ?php if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value

Re: [PHP] Help:escape_string and stripslashes

2004-11-07 Thread Stuart Felenstein
--- Jason Wong [EMAIL PROTECTED] wrote: 2) Lookup array_map() and understand what it does. 3) stripslashes_deep() is a recursive function (ie. it calls itself). You should find a good tutorial on recursive functions to learn exactly what it does. Thank you Jason. Another thing I'm

[PHP] Question: array_walk

2004-11-07 Thread Stuart Felenstein
This array_walk() looks like a good function Would this be a legitimate call: array_walk($myarray, 'mysql_real_escape_string'); ? Thank you, Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Array_Walk error messages

2004-11-07 Thread Stuart Felenstein
Can anyone give me a clue what I have done wrong here. //These would be passed as ints: array_walk($l_industry, 'mysql_escape_string'); Warning: Wrong parameter count for mysql_escape_string() in /xxx//public_html/Test2.php on line 104 //These would be passed as ints: array_walk($l_tterm,

[PHP] Question: Exiting a script

2004-11-08 Thread Stuart Felenstein
Say I have a script that processes input data. How do I get the script to work, where after processing the user is taken to another page ? The script outputs nothing to the screen and will end either in failure or success. Seems header won't work for me. Stuart -- PHP General Mailing List

Re: [PHP] Question: Exiting a script

2004-11-08 Thread Stuart Felenstein
--- Richard Davey [EMAIL PROTECTED] wrote: some text or white-space, aborting'; } else { Richard Davey I think white space is my problem. What causes white space ? Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Question: Exiting a script

2004-11-08 Thread Stuart Felenstein
Never mind , I found it! !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/ TR/xhtml1/DTD/xhtml1-transitional.dtd One of these days I'll master the header function ;) Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

[PHP] Variable for search results

2004-11-08 Thread Stuart Felenstein
I have a form element which allows a user to go back x number of days in the records. $sql.=sprintf(SELECT * FROM records WHERE Date_Sub(Curdate(), interval day) $%s = PostStart) This formula works when I actually hardcode the number of days in where this mess -- $%s is right now. I'm not

Re: [PHP] Re: Variable for search results

2004-11-08 Thread Stuart Felenstein
--- Ben Ramsey [EMAIL PROTECTED] wrote: I'm not exactly sure what the SQL statement you have above is supposed to do, but you could just do something like this: $curdate = date('Y-m-d H:i:s'); $sql = SELECT * FROM records WHERE '$curdate' = PostStart;; I'm having some problems still.

[PHP] Help: Database Search

2004-11-10 Thread Stuart Felenstein
I am creating a database search form and results. Running into a problem though. I have two form elements, both that are fed by tables that have int values (1, 2 , etc) my sql statement is such: SELECT vendorjobs.PostStart, vendorjobs.JobTitle, vendorjobs.Industry, vendorjobs.VendorID,

Re: [PHP] Help: Database Search

2004-11-10 Thread Stuart Felenstein
--- Jon Hill [EMAIL PROTECTED] wrote: You might want to try looking up the syntax for left join queries. I think this might be what you are after. http://dev.mysql.com/doc/mysql/en/JOIN.html It has nothing to do with left joins. It works fine provided I do one of two things, make

Re: [PHP] Help: Database Search

2004-11-10 Thread Stuart Felenstein
--- Jason Wong [EMAIL PROTECTED] wrote: Why not build your sql query according to whether or not whatever you want is selected or not. That way debugging is easier as you won't be looking at queries that contain redundant ... AND 0 Jason, How would I do that ? Care to share a

[PHP] Looking for pointers to mysql functions

2004-11-11 Thread Stuart Felenstein
I'm building a search function and I think most of the search part is solid. Now I'm trying to figure out the results part. Since my results would return about 7 fields per record, I'm thinking mysql_fetch_row over mysql results works better ? But I don't want every field from the row returned,

Re: [PHP] Looking for pointers to mysql functions

2004-11-11 Thread Stuart Felenstein
--- [EMAIL PROTECTED] wrote: This would be handled in your query, so get a SQL book or look into the mysql documentation... Look at the select statement, to request specific fields, as well as the Limit keyword to return a certain number of results per page. -B So there is no php

  1   2   >