Re: [PHP] variable variables i think... (solved)

2002-08-22 Thread Justin French

Solved it -- I *can* do what I wanted without variable variables... it was
human error.

Justin French


on 22/08/02 4:09 PM, Justin French ([EMAIL PROTECTED]) wrote:

 Hi all,
 
 Having trouble with the logic behind this.
 
 I have a dynamic SKU, and a dynamic size_range array.
 
 Examples:
 
 $sku = '44044';
 $size_range = array('S', 'M', 'L');
 
 
 Which I use to build a pull down select box:
 
 SELECT name=myselect
 ?
 foreach($sizes as $k = $v)
 {
 echo OPTION value=\$v\$v/OPTION;
 }
 ?
 /SELECT
 
 
 Note, the select's name is just a string now, not an array.  Sinxe there are
 many SKU's on the page, What I'd like to do is dynamically generate this
 name, so that each SKU is part of an array. Eg:
 
 $selected_size['44044'] = 'M';
 $selected_size['44045'] = 'S';
 $selected_size['44046'] = 'L';
 etc etc
 
 This will make processing the data HEAPS easier.
 
 
 So I need to dynamically generate the SELECT's name:
 
 SELECT name=selected_size['?=$sku?']
 
 Easy.
 
 
 BUT, since this form may be spat back out to the user if fields were left
 blank, etc etc, I like to do something like:
 
 SELECT name=myselect
 ?
 foreach($sizes as $k = $v)
 {
 $myselect = $_POST['myselect'];
 if($myselect == $v) { $sel =  selected; } else { $sel = ; }
 echo OPTION value=\{$v}\{$sel}{$v}/OPTION;
 }
 ?
 /SELECT
 
 Which ensures that any values they did select will still be selected when
 they get given the form again to make changes.
 
 Trouble is, with a dynamically assigned SELECT name, I have no idea how to
 test for an existing value.
 
 I thought it'd be something like:
 
 SELECT name=myselect['?=$sku?']
 ?
 foreach($sizes as $k = $v)
 {
 $myselect[$sku] = $_POST['myselect'][$sku];
 if($myselect[$sku] == $v) { $sel =  selected; } else { $sel = ; }
 echo OPTION value=\{$v}\{$sel}{$v}/OPTION;
 }
 ?
 /SELECT
 
 But this isn't working.  My guess is that I need variable variables, or some
 other way of referencing the select's name.
 
 Any ideas welcome.
 
 
 
 Justin French
 


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




[PHP] Re: Passing variables between servers

2002-08-22 Thread Anil Kumar K.


You cannot avoid using cookies. When you use Sessions web server is making
use of cookies (unless you go for URL rewriting) which remains in the
browser until one quits the browser.

To tackle your situation, you can effectively make use of a database table 
and a session cookie: 

1. set a session cookie (different from one set by the server) as a soon
as as a login is successful. This cookie should be set in such a way that
the browser will send it back to any server in your domain. The value for
this cookie can be the same as the value PHP generated for the Session ID.
If you prefer to use some other value make sure that it is different for
each session for each user to avoid security issues.

2. Store this value and the user ID (or something else to identify that
user in your app) in a table.

3. Remove this row from the table when the user logs out or on Session 
timeout.

Now, when the user is taken to your ASP server, browser will send that
cookie set by the PHP server along with the request and the ASP server can
query the database for that cookie value to get the user ID. If it can
find it in the table the application can make sure that the request is
valid and the rest of the info can be pulled from the database.


   Anil




On Wed, 21 Aug 2002, Mark McCulligh wrote:

 I have two server.  One running PHP/Linux the other running ASP/2000.
 The user logins into the PHP server and session variables are made to hold
 their username, password, department, etc..  The site from time to time
 redirect the user to the ASP server.  I want to pass the session variable
 across to the other server.  I can't use the GET method.
 (www.domain.com/form.asp?username=Mark.) because putting the password on
 the address bar is not an option.  The ASP server will redirect them back
 when they are done on it. It will pass back the variables just in case the
 session on the PHP server has expired for the PHP server can create a new
 session if needed.
 
 I don't want to use a cookie.
 
 I was thinking of using cURL but I can't fine any information about using it
 in ASP.  I know how to use cURL in PHP to redirect the user to the ASP
 server and pass the variables in the POST method, but not the other way.
 
 Any ideas would be a GREAT help.
 Mark.
 
 _
 Mark McCulligh, Application Developer / Analyst
 Sykes Canada Corporation www.SykesCanada.com
 [EMAIL PROTECTED]
 
 
 

