Re: [PHP] newbY prob

2003-07-23 Thread CPT John W. Holmes
From: Jennifer Goodie [EMAIL PROTECTED] ! am trying to count the number of items in this table. The table has one field in it. The code I am using is: $dbquerymeal = select COUNT(*) from mealtype; $resultmeal = mysql_db_query($dbname,$dbqueryshipping1); if(mysql_error()!=){echo

Re: [PHP] Some SESSION Vars not Registering

2003-07-23 Thread CPT John W. Holmes
From: Jeff Stillwall [EMAIL PROTECTED] Now I'm (possibly) getting somewhere: When I modify the function to be this (notice the key name change by adding s): function setupUserEnv ($userArray) { $_SESSION['loggedIn'] = 1; foreach($userArray as $key=$value) { echo

Re: [PHP] Global variable question question

2003-07-23 Thread CPT John W. Holmes
When registered globals is set to off this does not effect the $PHP_SELF variable right? In other words I should be able to call $PHP_SELF with out having to do this $_SERVER['PHP_SELF'], right? No. With register_globals OFF, $PHP_SELF is not set. ---John Holmes... -- PHP General Mailing

Re: [PHP] Search question ..

2003-07-23 Thread CPT John W. Holmes
From: Curt Zirzow [EMAIL PROTECTED] * Thus wrote James Hatridge ([EMAIL PROTECTED]): I've got a search page written for my web site. I can find the html page I want by keyword. Now I need to get the title of that page in to a variable. In other words I have a file name, for example

Re: [PHP] I'm really getting annoyed with PHP

2003-07-23 Thread CPT John W. Holmes
From: Beauford.2005 [EMAIL PROTECTED] Yes, I'm still screwing around with this stupid redirection thing, and either I'm just a total idiot or there are some serious problems with PHP. I have now tried to do it another way and - yes - you guessed it. It does not work. I mean really, it can

Re: [PHP] Problem with MySQL Query

2003-07-23 Thread CPT John W. Holmes
Take out the plus sign... type != 'Meal Plans' And using single quotes in your query might make things easier (no escaping...) $dbqueryshipping1 = select * from tempuserpurchase where usersessionid='$User_Shopping_Id' and day='1' and type!='Meal Plans'; You don't need quotes around '1' since

Re: [PHP] Software Application Engineer WANTED (PHP/MySQL Guru)

2003-07-23 Thread CPT John W. Holmes
Subject: [PHP] Software Application Engineer WANTED (PHP/MySQL Guru) I hope there are job postings like this if/when I get out of the Army! :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] just looking for some opinions...

2003-07-24 Thread CPT John W. Holmes
Let's say I have a number: 1281924 The rules call for removing 1280+, meaning remove 128 and all 0's that come after it, until you run into another number. In the end, it would leave 1924, and everything else on the beginning would be gone. $new_number =

Re: [PHP] Rewrite img and a tags.

2003-07-25 Thread CPT John W. Holmes
How can I easiest rewrite A and IMG tags? I'm fetching a page with fsockopen() and I need to rewrite these tags before sending it on to a user. My own theory is that it's made with Regular Expressions. I just don't know these myself. If you're writing one of those anonymous browsing programs

Re: [PHP] Debugging a Session Problem

