[PHP] Query string question

2009-01-13 Thread Jônatas Zechim
I have something like this on my site:

mysite.com/índex.php?msg=Transa%25E7%25E3o+n%25E3o+autorizada

i need to convert  Transa%25E7%25E3o+n%25E3o+autorizada to Transação não 
autorizada.

The letters ç ã, and others (é, í, ...).

Someone can help me?



-Mensagem original-
De: Eric Butera [mailto:eric.but...@gmail.com] 
Enviada em: terça-feira, 13 de janeiro de 2009 17:09
Para: Dan Shirah
Cc: PHP-General list
Assunto: Re: [PHP] Suggestions?

On Tue, Jan 13, 2009 at 2:00 PM, Dan Shirah mrsqua...@gmail.com wrote:
 Hello all!

 I have written some code that will calculate all static and floating
 holidays.

 I have also written some code that will act as a business day counter.

 My application currently determines a set number of business days to count.
 (2 business days and 7 business days from today)

 This part works great and gives the results I want.

 What I need to do is tie in my pre dertermined static and floating holidays
 and factor those into the busniess day counter.

 I was thinking of putting the holidays into an array and then doing a check
 to determine if any date in the array equaled today's date through the
 ending date.

 But I'm drawing a blank on how to create the array.

 // Create an empty array
 $holidays = array();

 But then how do I put each holiday value into the array as it is
 calculated?  Can I assign it that way?

 Or should I calculate all of the values and then build the array at the end?

 Or should I not even use an array?

 Thanks,
 Dan


Are you asking how to do

$holidays[] = date;
array_push($holidays, date); ?

If you were generating dates to compare against today tho, you could
just return upon a match at that point and not even store them.  No
point in creating some big array in a loop only to loop through it
again when you could have done it the first time around.  I'd put this
into a function though so that I could return out upon a match.

-- 
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] Query string question

2009-01-13 Thread Robert Cummings
On Tue, 2009-01-13 at 17:21 -0200, Jônatas Zechim wrote:
 I have something like this on my site:
 
 mysite.com/índex.php?msg=Transa%25E7%25E3o+n%25E3o+autorizada
 
 i need to convert  Transa%25E7%25E3o+n%25E3o+autorizada to Transação não 
 autorizada.
 
 The letters ç ã, and others (é, í, ...).
 
 Someone can help me?

urldecode()

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Query string vanishes on header(Location: ...) redirect

2009-01-12 Thread Richard S. Crawford
I'm trying to redirect my users to a URL which includes a query string:

$the_url =
$CFG-wwwroot./DLC/includes/L1_accept_required.php?cid=.$course-id;
//die (URL = $the_url);
header('Location: '. $the_url);

When I uncomment the die() command, the URL shows properly, e.g.:

http://mysite.com/DLC/includes/L1_accept_required.php?cid=152

The script at the URL calls the variable cid with $_GET:

$cid = $_GET['cid'];

When I browse directly to the URL as echoed by the die() command, the
value of cid is available to the script. However, when I do the
redirect, the URL that shows up in the browser's location bar does not
contain the query string. Thus, the script at L1_accept_required does
not function properly.

The annoying thing is that the redirect works properly everywhere else
in the site.

Can anyone give me insight into what might be going on? I've checked
for rogue .htaccess files which might be doing some fancy URL
rewriting, but found nothing.

-- 
Richard S. Crawford (rscrawf...@mossroot.com)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Query string inconsistency

2003-03-12 Thread Alley Kat Design
Hi -
I have a PHP msg board on one domain, and a site on another, the idea is
that the board is framed. The PHP msg board pages detect whether they're in
the frameset, and if not, pass their URL  query string over to the
frameset. The frameset then grabs this and writes a frame src tag, thus
enclosing any msg board page within the right frameset even if opened
outside it.

The problem is that the $QUERY_STRING is inconsistent. On it's own domain, a
test page works fine. But when the test page uses the framing mechanism, the
$QUERY_STRING only picks up the first argument - it ignores any subsequent
ones. I've got these two variations here:

http://www.alleykat.co.uk/t1.php?arg1=rg2=bbbarg3=ccc
This one works fine and grags all the args. It doesn't try to send to the
frameset.