-- 
+91 471 324341 (Office)
+91 98473 22280 (Cell)

Linuxense Information Systems Pvt. Ltd., Trivandrum, India
http://www.linuxense.com


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




[PHP] Re: anyone...?

2002-08-22 Thread ::: Flavio Bastos Amiel::::::

Well, already did, for the newbies like me the thing would go like this:

first php
aempresas.php


?
require(conexion.php);

// si el tipo es igual a crear entonces...

if ($tipo==crear) {

// si la cantidad de campos requeridos es mayor a 40 entonces da error //

if ($crear_empresas  40) {
?
table width=100% border=0 cellspacing=1 cellpadding=1
align=center
  tr
td
  div align=centerfont face=Verdana, Arial, Helvetica, sans-serif
size=3 color=#FFbLa
Empresa no puede tener maacute;s de 60 Departamentos Haga click a
href=javascript:history.back()aqui/a
para volver/b/font/div
/td
  /tr
/table
?
} ?
table width=100% border=0 cellspacing=1 cellpadding=1
  tr
td
  div align=centerfont size=3 color=#FF face=Verdana,
Arial, Helvetica, sans-serifbRecuerde
que los campos no pueden contener espacios a la hora de crear los
departamentos
/b /font/div
/td
  /tr
/tablebr
form name=forms method=post action=aempresas2.php
?

// Aqui defino el valor para la variable $i igual a uno hasta igual o menor
que $crear_empresas
// de manera que haga el conteo.
$conteo = $crear_empresas;

 for ($i = 1; $i = $conteo; $i++){

echo $i;
  // Esta es la variable que contiene los distintos forms

 $form = input type=\text\ name=\form[]\  |  ;

 }

// hace un string repitiendo la cantidad de campos requeridos por el usuario

echo str_repeat($form, $crear_empresas);
?
input type=submit  name=submit2 value=crear departamentos
/form
?
// si no se cumple ninguna de las variables definidas entonces coloca lo
siguiente para la creacion
// de los inputs:
 }

else {

?

form name=x method=post action=aempresas.php?tipo=crear
  input type=text name=crear_empresas value=
  input type=submit name=Submit value=Elaborar Planillas
/form

? } ?
=
second php

?
require(conexion.php);

for ($i = 0; $i  count($form); $i++) {
$query = INSERT INTO empresas_dpto VALUES ('',' . $form[$i] . ',' .
$empresa . ');

mysql_query($query);

}
 ?



;)

Flavio Bastos Amiel





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




RE: [PHP] Re: Web Site

2002-08-22 Thread Jarrad Kabral

If your in Aus (like me) then I recommend eWay, I've used them for several
sites and never had a problem.
www.eway.com.au

They even have some sample PHP code you can use to integrate with there
system...


Regards
Jarrad Kabral



-Original Message-
From: Sami Mahamed [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 22 August 2002 2:16 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Web Site


I think DSL is better than cable if you can't get a T3 line.

If you want a site hosted at your home, i strongly suggest
Apache(www.apache.org). Great sever tool :)  Or PHP-Triad(www.phpgeek.com
not sure if thats the site or not, sorry).

Sorry i have no PayPal account so i can't answer that one ;)

-Sami

Peter Goggin [EMAIL PROTECTED] wrote in message
00a101c2497c$f8e51410$030a@petergnt1">news:00a101c2497c$f8e51410$030a@petergnt1...

 I am setting up a web site which will be hosted on my own equipmet at
home,
 located in Melbourne, Australia
 I would like some general advice on two questions.

 1. What sort of permanent interconnect should I look at (Cable is not
 available in my area).  Is DSL suitable? Are there any good providers in
the
 area?

 2. I need to set up credit card payments. Has anyone any experience with
 PayPal? Are there any other providers I should consider.


 I don't know if this is the correct list for the questions, but if not
 perhaps someone could point me to where I can get some advice.


 Regards

 Peter Goggin




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

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




[PHP] Active page

2002-08-22 Thread Budi Kelana

Hi,

I want to make a web page that can retrive data from my tables
automatically, periodically.
Does PHP have some timer control ?
I know we can do with JavaScript (setInterval() or setTimeOut()) but I
cann't  join java script with PHP.

I've tried make simple script with JavaScript to open new window that
contain PHP script for show current time every 5 seconds.

function showData() {
  newWindow = Window.open('data.php','screen');
}