2003-07-25 Thread CPT John W. Holmes
From: Lee Stewart [EMAIL PROTECTED] I'm moving an application that I'm in the trying to move to a new platform. It was running fine on an older Linux platform with PHP 4.0.3 and Apache 1.3.14. The new platform is also Linux, with PHP 4.2.2 and Apache 1.2.26 -- with register_globals on. (I

Re: [PHP] file_put_contents()?

2003-07-25 Thread CPT John W. Holmes
Another stupid newbie question...(btw, is there a list more geared towards the newbies?) Yes, it's called the manual. Is the file_put_contents() function not available in PHP 4.3.2? Seriously: www.php.net/file_put_contents ---John Holmes... -- PHP General Mailing List

Re: [PHP] variable in function parameter

2003-07-28 Thread CPT John W. Holmes
* Thus wrote 386-DX ([EMAIL PROTECTED]): Hello. Let's say I have something like this: function aa($test) { $a = 8; echo $test; } $a = 2; aa(a is . ($a5?greater:equal to or less). than 5.); http://php.net/eval No... you need to make $a global within the function for

Re: [PHP] Store array as Session Variable

2003-07-28 Thread CPT John W. Holmes
$details is an array (just like $company_name was). Try to view print_r($details); and see what you get. ---John Holmes... - Original Message - From: Pushpinder Singh Garcha [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 28, 2003 3:18 PM Subject: [PHP] Store array as Session

Re: [PHP] Store array as Session Variable

2003-07-28 Thread CPT John W. Holmes
I am able to see the contents of the $company_name array. The next part involves storing this as a session variable. I am trying to link this page to another search page using the a href=\full-profile.php?name=.$row['company']. \--Link--/a If you're passing the company name in the URL,

Re: [PHP] learning php - problem already

2003-07-29 Thread CPT John W. Holmes
Hello everyone, Am new to php and have run into a problem while reading my book... can anybody tell me what does this mean: Hi... let's see who gets this one first... :) foreach($invoice as $number = $pppno) $invoice is an array. foreach() is going to loop through that array one element at a

Re: [PHP] Files created by PHP/Apache

2003-07-30 Thread CPT John W. Holmes
I've got a problem with preconfigured server (Apache 1.3/MySQL 3/PHP 4): Files and directories created by a PHP script are always owned by the apache user and apache group. But the script itself is inside of a virtualhost which has another user and group (web2 / ftponly)! So in fact the

Re: [PHP] cookies on localhost WinXP

2003-07-30 Thread CPT John W. Holmes
I have PHP/Apache/MySQL installed on my WinXP laptop. I do this so that I can write programs when not connected to the Internet (like when traveling). I am trying to set a cookie from the http://localhost site on my computer and it doesn't get set. Does this sound like something wrong in

Re: [PHP] downloading a file using headers

2003-07-30 Thread CPT John W. Holmes
I have a page that queries the database then uses the data to build an excel spreasheet. THat spreadsheet is downloaded according to info in the headers. My manager wants to put the page inside of another HTML page to make it prettier, but then it breaks because headers are already written

Re: [PHP] cookies on localhost WinXP

2003-07-30 Thread CPT John W. Holmes
h. This seemed to set the cookie just fine. Does this mean that either localhost in the browser or Apache/PHP on a windows box has to set the cookie differently than on RedHat/Apache/PHP? I am going on vacation next week and need to keep working on a project that is working fine on the

Re: [PHP] cookies on localhost WinXP

2003-07-30 Thread CPT John W. Holmes
From: Steve Buehler [EMAIL PROTECTED] hm. Looks like on my localhost I can't seta cookie like this: setcookie (coach_access[login_id], coach,0,/,$cookhost); if I change it to just: setcookie (coach_access_login_id, coach,0,/,$cookhost); it will work. But then my script won't work

Re: [PHP] learning php - problem already

2003-07-31 Thread CPT John W. Holmes
From: Ford, Mike [LSS] [EMAIL PROTECTED] From: John W. Holmes [mailto:[EMAIL PROTECTED] The four element array will be 1 = 'one' value = 'one' 0 = 0 key = 0 OK, some more red pen coming along Since we're whipping them out (red pens that is) The four-element array would actually

Re: [PHP] Where am i screwing up?

2003-07-31 Thread CPT John W. Holmes
From: Ryan A [EMAIL PROTECTED] I am just screwing around and getting used to arrays with a foreach thanks to Michael,Jan and Evan from this list and have run into problems. My requirment is pretty simple (code is below too) 1)unset all the sessions that might have been set with reference to

Re: [PHP] Re: php path statement appears on my webpages

2003-07-31 Thread CPT John W. Holmes
Thanks, but if I leave off this line then I get an error when I try and view my pages. What kind of error, exactly? You need to determine if you're running PHP as a module or CGI. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] session header issue

2003-07-31 Thread CPT John W. Holmes
From: Ow Mun Heng [EMAIL PROTECTED] snip The Location: header requires a correctly formed URL, ie http://... /snip I'm running fine using only Location:home.php on Mozilla IE 6 maybe I should change. Please see my previous emails on the difference between works and right... ---John

Re: [PHP] Formatted text from mySQL DB

2003-08-05 Thread CPT John W. Holmes
From: PHPSpooky [EMAIL PROTECTED] When I create any field and let data be sent into my mySQL DB through it.. it goes ok. But when I retrieve it.. the data comes completely unformatted. Ah, this question again. Has it been four days already? HTML does not render new lines. Have a look at the

Re: [PHP] PHP/JavaScript/HTML

2003-08-05 Thread CPT John W. Holmes
From: Mauricio [EMAIL PROTECTED] I wrote a JavaScript to set the values of a Select html object by client side. The values are copied from another Select that I create getting the values from the database. After the user set the values he/she wants to add it in another form, for example, then

Re: [PHP] Repopulating forms

2003-08-05 Thread CPT John W. Holmes
From: Gerard L Petersen [EMAIL PROTECTED] My code looks like this. ?PHP $test = gerard's name is \gerard\; echo $test.br; echo 'input type=text name=test2 value='.$test.'br'; ? Just like HTML doesn't render newlines, it also doesn't understand using the \ character as an escape character.

Re: [PHP] PHP/JavaScript/HTML

2003-08-05 Thread CPT John W. Holmes
From: Mauricio [EMAIL PROTECTED] On the Address Bar I can see: index.php?slcAdd=1slcAdd=2slcAdd=3 But when I get the value using $HTTP_GET_VARS['slcAdd']; it returns just the last value. What can I do to get them all? Name your select box as slcAdd[] and you'll have all of the values in an

Re: [PHP] Parse error not understood

2003-08-07 Thread CPT John W. Holmes
From: Chris Blake [EMAIL PROTECTED] [snip] //If Delete User is selected-- if ( $_REQUEST['useroption'] == 'delete') { [snip] No matter which option I select I get the following output : -- Parse error: parse error, unexpected $ in /var/www/html/Sessions/userman.php on line 83

Re: [PHP] error: cannot redeclare ()

2003-08-07 Thread CPT John W. Holmes
From: Martin Towell [EMAIL PROTECTED] I'm getting the following error: PHP Fatal error: Cannot redeclare () (previously declared in /path/to/file/functions.inc:19) in /path/to/file/functions.inc on line 0 Anyone have any ideas how a no-name function could be generated? Line 19 contains:

Re: [PHP] Correct Coding

2003-08-07 Thread CPT John W. Holmes
From: Martin Peck [EMAIL PROTECTED] That can generate an error if $Task was never assigned a value. could you not do if(@$Task == Add ){do something } to suppress the error of the variable not being set? I have never seen php give an error if $Task is not set to anything. I

Re: [PHP] Hitler and Recent Threads

2003-08-07 Thread CPT John W. Holmes
From: Mark [EMAIL PROTECTED] And as they say, Never argue with a fool. People will not be able to tell the differnce. I thought it was Never argue with an idiot. They drag you down to their level and beat you with experience :) ---John Holmes... -- PHP General Mailing List

Re: [PHP] Downloding files once

2003-08-07 Thread CPT John W. Holmes
From: Boaz Yahav [EMAIL PROTECTED] Can you fake a referrer by say, using fsockopen() and sending your own headers? Yep. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: [PHP-DB] Sorting issue

2003-08-08 Thread CPT John W. Holmes
Jeff [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Why would a mysql db think that 55 was greater than 14000. I have several headings that display sql data under them, when you click on the heading, it sorts that section (descending/ascending), but it only seems to be looking at

Re: [PHP] setting function variables

2003-08-09 Thread CPT John W. Holmes
From: Mark [EMAIL PROTECTED] I seem to learn something new every time you or Jennifer post (many others as well). I never knew about variable functions. Cool! You're welcome. I wouldn't recommend that solution exactly (an abstraction class would be better), but the functions do come in handy.

Re: [PHP] htmlspecialchars() and HTML code

2003-08-10 Thread CPT John W. Holmes
From: Thaddeus J. Quintin [EMAIL PROTECTED] I'm working on a site where users have the option to type HTML code into a textarea, or upload HTML code from a local file which is then displayed in the text area. The obvious problem is that an uploaded file that contains a closing tag for a

Re: [PHP] how do i get assosciative name in foreach

2003-08-10 Thread CPT John W. Holmes
From: Dan Anderson [EMAIL PROTECTED] I want to do: ?php $array['element1'] = 'element1'; $array['element2'] = 'element2'; foreach ($array as $element) { // assuming get_assoc gets the assosciative name if (get_assoc($element) == 'element1') {get_assoc($element)

Re: [PHP] Stop neurotic posting

2003-08-10 Thread CPT John W. Holmes
Honestly, if you people ignored the stupid responses as much as you want us to ignore the stupid questions... we wouldn't be having this discussion. ---John Holmes... - Original Message - From: Nicholas Robinson [EMAIL PROTECTED] To: andu [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent:

Re: [PHP] Validate The Last Day of Month with server's clock????

2003-08-14 Thread CPT John W. Holmes
From: Nicholas Robinson [EMAIL PROTECTED] The 'usual' trick is to set the date to the first day of the month after the one you want and then subtract one day. Along those same lines, this works: ?php $month = 12; $year = 2003; $last_day_of_month = mktime(12,0,0,$month+1,0,$year); echo

Re: [PHP] Config files

2003-08-14 Thread CPT John W. Holmes
From: Hardik Doshi [EMAIL PROTECTED] I have following options for working with the configuration files with the relatively large web application. 1. Configuration variables using the DEFINE. 2. Array - Each configuration variable as an array element. 3. PHP.INI like config files. A

Re: [PHP] PHP Session Problem!.....urgent!

2003-08-14 Thread CPT John W. Holmes
From: [EMAIL PROTECTED] Dear Sir, You don't have to call me that unless you're in the military, also. :) I've been using PHP for business and personal use for a while now, and I have to admit, I'm not just a user anymore and I am a fan. but it's been a while I came across a problem : I use

Re: [PHP] Sum a column of values from a MySQL query

2003-08-14 Thread CPT John W. Holmes
Sorry, Jay, but that's a horrible method. You could just run one query with a GROUP BY clause to get the sum for each invoiceID, instead of running multiple queries like you've mentioned... $query = SELECT invoiceid, SUM(partpaidamount) AS partpaid FROM $tb_name GROUP BY invoiceid; $rs =

Re: [PHP] greedy preg

2003-08-14 Thread CPT John W. Holmes
From: skate [EMAIL PROTECTED] $contents = preg_replace( |item.*?.$file..*?/item|si, , $contents ); okay, so i figured out that it's matching the first occurence of item which will always be the first record and then going on to match the $file and deleting everything between. obviously not

Re: [PHP] image button problem

2003-08-14 Thread CPT John W. Holmes
From: Abdul-wahid Paterson [EMAIL PROTECTED] I am trying to create an HTML form that has several image buttons on it and the resulting action depends on which button is pressed. I first tried using input type=image name=test src= but from IE on the PHP side I only get $_POST['test_x'] and

Re: [PHP] what is %s %d

2003-08-14 Thread CPT John W. Holmes
From: Jackson Miller [EMAIL PROTECTED] They are codes for date formatting. Specifically: %s represents seconds with leading zeros. %d represents day of the month with leading zeros so date(%s %d,mktime()); would equal something like 59 08 Actually you'd get: %59 %08 because date()

Re: [PHP] Stop neurotic posting

2003-08-14 Thread CPT John W. Holmes
From: Gabriel Guzman [EMAIL PROTECTED] On Wed, 2003-08-06 at 11:44, Chris W. Parker wrote: A bad answer would be: RTFM http://php.net/preg_match; A good answer would be: That can be done with a regular expression. The function you're looking for is called preg_match.

Re: [PHP] mysql_error() problem?

2003-08-14 Thread CPT John W. Holmes
From: Tyler Longren [EMAIL PROTECTED] I'm running an UPDATE query on my table. After executing the query, I check mysql_error() to see if there's any errors: if (mysql_error() == ) { // success } else { // failure } mysql_error() is always empty even if the query didn't succeed.

Re: [PHP] Array to List

2003-08-14 Thread CPT John W. Holmes
From: James Johnson [EMAIL PROTECTED] Actually, I'm using $campusList for a SQL statement: SELECT name FROM campuses WHERE inst_id IN ('$campusList'); It wasn't working until I found out that $campusList needs to look like '1','2','3'. $campusList = implode( ', ', $_POST['campus'] );

Re: [PHP] dev style guide

2003-08-14 Thread CPT John W. Holmes
From: [EMAIL PROTECTED] Just a remark but isn't it pointless to use Hungariannotation in a language that is by default typeless??? I would think that it would be the reason why you WOULD want to use Hungarian notation (not that I do, though). Even though you can take nVar and concatinate it

Re: [PHP] Quick question - Warnings

2003-08-14 Thread CPT John W. Holmes
From: Ryan A [EMAIL PROTECTED] I know how to suppress warnings in my file locally but i want to suppress warnings and notices in one whole directory using a .htaccess, i cant seem to find my old file that does that, can someone refresh my memory please? This is how i do it in my local file

Re: [PHP] string concatenation from array

2003-08-14 Thread CPT John W. Holmes
From: Jonathan Pitcher [EMAIL PROTECTED] The sign in PHP (to the best of my knowledge) does not concatenate. Correct, it's a bitwise AND operator. http://us2.php.net/manual/en/language.operators.bitwise.php ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] Parsing problem with character ''

2003-08-14 Thread CPT John W. Holmes
From: FMM Schillemans [EMAIL PROTECTED] I've installed a Win32 package with in it Apache, PHP en MySQL version. the problem is that the moment the '' character is placed within the PHP code (lets say withing a print-command), then the PHP mode is immideatly ends. Making it impossible to

Re: [PHP] trying to match the front and end...

2003-08-14 Thread CPT John W. Holmes
From: Dan Joseph [EMAIL PROTECTED] I've searched the high heavens for a method of doing this... Here's what I'm doing... First, the code.. $middlenum = preg_replace(/^.$this-start_num./, , $this-ach_acct_num); $middlenum = preg_replace(/.$this-end_num.$/, , $middlenum); In a nutshell,

Re: [PHP] image button problem

2003-08-14 Thread CPT John W. Holmes
From: Abdul-wahid Paterson [EMAIL PROTECTED] What do you mean you don't know what button was pressed? You have 'test_x' and 'test_y' so you know the test button was pressed. If you give the other buttons a different name, you'll have different _x and _y variable names, so you can still tell

Re: [PHP] Adding days to a date

2003-08-14 Thread CPT John W. Holmes
From: Donpro [EMAIL PROTECTED] I have a piece of code like so: $today =- getdate(); I am looking for a function that will add a variable number of days and return a valid date, i.e., the array elements for mday, mon and year are reset as needed. Is this possible? $tomorrow =

Re: [PHP] Session does not end when browser is closed.

2003-08-14 Thread CPT John W. Holmes
From: Lee Hanxue [EMAIL PROTECTED] I am using $_SESSION and each php page has session_start() Session Handling is working fine, except for one problem: when I close my browser and re-open it again, I am still logged in. I tested the log in and log out functions and they work fine. How can

Re: [PHP] Newbie Session Question

2003-08-14 Thread CPT John W. Holmes
From: Tim Winters [EMAIL PROTECTED] Normally to start a session one would use session_start(); Is there a different command to do this if you're instead using the $http_session_vars type coding? No, and it's $HTTP_SESSION_VARS. PHP is case sensitive, remember? ---John Holmes... -- PHP

Re: [PHP] Question on class syntax

2003-08-14 Thread CPT John W. Holmes
From: Luis Lebron [EMAIL PROTECTED] I am currently using a php class that uses the following syntax: $value= htmlcleaner::cleanup($value); What exactly is the :: used for? Is there a different syntax for :: ? You're calling the cleanup() method of the htmlcleaner class. You could also

Re: [PHP] POST/GET - if there is a dot in the name it's changes to _

2003-08-14 Thread CPT John W. Holmes
From: Arnau Rebassa [EMAIL PROTECTED] I'm having the same problem as the bug report http://bugs.php.net/bug.php?id=7987. They say that's not a bug it's a feature... Anybody knows where I can find which characters are changed and by which character? Spaces are also converted to underscore

Re: [PHP] setting function variables

2003-08-14 Thread CPT John W. Holmes
From: Mark [EMAIL PROTECTED] --- Micah Montoy [EMAIL PROTECTED] wrote: I am trying to specify a single php file to contain all the variables and I just call this file where necessary. What I am running into is that I want to do this for all the built in functions (i.e. mssql_query) as

Re: [PHP] Re: why doesn't default values for this function work

2003-08-14 Thread CPT John W. Holmes
From: anders thoresson [EMAIL PROTECTED] I want the $max_length to be optional. With your solution it isn't? I thought I could make it optional by assigning a default value of -1, which would tell the function not to bother with max_length and continue the execution. All in all my function

Re: [PHP] Category and sub-category logic

2003-08-15 Thread CPT John W. Holmes
From: Mark [EMAIL PROTECTED] I'm trying to get a handle on this algorithm as well. If you add additional children to a parent record, doesn't that require renumbering all the rgt and lft values in the lineage? For example (table shamelessly stolen from a website): Personnel emp

Re: [PHP] PCRE regexp bug ?

2003-08-15 Thread CPT John W. Holmes
From: [EMAIL PROTECTED] I use preg_match to validate the Middle Initial field of a form and so far it works, except yesterday a user submitted a 0 (zero) as a middle initial! My regexp is: if (!empty($_POST[MI]) (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) == 0)) I tested it with 0-9

Re: [PHP] Acessing session vars

2003-08-15 Thread CPT John W. Holmes
From: Ed Curtis [EMAIL PROTECTED] I just started using sessions and am having some trouble understanding how to pull values out of sessions to use in another page. I set the values as: session_start(); session_register{'magazine'); session_register('company'); The data is saved as a

Re: [PHP] Category and sub-category logic

2003-08-15 Thread CPT John W. Holmes
From: Richard Baskett [EMAIL PROTECTED] Wouldn¹t it just be easier to do a relationship table as in Personnel emp ID parent 'Albert' 1 0 'Bert'2 1 'Chuck' 3 1 'Donna' 4 0 'Eddie' 5 4 'Fred'6

Re: [PHP] Checkboxes

2003-08-15 Thread CPT John W. Holmes
You could name them as: input type=checkbox name=choice[] value=1 input type=checkbox name=choice[] value=2 etc... Then $_POST['choice'] will be an array of the boxes chosen. $list = implode(',',$_POST['choice']); will give you a comma separated list of all items chosen. ---John Holmes...

Re: [PHP] getting value of item in list box.

2003-08-18 Thread CPT John W. Holmes
From: Tim Winters [EMAIL PROTECTED] I have a PHP page which pulls a bunch of data from a mySQL DB. I have 2 list boxes in a form. One is populated automatically by my PHP code. But the second will be populated based on what is selected in the first. I don't know how to get out the value of

Re: [PHP] Problem with the post variables.

2003-08-18 Thread CPT John W. Holmes
Wow... don't do either of those. First of all, you can't use ini_set to affect the register global settings and you're using the $_POST/$_GET superglobals, which work regardless of your setting. So that's not the issue. Does the phpinfo() function product any output? What if you view the source

Re: [PHP] Q: How to get the value of a checkbox of which name without '[]'?

2003-08-18 Thread CPT John W. Holmes
Consider the following form in a HTML file: ... input type=checkbox name=box value=1 input type=checkbox name=box value=2 input type=checkbox name=box value=3 input type=checkbox name=box value=4 ... Now I'm posting this form into a PHP script. The problem is I can't change

Re: [PHP] Q: How to get the value of a checkbox of which name without '[]'?

2003-08-18 Thread CPT John W. Holmes
- Original Message - From: Frode [EMAIL PROTECTED] [...snip...] Which means I can't modify the code above into PHP prefered style: input type=checkbox name=box[] value=1 input type=checkbox name=box[] value=2 [...snip...] Why is this the preferred style, and where can I read more

Re: [PHP] Stripping out and URL hacking characters from a URL

2003-08-19 Thread CPT John W. Holmes
From: Matt Babineau [EMAIL PROTECTED] Does anyone have a function or something they have already written to remove any URL hacking characters, mainly the single quote, but I'm looking for a nice function to filter my _GET variables against. Gotta protect the database...ya know :) Just escape

Re: [PHP] Iterative regular expression replacement

2003-08-19 Thread CPT John W. Holmes
From: Thaddeus J. Quintin [EMAIL PROTECTED] I'm looking to replace the 'nth' instance of an expression within a string. Example (very simple)- $string=My mom can beat up your mom and your mom's dog; $pattern=mom; $replacement=dad; I want to be able to replace any particular instance of

Re: [PHP] Iterative regular expression replacement

2003-08-19 Thread CPT John W. Holmes
From: Thaddeus J. Quintin [EMAIL PROTECTED] I'm looking to replace the 'nth' instance of an expression within a string. Example (very simple)- $string=My mom can beat up your mom and your mom's dog; $pattern=mom; $replacement=dad; I want to be able to replace any particular instance of

Re: [PHP] deleting session variables

2003-08-19 Thread CPT John W. Holmes
From: Tim Winters [EMAIL PROTECTED] Is there a way to wipe out all previous session variables with one command? With register_globals OFF: $_SESSION = array(); If register_globals is ON and you want to get rid of $val1, $val2, $val3, etc... then: foreach($_SESSION as $key = $value) {

Re: [PHP] one out of four session variables lost

2003-08-19 Thread CPT John W. Holmes
From: anders thoresson [EMAIL PROTECTED] $_SESSION['uname'] = $_POST['uname']; $_SESSION['pwd'] = $_POST['pwd']; When the user first logs in I also adds two more session variables within accesscontrol(): $_SESSION['editor'] = mysql_result($result,0,u_editor); $_SESSION['admin'] =

Re: [PHP] Not fair: REMOTE_HOST

2003-08-19 Thread CPT John W. Holmes
From: John Taylor-Johnston [EMAIL PROTECTED] Aw gee, $_SERVER['REMOTE_HOST'] (only REMOTE_ADDR) does not exist in PHP? Bummer. Why is that? Probably to expensive to look up with every request. Look it up yourself. http://us2.php.net/manual/en/function.gethostbyaddr.php ---John Holmes...

Re: [PHP] deleting session variables

2003-08-19 Thread CPT John W. Holmes
From: Tim Winters [EMAIL PROTECTED] So what does session_unset() do then? Ah, good catch. Use that instead of my second example. If register_globals is ON, it appears that session_unset() will take care of getting rid of the global variables made. ---John Holmes... From: CPT John W. Holmes

Re: [PHP] mysql output

2003-08-19 Thread CPT John W. Holmes
From: Curt Zirzow [EMAIL PROTECTED] * Thus wrote Anthony Ritter ([EMAIL PROTECTED]): The following code snippet outputs a table from a mySQL database. [snipped 255+ lines of code] That is way to much information, please be a brief in your code that you post. You'll find you'll get

Re: [PHP] String parsing help

2003-08-20 Thread CPT John W. Holmes
From: Jonatan Pugliese. [EMAIL PROTECTED] From: Matt Matijevich [EMAIL PROTECTED] I have have a string that I need to split into 3 different variables: City,State, and Zip. Here is a couple examples of the strings I need to parse: ANCHORAGE AK 99507-6420 JUNEAU AK 99801 NORTH

Re: [PHP] Question for you guys and gals

2003-08-22 Thread CPT John W. Holmes
From: David Smith [EMAIL PROTECTED] I have a problem. I have all my functions (currently) set aside in one file, and I just require_once that page for all of the other pages that may need any of those functions. In those functions I have it setup to echo the link to the CSS page for my site

Re: [PHP] Question for you guys and gals

2003-08-22 Thread CPT John W. Holmes
From: Curt Zirzow [EMAIL PROTECTED] Or cheat and use output buffering. IMO, thats an even more lazy way of doing it. I agree entirely. I hate even giving that option, but it is there. That's why I said he could cheat :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/)

Re: [PHP] '' Sign in _GET Parameter

2003-08-22 Thread CPT John W. Holmes
From: Pushpinder Singh Garcha [EMAIL PROTECTED] I am using an application where I retrieve user profile from a MySQL DB using the Company Name . I pass the name of the company to the PHP script as a '$_GET' parameter. e.g. when the name of the company is 'IBM'. , the URL with the query

Re: [PHP] timestamp

2003-08-22 Thread CPT John W. Holmes
From: John Taylor-Johnston [EMAIL PROTECTED] I'm creating a counter. I want a timestamp where I can calculate if a time stamp is older than one hour, if so do X, if not do Y. SELECT * FROM Table WHERE timestamp_column NOW() - INTERVAL 60 MINUTE will give you all rows that have a timestamp

Re: [PHP] problem passing variable between forms.

2003-08-26 Thread CPT John W. Holmes
- Original Message - From: Angelo Zanetti [EMAIL PROTECTED] I have a form in which I have a table with dynamic checkboxes, they are in a checkbox array ( name = chk[]...), I pass this variable to the next page using POST I receive the variable and use it, no problem, but then when I

Re: [PHP] math functions?

2003-08-26 Thread CPT John W. Holmes
From: Amanda McComb [EMAIL PROTECTED] I am having trouble finding math functions on php.net. I am also getting page not found errors when trying to search. Basically, I'm looking for a mod or division function - something I can use to tell me when a number is evening divisable by a

Re: [PHP] PHP Interview questions

2003-08-26 Thread CPT John W. Holmes
From: Micheal Harris [EMAIL PROTECTED] I am in the process of hiring someone that needs to have extensive PHP and MySQL experience. Does anyone have any suggestions for interview questions? I have no PHP or MySQL experience, and come from a non-technical background. I want the questions to be

Re: [PHP] Serve a file using PHP

2003-08-26 Thread CPT John W. Holmes
From: Grant Rutherford [EMAIL PROTECTED] Is there a way that PHP can allow a user to browse the files on the server's network, and ultimately send the file to the user? I'm making a database interface with PHP to be used internally on our network. Through a PHP interface, the user wants to

Re: [PHP] PHP Interview questions

2003-08-26 Thread CPT John W. Holmes
From: Jay Blanchard [EMAIL PROTECTED] Also ask a couple of other questions that require thought, but have nothing else to do with code. such as... In one room you have 3 light switches, each connected to one light bulb in another room. How many trips must you make to determine which switch

Re: [PHP] verifying sql INSERTs

2003-08-26 Thread CPT John W. Holmes
From: Chris W. Parker [EMAIL PROTECTED] I should instead just try to perform the INSERT and then if it fails I know I've already got a record. If it doesn't I know everything is cool. If it is a certain kind of failure, then you have a duplicate, otherwise it could be another type of

Re: [PHP] Website templating schemes

2003-08-26 Thread CPT John W. Holmes
From: Joel Konkle-Parker [EMAIL PROTECTED] I'm trying to make a PHP-backed website, and I'm trying to decide between two templating schemes: 1. define 2 php template files: header.php, footer.php. in index.php, require header.php, output content, require footer.php 2. define a php

Re: [PHP] verifying sql INSERTs

2003-08-27 Thread CPT John W. Holmes
From: Curt Zirzow [EMAIL PROTECTED] I should instead just try to perform the INSERT and then if it fails I know I've already got a record. If it doesn't I know everything is cool. I've debated with myself several times if this is really a good method to not have duplicates in the database.

Re: [PHP] PHP Interview questions

2003-08-27 Thread CPT John W. Holmes
From: Curt Zirzow [EMAIL PROTECTED] toggle_light(1); sleep(120); toggle_light(1); toggle_light(2); move('self', 'room/'); if ($lightbulb['temp'] $room['temp']) { echo switch #1; } elseif ($lightbulb['ison']) { echo switch #2; } else { echo switch #3; } hm.. i had to keep

Re: [PHP] Looping through a list - Newbie question

2003-08-27 Thread CPT John W. Holmes
From: James Johnson [EMAIL PROTECTED] I have a list contained in a session var. I want to loop through the list, getting the value of the current item, then do a query based on that value. Is there an easy way to do this, or do I need to convert the list to an array first? In the code below,

Re: [PHP] dealing with arrays

2003-08-27 Thread CPT John W. Holmes
You need to name the elements a little differently. You're on the right track with making them an array, but if I check the third box, that'll make $check[0] = 1, and if I put in a name in the first box, that'll make $name[0] = 'John'... so you have no way of relating the name from entry one to

Re: [PHP] Cannot pass values from one page to another

2003-08-27 Thread CPT John W. Holmes
From: [EMAIL PROTECTED] Ok this is a major vulnerability that you are coding. Register globals on and password being stored in the session is like having a banner on your home page saying 'come and hack me'. Please explain how you've come to this conclusion... ---John Holmes... -- PHP

Re: [PHP] Implode slows down file reading? [was: str_replace performance in large mailing script]

2003-08-27 Thread CPT John W. Holmes
From: frederik feys [EMAIL PROTECTED] I thought str_replace caused slow down of my mailing script, but it seems to be this line of code: $fd = implode(,file(http://www.domain.org/store/min/Mailing_template.html;) ); I first put the mailing template in $fd (only once) and then replace

Re: [PHP] Cannot pass values from one page to another

2003-08-27 Thread CPT John W. Holmes
From: [EMAIL PROTECTED] Didn't know this was the army :-) Yeah, I signed you up last week. You report to basic training in November. I hope you're ready! :) first unless you got your variable ordering (POST, GET, Env, Sesssion etc). the values in the session can be easily overridden with a

Re: [PHP] session.cookie_domain

2003-08-27 Thread CPT John W. Holmes
From: Shu Chow [EMAIL PROTECTED] We're having a problem with a site that recently upgraded to php 4.3.3. Ever since the upgrade, session variables won't pass between pages. Looking at the php.ini file, I see that session.cookie_domain is set to server.hostingcompany.com while our site is

Re: [PHP] Session var read by form C++ CGI prog ?

2003-09-02 Thread CPT John W. Holmes
From: John Bryan [EMAIL PROTECTED] If so, the problem is that this file that is being uploaded via the form to the program MyCppProg.exe gets sent as THE input to the prog, apparently as a cgi-type parameter through stdin (i.e. cin), so that when I try to pass the value as a cgi parameter,

Re: [PHP] Session var read by form C++ CGI prog ?

2003-09-02 Thread CPT John W. Holmes
From: John Bryan [EMAIL PROTECTED] The file would already exist on the client side. They are uploading the file to be processed by this program MyCppProg.exe, which is invoked as a form 'action'. This already works, but depends on the Apache variable REMOTE_USER being set when user logs in,

  1   2   3   4   5   >