http://www.alleykat.co.uk/t2.php?arg1=rg2=bbbarg3=ccc
This one sends to the frameset, and gets only the first argument.

The code in these pages is below. The only difference in the two is that the
javascript line is uncommented in t2.php, so it sends to the frameset:-
?php
$thisURL = $REQUEST_URI ;
$thisPage = $PHP_SELF;
// Try a few ways of grabbing the query string
$qs = $QUERY_STRING;
$qqs = $_SERVER[QUERY_STRING];
$qqqs = $HTTP_SERVER_VARS['QUERY_STRING'];
$gotoURL = http://www.alleykat.co.uk; . $thisPage . $qs;
?
script language=Javascript type=text/javascript!--
// uncomment line below to send to frameset
//if (top.frames.length == 0) { window.location.href =
http://www.virtualmagrep.com/vmr_forums.asp?u=?php print($gotoURL);?; }
//--
/script

?php
print($thisPage) .   - php_self br;
print($qs) .  - query_string br;
print($qqs) .  - second query_string br;
print($qqqs) .  - third query_string brhr;
print($gotoURL) .   - the built url br;
print(hr);
phpinfo();
?

Not sure if this is a bug or if I'm doing something wrong.
Cheers -
Andy



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Query string???

2002-11-18 Thread Cyclone Médias
Hi! 

I need to solve this problem:

I have a menu bar on my main page and a dynamic zone on the others levels of
my html/php site. When I am clicking the 'item 1' on my menu, I want to load
item1.php3 in the dynamic section of the next page.

 So I think I have to use sometinng like get variable in the adress bar and
after put on my 'next page'  include $var.php3 or something like that ?


As you can see I'm a newbie and  a quebecer so, sorry for my english and
thanks for your help!

Ben


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Query string???

2002-11-18 Thread Justin French
So, the link might look like:

a href=page.php?item=1item 1/a

Then page.php might look like this:

?
include({$item}.php);
?

BUT this would be smarter:

?
// uncomment this next line if you have register_globals OFF
// $item = $_GET['item'];

if(empty($item))
{
// set a default item number
$item = 1;
}

$file = {$item}.php3;
if(file_exists($file))
{
include($file);
}
else
{
echo sorry, file {$file} not found;
}
?


Enjoy!


Justin


on 18/11/02 11:07 PM, Cyclone Médias ([EMAIL PROTECTED])
wrote:

 Hi! 
 
 I need to solve this problem:
 
 I have a menu bar on my main page and a dynamic zone on the others levels of
 my html/php site. When I am clicking the 'item 1' on my menu, I want to load
 item1.php3 in the dynamic section of the next page.
 
 So I think I have to use sometinng like get variable in the adress bar and
 after put on my 'next page'  include $var.php3 or something like that ?
 
 
 As you can see I'm a newbie and  a quebecer so, sorry for my english and
 thanks for your help!
 
 Ben
 

Justin French

http://Indent.com.au
Web Developent  
Graphic Design



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Query string???