function loadData() {
  setInterval('showData()','5000')
}

data.php :

?
  echo date(l dS of F Y h:i:s A);
?

in result, data.php will reload every 5 seconds, but it doesn't change.

Can someone help me and give me suggestion ?

TIA

regards,

Budi Kelana




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




[PHP] Active Page

2002-08-22 Thread Yamin Prabudy


your pages should be dynamic, meaning every time user open your page it keep
on getting data from table
how about using the Meta tags from html it will refresh you page in x seconds
(define x as you need)

meta http-equiv=refresh content=x

On Thursday 22 August 2002 02:01 pm, Budi Kelana wrote:
 Hi,

 I want to make a web page that can retrive data from my tables
 automatically, periodically.
 Does PHP have some timer control ?
 I know we can do with JavaScript (setInterval() or setTimeOut()) but I
 cann't  join java script with PHP.

 I've tried make simple script with JavaScript to open new window that
 contain PHP script for show current time every 5 seconds.

 function showData() {
   newWindow = Window.open('data.php','screen');
 }

 function loadData() {
   setInterval('showData()','5000')
 }

 data.php :

 ?
   echo date(l dS of F Y h:i:s A);
 ?

 in result, data.php will reload every 5 seconds, but it doesn't change.

 Can someone help me and give me suggestion ?

 TIA

 regards,

 Budi Kelana

---


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




Re: [PHP] Active Page

2002-08-22 Thread jochen schultz

Hello,

Another possibility might be to open a persistent http connection so the update would 
be in realtime instead of intervals of x seconds and with a cronjob it might as well 
be periodically *g*
search for fsockopen() or 'persistant http conection'

I can confirm Yamins answer also as a much easier way, as long as you are not trying 
to make a _good_ phpchat.

greetz Jochen

P.S. This is my first post in this mailinglist :)


*** REPLY SEPARATOR  ***

On 22.08.02 at 15:44 Yamin Prabudy wrote:

your pages should be dynamic, meaning every time user open your page it
keep
on getting data from table
how about using the Meta tags from html it will refresh you page in x
seconds
(define x as you need)

meta http-equiv=refresh content=x

On Thursday 22 August 2002 02:01 pm, Budi Kelana wrote:
 Hi,

 I want to make a web page that can retrive data from my tables
 automatically, periodically.
 Does PHP have some timer control ?
 I know we can do with JavaScript (setInterval() or setTimeOut()) but I
 cann't  join java script with PHP.

 I've tried make simple script with JavaScript to open new window that
 contain PHP script for show current time every 5 seconds.

 function showData() {
   newWindow = Window.open('data.php','screen');
 }

 function loadData() {
   setInterval('showData()','5000')
 }

 data.php :

 ?
   echo date(l dS of F Y h:i:s A);
 ?

 in result, data.php will reload every 5 seconds, but it doesn't change.

 Can someone help me and give me suggestion ?

 TIA

 regards,

 Budi Kelana

---


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




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




[PHP] OOP / dynamic SQL class

2002-08-22 Thread jochen schultz


Hi again,

i got a question concerning OOP, would be nice if anyone could help.

I am trying to build a class that builds SQL statements dynamically like i send 
tablenames, fieldnames, etc and it should build select, insert, update... statements.
e.g. i have a table PERS_DATA with following structur :

ID | FIRSTNAME varchar(40) | LASTNAME varchar(40) | REGISTRATION date | AGE int (5)
(sure it makes no sence to save the age but it´s an example)

Now i want to save postdata of a registerform in this table and it should work like 
this :

$query_obj = new sql_class('insert','PERS_DATA',$postvars);
$db_obj = new db_class();
$db_obj - query ($query_obj - sql);

sql_class should instance a check_persdat_postvars_class that sends me a predefined 
error in case the entries of the form where wrong (age not numeric for example)

Now the sql class would have to build a insertstatement like this :

$fields = ;
$vals   = ;
$i=0;
while ( list ( $key,$val ) = each ( $param_arr ) )
{
  if (!empty($i))
  {
$fields  .= ',';
$vals.= ',';
  }
  $fields  .= $key;
  $vals.= $val;
  $i++;
}
$this - SQL = insert into $table ($fields) values ($vals);

but elements of $vals 'can' be strings and some can be numeric...

Do you think it´s a good idea to make queries to find out about fieldtypes as i need 
that info to set quotes for the string entries?
Or do you think i should predefine it instead in the class that checks the postvars?

Or do you think i have a absolute stupid idea?

Tia

regards

Jochen





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




[PHP] in_array()

2002-08-22 Thread Riccardo Sepe

Hi every1 I got this script that works fine on my local windows pc but 
on the remote server (FreeBSD)
I get this message:

Warning: Wrong datatype for first argument in call to in_array in 
/usr/local/..

the script should bookmark an user choice storing it in the 
$_SESSION[bkmks] array.
this is the code:
$rty-mark($id,$tab);   // call to the method 
that perform a standard query on the db
if(mysql_num_rows($rty-resu))  { //result
$rec = mysql_fetch_array($rty-resu);
 if(!isset($_SESSION[bkmks]) || 
!in_array($rec, $_SESSION[bkmks])) {
$_SESSION[bkmks][] = $rec;

when I store for the first time no problem ... When I try to store 
another item or the same item again
I got that awful error

thanks in advance !

Ricky





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




[PHP] phpnuke installation.

2002-08-22 Thread Thomas Goeminne

Dear programmers,

I have some trouble setting up a php nuke version on
http://www.mydomain.be/nuke I have put all the files in the directory nuke.
But when I start the first page I get error messages. Apparantly the files
are searched in www.mydomain.be and not in the directory nuke. How can i
solve this problem?

I already put in the config.php the url to my site as
http://www.mydomain.be/nuke but this doesn't seem to solve my problem.

Any tips or tricks r welcome

--
Thomas Goeminne
Executive NV
Kortrijksepoortstraat 7
9000 Gent Belgium
Tel/fax: + 32 9 223 0393
BTW: BE 455.676.207
URL: http://clik.to/bomb



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




Re: [PHP] in_array()

2002-08-22 Thread jochen schultz


Hi Riccardo,

if(mysql_num_rows($rty-resu))  { //result
$rec = mysql_fetch_array($rty-resu);
 if(!isset($_SESSION[bkmks]) ||

When you save something for the first time, the element of $_SESSION[bkmks] is a 
string and you can compare the array $rec with this string.
!in_array($rec, $_SESSION[bkmks])) {

Than you convert the element into an array
$_SESSION[bkmks][] = $rec;

and AFAIK in_array() can´t compare two arrays, correct me if i am wrong...


Greetings

Jochen




*** REPLY SEPARATOR  ***

On 22.08.02 at 12:06 Riccardo Sepe wrote:

Hi every1 I got this script that works fine on my local windows pc but
on the remote server (FreeBSD)
I get this message:

Warning: Wrong datatype for first argument in call to in_array in
/usr/local/..

the script should bookmark an user choice storing it in the
$_SESSION[bkmks] array.
this is the code:
$rty-mark($id,$tab);   // call to the method
that perform a standard query on the db
if(mysql_num_rows($rty-resu))  { //result
$rec = mysql_fetch_array($rty-resu);
 if(!isset($_SESSION[bkmks]) ||
!in_array($rec, $_SESSION[bkmks])) {
$_SESSION[bkmks][] = $rec;

when I store for the first time no problem ... When I try to store
another item or the same item again
I got that awful error

thanks in advance !

Ricky





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




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




[PHP] open_basedir restriction?

2002-08-22 Thread Thomas Goeminne

I am getting this message running one off my neat scripts? what does the
basedir restriction mean?

Warning: open_basedir restriction in effect. File is in wrong directory in
/www/T/tgoeminne/web/www.hiphopstore.be/admin/includes/application_top.php
on line 175

Warning: Failed opening '/admin/includes/include_once.php' for inclusion
(include_path='/www/T/tgoeminne/web/www.hiphopstore.be') in
/www/T/tgoeminne/web/www.hiphopstore.be/admin/includes/application_top.php
on line 175

Warning: open_basedir restriction in effect. File is in wrong directory in
/www/T/tgoeminne/web/www.hiphopstore.be/admin/includes/application_top.php
on line 183

Warning: Failed opening '/admin/includes/include_once.php' for inclusion
(include_path='/www/T/tgoeminne/web/www.hiphopstore.be') in
/www/T/tgoeminne/web/www.hiphopstore.be/admin/includes/application_top.php
on line 183

Fatal error: Call to undefined function: tep_session_start() in
/www/T/tgoeminne/web/www.hiphopstore.be/admin/includes/application_top.php
on line 186


--
Thomas Goeminne
Executive NV
Kortrijksepoortstraat 7
9000 Gent Belgium
Tel/fax: + 32 9 223 0393
BTW: BE 455.676.207
URL: http://clik.to/bomb



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




Re: [PHP] phpnuke installation.

2002-08-22 Thread Jason Wong

On Thursday 22 August 2002 18:20, Thomas Goeminne wrote:
 Dear programmers,

 I have some trouble setting up a php nuke version on

Just because there is php in the name phpnuke, it does not automatically mean 
it's a php question. You are asking in the wrong place. Try the phpnuke 
support forums.

 http://www.mydomain.be/nuke I have put all the files in the directory nuke.
 But when I start the first page I get error messages. 

Hey we're 'programmers' not mind readers. If you're posting this expecting 
some decent answers then it's a good idea to provide some decent information. 
What _are_ these error messages?

 Apparantly the files
 are searched in www.mydomain.be and not in the directory nuke. How can i
 solve this problem?

 I already put in the config.php the url to my site as
 http://www.mydomain.be/nuke but this doesn't seem to solve my problem.

Presumably you _have_ followed the installation instructions? IIRC after 
copying the phpnuke files you have to run install.php (or something like 
that) to initialise the thing and to write out a config file. I'm not sure 
that you had to edit config.php by hand.

As I said above, you'll probably get better help over at the phpnuke support 
forums.

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

/*
Even if you're on the right track, you'll get run over if you just sit 
there.
-- Will Rogers
*/


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




Re: [PHP] open_basedir restriction?

2002-08-22 Thread Jason Wong

On Thursday 22 August 2002 19:31, Thomas Goeminne wrote:
 I am getting this message running one off my neat scripts? what does the
 basedir restriction mean?

Put simply you're not allowed to access files that are outside of the 
directory specified by open_basedir.

See php.ini and manual - Safe Mode

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

/*
So you're back... about time...
*/


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




[PHP] Re: Active page

2002-08-22 Thread Kondwani Spike Mkandawire


Budi Kelana [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 I want to make a web page that can retrive data from my tables
 automatically, periodically.
 Does PHP have some timer control ?
 I know we can do with JavaScript (setInterval() or setTimeOut()) but I
 cann't  join java script with PHP.

 I've tried make simple script with JavaScript to open new window that
 contain PHP script for show current time every 5 seconds.

 function showData() {
   newWindow = Window.open('data.php','screen');
 }

 function loadData() {
   setInterval('showData()','5000')
 }

 data.php :

 ?
   echo date(l dS of F Y h:i:s A);
 ?

 in result, data.php will reload every 5 seconds, but it doesn't change.

 Can someone help me and give me suggestion ?
 TIA
 regards,
 Budi Kelana


 Not quite sure what you want to do...  but why don't you just
enclose your JavaScript in a PHP Script...

echo language = javascript
echo 'function Afunc(){


}';

Or alternatively, this is the way I would approach it (and forgive
me if I'm getting a head of myself and misunderstood the question):
- if you are on a Linux/UNIX type machine you could use
Unix tools to achieve the desired effect by time intervals...
One way of doing this is to implement code that utilizes
the cron utility.  Use cron to execute a script at the desired time
intervals, the output of what ever script is executed can hence
be written to a file and read using php and finally spatt out onto your
page...

Hope this helps...

Spike...




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




[PHP] Eregi_replace

2002-08-22 Thread Roman Duriancik

How to create pattern for function eregi_replace to 
replace in html document every html tag a href= for empty string.

Thanks


roman



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




[PHP] PHP search function for MySQL db

2002-08-22 Thread Kristoffer Strom

I've set up a mysql db to store all news updates at our site and I'm
thinking about setting up a search function so our visitors can search the
news db after specifics words or strings.
Is there somewhere some nice place that have posted a
change-some-variables-then-its-ready-to-go PHP file some where ? Or do I
have to start all from scratch ?

/Kris



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




[PHP] in_array

2002-08-22 Thread Riccardo Sepe

jochen schultz wrote:

 Hi Riccardo,

  

   if(mysql_num_rows($rty-resu))  { //result
   $rec = mysql_fetch_array($rty-resu);
if(!isset($_SESSION[bkmks]) ||   


 When you save something for the first time, the element of 
 $_SESSION[bkmks] is a string and you can compare the array $rec with 
 this string.
  

 !in_array($rec, $_SESSION[bkmks])) {
   


 Than you convert the element into an array  

   $_SESSION[bkmks][] = $rec;
   


 and AFAIK in_array() can´t compare two arrays, correct me if i am 
 wrong...


 Greetings
 Jochen


  

I think I've sorted it out  at least I know why it doesn't work:

bool in_array ( mixed needle, array haystack [, bool strict])
Searches haystack for needle and returns TRUE if it is found in the 
array, FALSE otherwise. If the third parameter strict is set to TRUE 
then the in_array() function will also check the types of the needle in 
the haystack. Note: If needle is a string, the comparison is done in a 
case-sensitive manner.
Note: In PHP versions before 4.2.0 needle was not allowed to be an array.
PHP on the server is 4.1.2 !!!

Is a foreach loop the only thing that I can do???

regards

Ricky






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




[PHP] Question about sessions: how to force expiry

2002-08-22 Thread DonPro

Hi,

I am using a session variable to create an area where customers can access
certain pages via login/password.  If they successfully login, I create a
session variable and initialize it with their logon username.

I also have a logout button which unregisters the session variables and
issues a session_unset() and session_destroy().  Then is takes them back to
the login page.

Now all my pages in this area first check if the session variable is set and
if not, displays a message that the user must first login.

I noticed that after logging out and clicking click on the Back button in
my browser, it takes me back to the previous page which is does NOT display
the warning that the user must login.  However, when I click on the Refresh,
it does.  Is this some sort of caching problem?  I note that other sites
with similar setups do not have this problem.  When I click on the Back
button, I saw an expiry message.

How can I emulate this please?

Thanks,
Don



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




Re: [PHP] Eregi_replace

2002-08-22 Thread Bas Jobsen

eregi_replace('a href[^]+','',$string);

Op donderdag 22 augustus 2002 14:42, schreef Roman Duriancik:
 How to create pattern for function eregi_replace to
 replace in html document every html tag a href= for empty string.

 Thanks


 roman

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




[PHP] Replacing an uploaded file

2002-08-22 Thread Jay Blanchard

Really I am just thinking out loud here as the subject just came up in an
early morning meeting, so bear with me (I look forward to your opinions /
ideas on this) ...

Does the autoglobal $_FILES contain a ['time'] or ['timestamp']? If not I
could use a filemtime() to test each file.

Anyhow, we have some files on an Intranet for which I have created a file
management utility that will upload the file, return lists of files as
links, delete files, etc. Can we upload files that replace existing files?
was the question asked this morning. I off handedly said that this would not
be a problem, as long as the updated file was the same name as the existing
file.

I want to compare file datetimes so that I can make sure a newer file
replaces an older one. move_uploaded_file() threw no errors or warnings when
overwriting a file of the same name (kinda' scary, huh?) and type. I will
add a confirmation to ask Hey, you know a file by that name exists already,
do you really want to replace it?. Maybe I should move a file to be updated
to a 'lower' folder as backup.

upload file?
   yes - does file exist?
  yes - is existing older?
 yes - move to 'lower' directory, upload newer into current
directory

Opinions, ideas, criticisms?

Jay

***
* Texas PHP Developers Conf  Spring 2003  *
* T Bar M Resort  Conference Center  *
* New Braunfels, Texas*
* San Antonio Area PHP Developers Group   *
* Interested? Contact [EMAIL PROTECTED] *
***



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




[PHP] search in serialized string

2002-08-22 Thread Rodrigo Peres

Hi list, 

I have a form to post resumes. In one parte the user have a option to choose
up to 5 languages and his knowledge in it. example : english: basic advanced

My problem is that was stored serialized in the BD and now I need to do a
search by language and knowledge. How can I do this. I've tried everything
unsuccessfully. example: search english advanced. If the user have english
basic and another advanced he/her appear in the search.

Thank's in advance

Rodrigo


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




[PHP] insert query fails w/ postgres database

2002-08-22 Thread Javier Montserat

Hello PHP people...

I'm trying to insert a filename (string) into a postgres database field but 
the insert query is failing -

Warning: pg_exec() query failed: ERROR: oidin: error in 
abc_abcde012_010_mpeg1.mpeg: can't parse abc_abcde012_010_mpeg1.mpeg
in /usr/local/apache/htdocs/filename.php on line 835

Here's the query -

$addFileResult = pg_exec($db-db, INSERT INTO 
files(filename,type,size,uploaded) VALUES 
('$this-uploadedFileName','$this-uploadedFileType','$this-uploadedFileSize','now'::datetime));

Table looks like this -

CREATE TABLE files
(
filename oid,
type varchar(30),
size int,
uploaded datetime
);

Any Ideas?

Saludos,

Javier




_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




[PHP] oops - solved re: insert fails w/ postgres database

2002-08-22 Thread Javier Montserat



the filename field is of type 'oid' rather than 'character varying'...

yep, inserting a string into an oid feild will make the db baarrrfff...

Saludos

Javier

_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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




[PHP] PDFlib error help --

2002-08-22 Thread Hank Marquardt

I've got an old, inherited codebase (18months) that generates PDFs -- just
upgraded the server and libraries and php versions and now the PDF stuff
is broken -- a quick scan of the archive and on google didn't this issue
on there.

The error I'm getting is:

PDFlib error: function 'PDF_stroke' must not be called in 'page' scope

I started to just comment out the offending line and see what happened,
but it complains on every instance of function call throughout the
scripts and a couple of supporting classes --- eww.

I did notice a lot of calls to the deprecated API, but I'd really like
to find a bandaid to put on this rather than rewrite the class library
and all the scripts under time pressure --

Anyone else run into this? ... any pointers, faqs, etc.

-- 
Hank Marquardt [EMAIL PROTECTED]
GPG Id: 2BB5E60C
Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A2D 2BB5 E60C

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




[PHP] Pausing PHP?

2002-08-22 Thread Erich Kolb

Is there a way to pause a script?



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




[PHP] mysql upate return false?

2002-08-22 Thread Randy Johnson

I have a function


update_trans();


in a mysql_query() that processes an update,  what could i check for to see
if it was successful or not.  The update only updates 1 row.

Thanks

Randy



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




Re: [PHP] Pausing PHP?

2002-08-22 Thread Rasmus Lerdorf

sleep()

On Thu, 22 Aug 2002, Erich Kolb wrote:

 Is there a way to pause a script?



 --
 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] mysql upate return false?

2002-08-22 Thread Rasmus Lerdorf

mysql_affected_rows()

On Thu, 22 Aug 2002, Randy Johnson wrote:

 I have a function


 update_trans();


 in a mysql_query() that processes an update,  what could i check for to see
 if it was successful or not.  The update only updates 1 row.

 Thanks

 Randy



 --
 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] PDFlib error help --

2002-08-22 Thread Rasmus Lerdorf

There is no bandaid for this.  Your code is simply wrong.  You are calling
a stroke function without having a path to stroke.  You need to fix the
code.

-Rasmus

On Thu, 22 Aug 2002, Hank Marquardt wrote:

 I've got an old, inherited codebase (18months) that generates PDFs -- just
 upgraded the server and libraries and php versions and now the PDF stuff
 is broken -- a quick scan of the archive and on google didn't this issue
 on there.

 The error I'm getting is:

 PDFlib error: function 'PDF_stroke' must not be called in 'page' scope

 I started to just comment out the offending line and see what happened,
 but it complains on every instance of function call throughout the
 scripts and a couple of supporting classes --- eww.

 I did notice a lot of calls to the deprecated API, but I'd really like
 to find a bandaid to put on this rather than rewrite the class library
 and all the scripts under time pressure --

 Anyone else run into this? ... any pointers, faqs, etc.

 --
 Hank Marquardt [EMAIL PROTECTED]
 GPG Id: 2BB5E60C
 Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A2D 2BB5 E60C

 --
 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] mysql upate return false?

2002-08-22 Thread Adam Williams

mysql_query($sql_statement) or die (Couldn't run UPDATE statement);

Adam

On Thu, 22 Aug 2002, Randy Johnson wrote:

 I have a function


 update_trans();


 in a mysql_query() that processes an update,  what could i check for to see
 if it was successful or not.  The update only updates 1 row.

 Thanks

 Randy






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




Re: [PHP] mysql upate return false?

2002-08-22 Thread Randy Johnson

Is this a proper way to see if an insert has failed?

$Query=insert blah into blah where blah=blah;
if (! mysql_query($Query,$link))
{
  $dberror= mysql_error()
}


Is there a better way to do it?

Randy


- Original Message -
From: Rasmus Lerdorf [EMAIL PROTECTED]
To: Randy Johnson [EMAIL PROTECTED]
Cc: Rodrigo Peres [EMAIL PROTECTED]; PHP [EMAIL PROTECTED]
Sent: Thursday, August 22, 2002 10:52 AM
Subject: Re: [PHP] mysql upate return false?


 mysql_affected_rows()

 On Thu, 22 Aug 2002, Randy Johnson wrote:

  I have a function
 
 
  update_trans();
 
 
  in a mysql_query() that processes an update,  what could i check for to
see
  if it was successful or not.  The update only updates 1 row.
 
  Thanks
 
  Randy
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


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




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




Re: [PHP] PDFlib error help --

2002-08-22 Thread Hank Marquardt

Well an answer, even one I didn't want is better than no answer -- I
only thought a band-aid might be around as the code did work at one time
... oh well, I guess I'm going to go learn more about PDFlib than I ever
wanted to:(

Thanks for the help.

On Thu, Aug 22, 2002 at 07:53:13AM -0700, Rasmus Lerdorf wrote:
 There is no bandaid for this.  Your code is simply wrong.  You are calling
 a stroke function without having a path to stroke.  You need to fix the
 code.
 
 -Rasmus
 
 On Thu, 22 Aug 2002, Hank Marquardt wrote:
 
  I've got an old, inherited codebase (18months) that generates PDFs -- just
  upgraded the server and libraries and php versions and now the PDF stuff
  is broken -- a quick scan of the archive and on google didn't this issue
  on there.
 
  The error I'm getting is:
 
  PDFlib error: function 'PDF_stroke' must not be called in 'page' scope
 
  I started to just comment out the offending line and see what happened,
  but it complains on every instance of function call throughout the
  scripts and a couple of supporting classes --- eww.
 
  I did notice a lot of calls to the deprecated API, but I'd really like
  to find a bandaid to put on this rather than rewrite the class library
  and all the scripts under time pressure --
 
  Anyone else run into this? ... any pointers, faqs, etc.
 
  --
  Hank Marquardt [EMAIL PROTECTED]
  GPG Id: 2BB5E60C
  Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A2D 2BB5 E60C
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
Hank Marquardt [EMAIL PROTECTED]
GPG Id: 2BB5E60C
Fingerprint: D807 61BC FD18 370A AC1D  3EDF 2BF9 8A2D 2BB5 E60C

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




Re: [PHP] mysql upate return false?

2002-08-22 Thread Rasmus Lerdorf

That's fine.

On Thu, 22 Aug 2002, Randy Johnson wrote:

 Is this a proper way to see if an insert has failed?

 $Query=insert blah into blah where blah=blah;
 if (! mysql_query($Query,$link))
 {
   $dberror= mysql_error()
 }


 Is there a better way to do it?

 Randy


 - Original Message -
 From: Rasmus Lerdorf [EMAIL PROTECTED]
 To: Randy Johnson [EMAIL PROTECTED]
 Cc: Rodrigo Peres [EMAIL PROTECTED]; PHP [EMAIL PROTECTED]
 Sent: Thursday, August 22, 2002 10:52 AM
 Subject: Re: [PHP] mysql upate return false?


  mysql_affected_rows()
 
  On Thu, 22 Aug 2002, Randy Johnson wrote:
 
   I have a function
  
  
   update_trans();
  
  
   in a mysql_query() that processes an update,  what could i check for to
 see
   if it was successful or not.  The update only updates 1 row.
  
   Thanks
  
   Randy
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 




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




[PHP] Re: Question about sessions: how to force expiry

2002-08-22 Thread Peter Bottenberg

Hi,

Place these headers in the top of your php file just below the ?PHP
and your problem should be gone.

header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);
header(Cache-Control: no-cache, must-revalidate);
header(Pragma: no-cache);

Greetings
Peter

Donpro [EMAIL PROTECTED] schreef in bericht
004601c249dd$9a0034a0$[EMAIL PROTECTED]">news:004601c249dd$9a0034a0$[EMAIL PROTECTED]...
 Hi,

 I am using a session variable to create an area where customers can access
 certain pages via login/password.  If they successfully login, I create a
 session variable and initialize it with their logon username.

 I also have a logout button which unregisters the session variables and
 issues a session_unset() and session_destroy().  Then is takes them back
to
 the login page.

 Now all my pages in this area first check if the session variable is set
and
 if not, displays a message that the user must first login.

 I noticed that after logging out and clicking click on the Back button
in
 my browser, it takes me back to the previous page which is does NOT
display
 the warning that the user must login.  However, when I click on the
Refresh,
 it does.  Is this some sort of caching problem?  I note that other sites
 with similar setups do not have this problem.  When I click on the Back
 button, I saw an expiry message.

 How can I emulate this please?

 Thanks,
 Don





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