2002-11-18 Thread Marek Kilimajer
instead of
if(empty($item)) { ...
I would recomend
if(is_numeric($item)) { ...

Justin French wrote:


So, the link might look like:

a href=page.php?item=1item 1/a

Then page.php might look like this:

?
include({$item}.php);
?

BUT this would be smarter:

?
// uncomment this next line if you have register_globals OFF
// $item = $_GET['item'];

if(empty($item))
   {
   // set a default item number
   $item = 1;
   }

$file = {$item}.php3;
if(file_exists($file))
   {
   include($file);
   }
else
   {
   echo sorry, file {$file} not found;
   }
?


Enjoy!


Justin


on 18/11/02 11:07 PM, Cyclone Médias ([EMAIL PROTECTED])
wrote:

 

Hi! 

I need to solve this problem:

I have a menu bar on my main page and a dynamic zone on the others levels of
my html/php site. When I am clicking the 'item 1' on my menu, I want to load
item1.php3 in the dynamic section of the next page.

So I think I have to use sometinng like get variable in the adress bar and
after put on my 'next page'  include $var.php3 or something like that ?


As you can see I'm a newbie and  a quebecer so, sorry for my english and
thanks for your help!

Ben

   


Justin French

http://Indent.com.au
Web Developent  
Graphic Design



 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Query string???

2002-11-18 Thread Justin French
on 19/11/02 12:31 AM, Marek Kilimajer ([EMAIL PROTECTED]) wrote:

 instead of
 if(empty($item)) { ...
 I would recomend
 if(is_numeric($item)) { ...

very true -- thanks for picking that up!

Justin French

http://Indent.com.au
Web Developent  
Graphic Design



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Query String...

2002-07-01 Thread Tim Nields

Never have encountered this.  When I include a query string on the URL line
I can not access the variables.

For example:  www.tim.com?action=move

I should be able to access the variable action.  However I am currently not
able to do this.  I am not receiving an error of any kind, but nothing is
being produced when I echo or print this as $action.

Is there a setting that I've missed somewhere?

Any help will be much appreciated.

Thanks

Tim Nields



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Query String...

2002-07-01 Thread Jason Wong

On Tuesday 02 July 2002 04:45, Tim Nields wrote:
 Never have encountered this.  When I include a query string on the URL line
 I can not access the variables.

 For example:  www.tim.com?action=move

 I should be able to access the variable action.  However I am currently not
 able to do this.  I am not receiving an error of any kind, but nothing is
 being produced when I echo or print this as $action.

 Is there a setting that I've missed somewhere?

register_globals

RTFM and the archives.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Truth can wait; he's used to it.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Query String...

2002-07-01 Thread Dan Vande More

In the beginning of your page try:

$action=$_GET[action];
echo $action;

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 12:01 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Query String...


On Tuesday 02 July 2002 04:45, Tim Nields wrote:
 Never have encountered this.  When I include a query string on the URL line
 I can not access the variables.

 For example:  www.tim.com?action=move

 I should be able to access the variable action.  However I am currently not
 able to do this.  I am not receiving an error of any kind, but nothing is
 being produced when I echo or print this as $action.

 Is there a setting that I've missed somewhere?

register_globals

RTFM and the archives.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Truth can wait; he's used to it.
*/


-- 
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] Query String...

2002-07-01 Thread Nields Timothy M

Thank you very much...

Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 On Tuesday 02 July 2002 04:45, Tim Nields wrote:
  Never have encountered this.  When I include a query string on the URL
line
  I can not access the variables.
 
  For example:  www.tim.com?action=move
 
  I should be able to access the variable action.  However I am currently
not
  able to do this.  I am not receiving an error of any kind, but nothing
is
  being produced when I echo or print this as $action.
 
  Is there a setting that I've missed somewhere?
 
 register_globals
 
 RTFM and the archives.
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 
 /*
 Truth can wait; he's used to it.
 */
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Query String...

2002-07-01 Thread Chris Hewitt

Tim,

$action = $_GET[action];
should do it. I assume you have register_globals off (as it is by 
default nowadays).

HTH
Chris

Tim Nields wrote:

Never have encountered this.  When I include a query string on the URL line
I can not access the variables.

For example:  www.tim.com?action=move

I should be able to access the variable action.  However I am currently not
able to do this.  I am not receiving an error of any kind, but nothing is
being produced when I echo or print this as $action.

Is there a setting that I've missed somewhere?

Any help will be much appreciated.

Thanks

Tim Nields






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] QUERY STRING question

2002-03-11 Thread jhj hjhjhj

Hey again list,

Anybody know what the diffrance in using %20 and +
as a space in the query string is?

Josepablo Pérez

_
Do You Yahoo!?
La emoción e intensidad del deporte en Yahoo! Deportes. http://deportes.yahoo.com.mx

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] QUERY STRING question

2002-03-11 Thread Hiroshi Ayukawa

I guess they are almost same.
But, the contents of $QUERY_STRING are different.

Hiroshi Ayukawa
http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] query string

2001-10-30 Thread Richard Baskett

Ok I am pulling my hair out!  Why if I pass error=5 through a query string
like index.htm?error=5 and then echo it, it's correct, but when I do
error=25 it echos 2T and when I do error=500 it echos 5TP?  What the heck is
going on here?  I pass strings easy enough and I cant remember ever having
this problem... What's going on!!? :)

Rick


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] query string

2001-10-30 Thread Frewuill Rodriguez

hey take it easy men.. it's not you.. it's the encoding.. what's happening
is that =20 =25 etc means a special caracther  blank space etc.. try
using url_encode() function to pass your parameters.. something like this
would help

$parameters = url_encode(error=25);
index.htm?$parameters

hope this helps
- Original Message -
From: Richard Baskett [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Tuesday, October 30, 2001 9:02 AM
Subject: [PHP] query string


 Ok I am pulling my hair out!  Why if I pass error=5 through a query string
 like index.htm?error=5 and then echo it, it's correct, but when I do
 error=25 it echos 2T and when I do error=500 it echos 5TP?  What the heck
is
 going on here?  I pass strings easy enough and I cant remember ever having
 this problem... What's going on!!? :)

 Rick


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] query string - count for records with keywords

2001-09-08 Thread sgibbs

I'm trying to get a count of the number of records in a database that have
the keyword cat, for example. Below is the original code; I added the
query with count at the bottom of this code but it doesn't seem to be
working.  I just get a return of 4 which doesn't correspond correctly with
the true number of records (also, I get the same return of 4 regardless of
the keyword I want to search).

All I want to do is put the record number in parantheses next to the
category so that people visiting the site will be able to tell if new
submissions have been added since they last visited.

Am I missing something really obvious? 

Thanks for your help, Shawna

? 


// original code

if($search == or){
$op = or;
$query = 0;
}else{
$op = and;
$query = 1;
};

if($title){
$title = addslashes($title);
$query .=   . $op .  title like '%$title%';
};
if($keywords){
$foo = (0;
$keywords = addslashes($keywords);

$strings = explode( , $keywords);
$num_strings = count($strings);

for($i=0;$i$num_strings;$i++){
$curstring=$strings[$i];

$foo .=  or keywords like '%$curstring%';
};

$query .=   . $op .  $foo);
};
if($category){
$query .=   . $op .  category like '%$category%';
};
if($type){
$query .=   . $op .  type like '%$type%';
};  
if($language){
$language = addslashes($language);
$query .=   . $op .  language like '%$language%';
};
if($region){
$query .=   . $op .  region like '%$region%';
};
if($author){
$author = addslashes($author);
$query .=   . $op .  author like '%$author%';
};

$offset = addslashes($offset);
if(!($offset)){$offset = 0;};

$results = mysql_db_query($db, select id, title,
date_format(sources.datetime, '%e/%c/%y') as datetime, category, type,
description from sources where  ( $query ) and approved = 'y' order by id
desc limit $offset, 10);


//my code
$keywordsearch = mysql_db_query($db, select count(*) from sources where
keywords = 'cat' and approved = 'y');

?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Query String Name ?

2001-07-26 Thread A

Hi there,

is there any way to access two variables in a query string that have the same name e.g

test.php?name=joename=bob

Is there any way to extract both values of name without changing the way the query 
string is created?


Thanks,
Abe



Re: [PHP] Query String Name ?

2001-07-26 Thread Daniel Rezny

Hello,

Thursday, July 26, 2001, 12:14:39 PM, you wrote:

A Hi there,

A is there any way to access two variables in a query string that have the same name 
e.g

A test.php?name=joename=bob

A Is there any way to extract both values of name without changing the way the query 
string is created?

But in the script you can use only a last value of the variable. So
there is no reason to have more than one variable in query_string with
same name.

use name1, name2,  this is better. I think.

-- 
Best regards,
 Danielmailto:[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Query String Name ?

2001-07-26 Thread Brian White

In PHP, if you set the input fields to be array names then all the results 
get put in an
array:

So: test.php?name[]=joename[]=bob

would create an array(joe, bob ) in PHP.

If you really can't set it in the form you could access the QUERY_STRING 
environment
variable and parse it directly.

At 11:14 26/07/2001 +0100, A wrote:
Hi there,

is there any way to access two variables in a query string that have the 
same name e.g

test.php?name=joename=bob

Is there any way to extract both values of name without changing the way 
the query string is created?


Thanks,
Abe

-
Brian White
Step Two Designs Pty Ltd - SGML, XML  HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]