[PHP] XSL namespaces and callbacks

2005-08-12 Thread Torgny Bjers
Hello,

A while back I posted a question in relation to XSL namespaces and
callbacks, but never got a response, not even a flame, which I found a
bit odd for this list. :P  I know this is pretty cutting-edge for PHP
since the XSL library has only been used in PHP 5, well, except for the
XSLT/Sablotron that was available for 4.

My original post can be found here:
http://marc.theaimsgroup.com/?l=php-general&m=112299671816888&w=2

What I am trying to do here is what the .NET framework does in XSL by
adding a custom namespace that binds to an Assembly and a class. Is this
at all possible in PHP? The reason why I am asking this is because I do
not want the end user to be able to execute any type of PHP code through
XSL, which they can if I call $xslt->registerPHPFunctions(); and enable
the php namespace through

http://www.w3.org/1999/XSL/Transform";
   xmlns:php="http://php.net/xsl";>

For security reasons I would want to limit the user to a specific custom
library class instead of allowing them to use the php:function() that
can call any PHP method/function/internal.

So, instead of:

I would like the call to be:


Where the stylesheet declaration looks like:
http://www.w3.org/1999/XSL/Transform";
   xmlns:namespace.classname="urn:namespace.classname">

Since that way they can only call the macro classes/methods that have
been validated and added as libraries when loading the XSL renderer.

Any help in this matter is greatly appreciated. Also, if somebody can
forward this matter to the PHP internals, Jochem comes to mind, it would
be awesome. I think this would definitely be a very competitive feature
for the PHP XSL implementation.

Warm Regards,
Torgny

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



[PHP] logs problem

2005-08-12 Thread FSA
hi, i have a big php script with alot of db inserts and updates, what i
want to do it's to log all this db commands into a table. I was wonderig
if there is a better way to do this than the insert into logs_table the
actual queryes.

ty


signature.asc
Description: OpenPGP digital signature


Re: [PHP] logs problem

2005-08-12 Thread Torgny Bjers
FSA wrote:
> hi, i have a big php script with alot of db inserts and updates, what i
> want to do it's to log all this db commands into a table. I was wonderig
> if there is a better way to do this than the insert into logs_table the
> actual queryes.
> 
> ty

Depending the amount of queries and the number of times the actual
script is loaded, your logs could flood very easily and bog down the
server. These notions of logging EVERYTHING is sometimes worse than
actually allowing the culprit script to run slowly or execute lots of
queries. 4 GB of logfile says way less than actually reading through the
script and checking to make sure that the queries are proper. If you are
still intent on logging these queries, I would go with your logs_table
idea and limit the fields and field lengths to the extreme and index it
tightly to make sure that it does not grow too much in size, that means,
char or varchar, and definitely no text/blob fields.

If this is a web script, one idea would be to only trigger the logging
for a specific set of IP numbers, so that only your own browser triggers
the logging, but it is left dormant while others browse.

Regards,
Torgny

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



Re: [PHP] logs problem

2005-08-12 Thread Jochem Maas

Torgny Bjers wrote:

FSA wrote:


hi, i have a big php script with alot of db inserts and updates, what i
want to do it's to log all this db commands into a table. I was wonderig
if there is a better way to do this than the insert into logs_table the
actual queryes.

ty



Depending the amount of queries and the number of times the actual
script is loaded, your logs could flood very easily and bog down the
server. These notions of logging EVERYTHING is sometimes worse than
actually allowing the culprit script to run slowly or execute lots of
queries. 4 GB of logfile says way less than actually reading through the
script and checking to make sure that the queries are proper. If you are
still intent on logging these queries, I would go with your logs_table
idea and limit the fields and field lengths to the extreme and index it
tightly to make sure that it does not grow too much in size, that means,
char or varchar, and definitely no text/blob fields.

If this is a web script, one idea would be to only trigger the logging
for a specific set of IP numbers, so that only your own browser triggers
the logging, but it is left dormant while others browse.


additionally you might want to not log each query in full but just store
a count of the number of times a given query was run - but this would probably
only be useful if you where using prepared queries - which is recommended if
your doing lots of the same ... then again your DBMS might not support that
(me I use firebird mostly - which is better ;-)



Regards,
Torgny



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



Re: [PHP] logs problem

2005-08-12 Thread FSA
this is a local script with a medium amount of data to log i just
thaught it's a litle "barbarian" :) to actualy do inserts in the log
table for all queryes. That's why i thaught maibe there is a simple more
reliable way.

Torgny Bjers wrote:
> FSA wrote:
> 
>>hi, i have a big php script with alot of db inserts and updates, what i
>>want to do it's to log all this db commands into a table. I was wonderig
>>if there is a better way to do this than the insert into logs_table the
>>actual queryes.
>>
>>ty
> 
> 
> Depending the amount of queries and the number of times the actual
> script is loaded, your logs could flood very easily and bog down the
> server. These notions of logging EVERYTHING is sometimes worse than
> actually allowing the culprit script to run slowly or execute lots of
> queries. 4 GB of logfile says way less than actually reading through the
> script and checking to make sure that the queries are proper. If you are
> still intent on logging these queries, I would go with your logs_table
> idea and limit the fields and field lengths to the extreme and index it
> tightly to make sure that it does not grow too much in size, that means,
> char or varchar, and definitely no text/blob fields.
> 
> If this is a web script, one idea would be to only trigger the logging
> for a specific set of IP numbers, so that only your own browser triggers
> the logging, but it is left dormant while others browse.
> 
> Regards,
> Torgny
> 


signature.asc
Description: OpenPGP digital signature


RE: [PHP] logs problem

2005-08-12 Thread Jay Blanchard
[snip]
hi, i have a big php script with alot of db inserts and updates, what i
want to do it's to log all this db commands into a table. I was wonderig
if there is a better way to do this than the insert into logs_table the
actual queryes.
[/snip]


Don't forget, your database may be keeping logs already and most RDBMS
packages include a way to turn logging on/off. You can parse this into a
table if you need to. I would start there first.

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



[PHP] getting ip of server

2005-08-12 Thread Tom Cruickshank
Hello,
I'm curious to know if there is a php command that can get the IP of the 
server it's running on. I could always do this...

$results = exec("/sbin/ifconfig  | grep broadcast | awk 
'{print $2}'", $value);

but I would prefer to not have to use system commands for this.

Would anyone happen to know?

Tom


RE: [PHP] getting ip of server

2005-08-12 Thread Jay Blanchard
[snip]
I'm curious to know if there is a php command that can get the IP of the

server it's running on. I could always do this...

$results = exec("/sbin/ifconfig  | grep broadcast | awk

'{print $2}'", $value);

but I would prefer to not have to use system commands for this.

Would anyone happen to know?
[/snip]

Have a look here http://us2.php.net/reserved.variables

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



Re: [PHP] getting ip of server

2005-08-12 Thread Torgny Bjers
Tom Cruickshank wrote:
> Hello,
> I'm curious to know if there is a php command that can get the IP of the 
> server it's running on. I could always do this...
> 
> $results = exec("/sbin/ifconfig  | grep broadcast | awk 
> '{print $2}'", $value);
> 
> but I would prefer to not have to use system commands for this.
> 
> Would anyone happen to know?

This is one of the few times I say RTFM :D
http://www.php.net/manual/en/language.variables.predefined.php

Look under $_SERVER and there's a whole bunch of nice stuff.

Regards,
Torgny

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



Re: [PHP] getting ip of server

2005-08-12 Thread John Nichel

Tom Cruickshank wrote:

Hello,
I'm curious to know if there is a php command that can get the IP of the 
server it's running on. I could always do this...


$results = exec("/sbin/ifconfig  | grep broadcast | awk 
'{print $2}'", $value);


but I would prefer to not have to use system commands for this.

Would anyone happen to know?


http://us2.php.net/manual/en/language.variables.predefined.php
Look under $_SERVER

Make a php document containing just this



...and access it thru your browser.  You'll find a ton of info.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] getting ip of server

2005-08-12 Thread Tom Cruickshank
Thanks for all the info guys! 

Apparantly I'm still not quite awake yet.

Tom


On 8/12/05, John Nichel <[EMAIL PROTECTED]> wrote:
> 
> Tom Cruickshank wrote:
> > Hello,
> > I'm curious to know if there is a php command that can get the IP of the
> > server it's running on. I could always do this...
> >
> > $results = exec("/sbin/ifconfig  | grep broadcast | awk
> > '{print $2}'", $value);
> >
> > but I would prefer to not have to use system commands for this.
> >
> > Would anyone happen to know?
> 
> http://us2.php.net/manual/en/language.variables.predefined.php
> Look under $_SERVER
> 
> Make a php document containing just this
> 
>  
> phpinfo();
> 
> ?>
> 
> ...and access it thru your browser. You'll find a ton of info.
> 
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> [EMAIL PROTECTED]
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>


Re: [PHP] PHP script for removing/forwarding suspected spam from pop3 mailbox

2005-08-12 Thread Stephen Allen
On Thu, Aug 11, 2005 at 02:39:57PM +0100 or thereabouts, I. Gray wrote:
> Hi.
> 
> I'd like to find or write a script that I can run every so often (hourly 
> for example) from cron that will check my pop3 mailboxes for any emails 
> with SPAM in the subject line and either delete them or forward 
> them to another email address.  The best way would be to bundle all the 
> emails together and forward these as attachments to another email 
> address that I would use as spam.

Why use PHP for this, I would use procmail and filter at the tail of the
SpamAssassin rule.



signature.asc
Description: Digital signature


Re: [PHP] making checkbox's and radio buttons sticky

2005-08-12 Thread Jochem Maas

Ted Passey wrote:

Jochem,

Thanks for your help...I can see your a great PHP programmer.


flattery gets you everywhere - even if it isn't true.
I'm not that bad - but lets leave the 'great' for those that really are -
you know people who develop/invent the actual language - people who
write books about it, people like that :-)

oh and as long as it's php related make sure to atleast cc the list.



The dynamic checkbox code you sent worked great!
I am however have a problem with a set of radio buttons...

I am trying to appy the same principle here...
The problem I am encountering is the $checked value in the echo string will
always show
the button "checked" So no matter what is selected, it comes back to
"checked"

Any suggestions?

HTML is:

   Member


I assume that should be?:

  Member


 Prospective Member

PHP is:


if $member containseither 'Yes' or 'No' then it will equate to boolean
true - which is what you are in fact testing

try something like:

if ($member == 'Yes') {


$checked = ' checked="checked"';
} else {
$checked = '';
}

echo '';

?>

Thanks for the help...

zed

- Original Message - 
From: "Jochem Maas" <[EMAIL PROTECTED]>

Newsgroups: php.general
To: "zedleon" <[EMAIL PROTECTED]>
Cc: 
Sent: Thursday, August 11, 2005 9:18 PM
Subject: Re: [PHP] making checkbox's and radio buttons sticky




zedleon wrote:


I am new to php and am in need of some guidance
I am building a sticky form and am having trouble bringing in the data


sticky as in honey?



fields for
checkbox's and radio button's. Any help on how to do this would be
appreciated

HTML  form sample


9th">


PHP


am I on the right track here?


maybe, partially - generally radio buttons and checkboxes have fixed


values -


it's the 'are they selected' part that probably want to make dynamic...
basically you need to conditionally add the attribute 'checked' (i.e.
checked="checked") to the radios and checkboxes you want selected when the
form is first shown.

e.g.

';

?>

of course there are a million different ways to write this kind of thing
(i.e. don't take my example verbatim perse) but hopefully you get the


idea.


zed






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



[PHP] frame help!

2005-08-12 Thread George B
I made a left frame, then made the three pages, and all the frames show 
fine. But this is not my problem! I made a "leftpane" which has code to 
check if user exists (its for a login script). In the code for the login 
FORM I set it to go directly to the "userpane" file. It works fine! It 
recognizes me and all, says I am logged in. But if I set the Login FOrm 
to the main frame file (which shows the 2 frames) it says wrong user and 
password. What do I do to make this work?!?!?!


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



Re: [PHP] PHP and Active Directory

2005-08-12 Thread cron
Some years ago i did this with ASP and a VB activex component i belive you 
can access a Activex from php.

Angelo

- Original Message - 
From: <[EMAIL PROTECTED]>

To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, August 12, 2005 2:24 AM
Subject: Re: [PHP] PHP and Active Directory



Is this something you're looking for?

_http://www.phpfreaks.com/scripts/User_Authentication/16.php_
(http://www.phpfreaks.com/scripts/User_Authentication/16.php)



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



Re: [PHP] Best practices for deleting and restoring records - moving vs flagging

2005-08-12 Thread Jochem Maas

Saqib Ali wrote:

Hello All,

What are best practices for deleting records in a DB. We need the
ability to restore the records.

Two obvious choices are:

1) Flag them deleted or undeleted
2) Move the deleted records to seperate table for deleted records.

We have a  complex schema. However the the records that need to be
deleted and restored reside in 2 different tables (Table1 and Table2).

Table2 uses the primary key of the Table1 as the Foriegn key. The
Primary key for Table1 is auto-generated. This make the restoring with
the same primary key impossible, if we move deleted data to a


why is restoring auto-generated keys impossible? do you have that many records
that the auto-gen rolls over? also if it is auto-generated then technically
I don't see a reason that generating a new id upon re-insertion would
be problematic - the id is just an arbitrary unique identifier - as long
as you keep the link between reinserted records in table1 en table2
(given the id maybe used else where!).

sounds like flagging it easier regardless of what is better performance-wise.


different table. However if we just flag the record as deleted the
restoring is quite easy.

Any thoughts/ideas ?



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



Re: [PHP] PHP and Active Directory

2005-08-12 Thread xfedex
> Is this something you're looking for? 
>   
> http://www.phpfreaks.com/scripts/User_Authentication/16.php

Thanks, if i try one, i let you now

Saludos!
xfedex

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



Re: [PHP] PHP and Active Directory

2005-08-12 Thread xfedex
> Some years ago i did this with ASP and a VB activex component i belive you
> can access a Activex from php.
> Angelo
> 

Maybe, but i prefer to get away as much i can from Activex.just to
think about it makes me shiver =P

Saludos!
xfedex

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



[PHP] need to convert field names into array for form submission

2005-08-12 Thread Bruce Gilbert
How would I organize this block in order to convert it into an array
for my form field names.

For instance if my field has:

Home Phone Number:   
  
  

I would want something to return an error stating that the phone
number was not completed and not that the field last_4_digits was not
entered.

I believe this can be done with an array.

my error block code is:

function check($fieldname)
   {
   global $err_msg;
   if($_POST[$fieldname] == "") {
   if ( !isset($err_msg)) {
   $err_msg = "You haven't entered
your " . str_replace("_", " ", $fieldname) . "!";
   } elseif ( isset($err_msg)) {
   $err_msg .="You haven't entered
your " . str_replace("_", " ", $fieldname) . "!";
   }
   }
   return $err_msg;
}

any assistance is greatly  appreciated!
-- 
::Bruce::

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



[PHP] Message ("Your message dated Fri, 12 Aug 2005 16:07:30...")

2005-08-12 Thread Dartmouth College LISTSERV Server (14.4)
Your message dated Fri, 12 Aug 2005 16:07:30 -0400 with subject "Returned
mail: Data format error" has been  submitted to the moderator of the LLTI
list: [EMAIL PROTECTED]

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



Re: [PHP] need to convert field names into array for form submission

2005-08-12 Thread Leif Gregory
Hello Bruce,

Friday, August 12, 2005, 1:39:54 PM, you wrote:
> I believe this can be done with an array.
> any assistance is greatly  appreciated!

I've been working on a validation function for quite a while now that
does what you're asking. I keep adding to it as I run across stuff I
didn't need before. It's not perfect, but it does work pretty good. It
does not do addslashes() because I do that only when I need to store
it in a DB.

Ok... Let's see if I can put this together without it being too ugly.

The function as functions.php:
*
function validate($fieldName, $value, $size, $type, $extra="0")
{
  GLOBAL $errors;
  GLOBAL $safe;
  
  if ($value != "")
  { 
switch ($type) 
{
  case 'alpha': #Matches only letters and a hyphen (for last names)
if (!preg_match("/^[a-z]+-?[a-z]+$/i", $value))
{
  $errors[0] = 1; 
  $errors[$fieldName] = 'This field only accepts 
alphabetic input';
}
break;
//--
  case 'numeric': #Matches numeric input
if (!preg_match("/^[0-9\.]+$/", $value))
{
  $errors[0] = 1; 
  $errors[$fieldName] = 'This field only accepts 
numeric input';
}
break;
//--
  case 'phone': #Matches phonenumber in xxx-xxx- where area code and 
exchange do not start with a "1" 
if (!preg_match("/^[2-9][0-9]{2}-[2-9][0-9]{2}-[0-9]{4}$/", $value))
{
  $errors[0] = 1; 
  $errors[$fieldName] = 'Phone number must be in 
xxx-xxx- format';
}
break;
//--
  case 'email': #Should match 99% of valid e-mail addresses
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)[EMAIL 
PROTECTED](\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $value)) 
{
  $errors[0]= 1; 
  $errors[$fieldName] = 'E-mail address ' . 
$email . ' doesn\'t appear valid, please verify';
}
break;
//--
  case 'alphanumeric': #Matches strings with only alphanumerics
if (!preg_match("/^[0-9a-z]+$/i", $value))
{
  $errors[0] = 1; 
  $errors[$fieldName] = 'This field only accepts 
alphanumeric characters';
}
break;
//--
  case 'descriptor':  #Allows strings with alphanumerics, and other common
  #things you'd find in titles and descriptions
$value = htmlentities($value);
break;
//--
  case 'date': #Matches strings with dates as mm-dd-
if 
(!preg_match("/^(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])\/(19|20)\d\d$/i", 
$value))
{
  $errors[0] = 1; 
  $errors[$fieldName] = 'Invalid date, enter as 
mm/dd/';
}
break;
//--
  case 'time12': #Matches strings with dates as hh:mm
if (!preg_match("/^([0]?[1-9]|1[0-2]):[0-5][0-9]$/i", $value))
{
  $errors[0] = 1; 
  $errors[$fieldName] = 'Invalid time, enter as 
xx:xx';
}
break;
//  
--
  case 'lat': #Matches strings with latitude as hddd mm.mmm 
if (!preg_match("/^-?([0-8]{1,3})\s([0-9]{1,2})\.[0-9]{1,3}$/",$value))
{
  $errors[0] = 1; 
  $errors[$fieldName] = 'Invalid value, enter as 
ddd mm.mmm';
}
$value = str_replace(".", "", $value);
$value = str_replace(" ", ".", $value);
if ($extra == "S")
  $value = "-" . $value;
break;
//  
--
  case 'long': #Matches strings with longitude as hddd mm.mmm 
if (!preg_match("/^-?([0-9]{1,3})\s([0-9]{1,2})\.[0-9]{1,3}$/",$value))
{
  $errors[0] = 1; 
  $errors[$fieldName] = 'Invalid value, enter as 
ddd mm.mmm';
}
$value = str_replace(".", "", $value);
$value = str_replace(" ", ".", $value);
if ($extra == "W")
  $value = "-" . $value;
break;
//--
  
}
//Common to all in switch
if (strlen($value) > $size)
{
  if (!isset($errors[$fieldName]))
$errors[$fieldName] .= '';
  else
$errors[$fieldName] .= '';

  $errors[0] = 1; 
  $errors[$fieldName] .= 'Field limited to ' . $size . ' characters';
}
if (isset($errors[$fieldName]))
  $errors[$fie

[PHP] Migrating to PHP 5 - Cannot Load mySQL

2005-08-12 Thread Bagus Nugroho
Hello,

I have problem 'cannot load mysql' with MySQL on PHP5( recently migrating grom 
PHP4 to PHP5).
I was do the following actions to resolve the problem, but failed .
1. uncommented > extension=php_mysql.dll
2. put php_mysql.dll on c:/php/ext
3. put libmysql.dll both on c:/winnt and c:/winnt/system32 (Windows 2000)
4. edit > extension_dir = "c:/php/ext"
5. restart apache server(2.0).

Any missing of my act?

Thanks in advance
Rgds




[PHP] one more mysql question

2005-08-12 Thread [EMAIL PROTECTED]
I apology for mysql question posted here, but, as I said once, I like 
you guys more! :)


have two tables: orders and special_orders. foreign key is trans_no.
I can't figure it out how to create a query that pulls orders from the 
"orders" tables that are NOT in "special_orders" table?


Thanks for any help.

-afan

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



RE: [PHP] PHP & smarty - nested queries and arrays

2005-08-12 Thread Daevid Vincent
First I'll appologize for the cheuvanistic remark the other poster had. I
know he had good intentions...

So I don't know smarty, but it seems to me you're grabbing only one row
here:
$projects = $db->getAssoc()

Normally in straight PHP, I would do something like.

While ($row = $db->getAssoc($query, DB_FETCHMODE_ASSOC))
{
$projects[] = $row;
}

The [] just adds a new element to the array and is dumping in the entire
$row array to it.
Ala, multi-dimensional array.

Then I would do something like:

foreach ($projects as $key => $value)
{
echo "[".$key."] has a name value of ".$value['project_name'];  
}

Remember that you have a multi-array in $projects, so that's why I split it
into the key/value pair where value is actually another array, and you
access the elements via it's hash key.

Hope this helps.

D.Vin
http://daevid.com

> -Original Message-
> $query ="SELECT * FROM projects WHERE parent_project_id is NULL OR 
> parent_project_id = ''";
>  
> $projects = $db->getAssoc($query, DB_FETCHMODE_ASSOC);
>  
> foreach ($projects as $key => $project) {
>   $query ="SELECT * FROM projects WHERE parent_project_id = 
> $projects[$key]['project_id']";
>   $sub = $db->getAssoc($query, DB_FETCHMODE_ASSOC);
>   $projects[$key]['subs'] = $sub;
> }
> $tpl->assign('projects', $projects);
>
> SMARTY STUFF
> {foreach from=$projects item='entry'}
> {$entry.short_name}
> 
> {foreach from=$entry.subs item='sub'}
> {$sub.short_name}
> {foreachelse}
> No subs for this project
> {/foreach}
> 
> {foreachelse}
> No projects found
> {/foreach}
> 
> Can anyone point me in the right direction?
>  
> Thanks,
> Amanda
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP] one more mysql question

2005-08-12 Thread Philip Hallstrom
I apology for mysql question posted here, but, as I said once, I like you 
guys more! :)


have two tables: orders and special_orders. foreign key is trans_no.
I can't figure it out how to create a query that pulls orders from the 
"orders" tables that are NOT in "special_orders" table?


I can never remember the syntax, but you want to LEFT JOIN the tables and 
then only return rows where the resulting special_orders column is NULL.


something like this (most likely wrong syntax):

SELECT o.trans_no, s.trans_no FROM orders o LEFT JOIN special_orders s ON 
o.trans_no = s.trans_no WHERE s.trans_no IS NULL


But that should get you started...

-philip

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



[PHP] Re: frame help!

2005-08-12 Thread George B

George B wrote:
I made a left frame, then made the three pages, and all the frames show 
fine. But this is not my problem! I made a "leftpane" which has code to 
check if user exists (its for a login script). In the code for the login 
FORM I set it to go directly to the "userpane" file. It works fine! It 
recognizes me and all, says I am logged in. But if I set the Login FOrm 
to the main frame file (which shows the 2 frames) it says wrong user and 
password. What do I do to make this work?!?!?!

Well can anyone help? :( :( I really need to know how to do this :(

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



Re: [PHP] one more mysql question

2005-08-12 Thread [EMAIL PROTECTED]

I tried this one:
SELECT trans_no
FROM orders
WHERE trans_no IN (
SELECT trans_no
FROM special_orders )

but gives me an error:
You have an error in your SQL syntax. Check the manual that corresponds 
to your MySQL server version for the right syntax to use near 'SELECT 
trans_no FROM special_orders )' at line 5


???


Philip Hallstrom wrote:

I apology for mysql question posted here, but, as I said once, I like 
you guys more! :)


have two tables: orders and special_orders. foreign key is trans_no.
I can't figure it out how to create a query that pulls orders from 
the "orders" tables that are NOT in "special_orders" table?



I can never remember the syntax, but you want to LEFT JOIN the tables 
and then only return rows where the resulting special_orders column is 
NULL.


something like this (most likely wrong syntax):

SELECT o.trans_no, s.trans_no FROM orders o LEFT JOIN special_orders s 
ON o.trans_no = s.trans_no WHERE s.trans_no IS NULL


But that should get you started...

-philip





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



[PHP] header redirect not working

2005-08-12 Thread Pablo Gosse
Hi, folks.  I'm running into an incredibly bizarre problem with a
header() redirect of which I cannot see the cause.

We have a CMS here where I work, in two separate production and training
environments.

Last night I implemented a new events manager module, copying all
necessary files from training to production, adding database tables,
etc. etc.

Everything worked, except for one redirect which happens after a user
deletes an event.  For some reason, the redirect is simply reloading the
event detail page from which the user clicked the delete link.

But the truly bizarre thing is that in the training environment it
works!!!

There is nothing different between the two files except for '-test'
being added to the subdomain (so it's cms-test.mydomain.com instead of
cms.mydomain.com) in any full paths.

The code that deletes the event, and then redirects the user is:

$conn->Execute("delete from cms_events where e_id = {$fd['e_id']}") or
$this->CMS_error(2,$this->mod_name,$query,$conn->ErrorMsg());

header("Location:{$this->CMS_base_path}mods/events_manager/cms.events_ma
nager.dsp.php");

Not to much to see here.  If the query doesn't execute the CMS_error
method is called, and the header would never be reached.

However, the query does execute, the event is deleted, but instead of
going to the appropriate location, it's simply redirecting back to:

/mods/events_manager/cms.events_manager.event_detail.dsp.php?e_id=15

where 15 is whatever the number of the event that was just deleted was,
and ergo it brings up an "Invalid event" error, and the user can then
click a link at the bottom of the page to go back to the main events
manager page.

Can anyone think of any reason why the above code, just those two lines,
would redirect correctly in one environment, yet simply redirect to the
currently existing page in another?

There are a number of other redirects in the events module that are
working fine, so why this one would work in the training environment and
not in the production environment is mystifying me.

Cheers, and thanks very much in advance for any help. This one hurt my
brain this afternoon.

Pablo

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



Re: [PHP] one more mysql question

2005-08-12 Thread John Nichel

[EMAIL PROTECTED] wrote:
I apology for mysql question posted here, but, as I said once, I like 
you guys more! :)


I like my wife more than I like the people on these lists, but I don't 
go asking her my MySQL questions.  I go to the MySQL list for that. 
What you like doesn't make your post any less off topic, or any less 
against netiquitte.  To me, it's even a bigger offense than the newbie 
wo doesn't know any better...you know you're question is off topic, and 
yet you ask anyway...numerous times.


--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

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



Re: [PHP] one more mysql question

2005-08-12 Thread [EMAIL PROTECTED]

don't get this one:
from mysql.com:

SELECT s1 FROM t1 WHERE s1 NOT IN (SELECT s1 FROM t2);

my query:

select trans_no from orders where trans_no not in (select trans_no from 
special_orders);


and I'm getting an error:

You have an error in your SQL syntax. Check the manual that corresponds 
to your MySQL server version for the right syntax to use near 'select 
trans_to from printed_orders)' at line 1


Syntax error?

???

-afan


[EMAIL PROTECTED] wrote:


I tried this one:
SELECT trans_no
FROM orders
WHERE trans_no IN (
SELECT trans_no
FROM special_orders )

but gives me an error:
You have an error in your SQL syntax. Check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near 'SELECT trans_no FROM special_orders )' at line 5


???


Philip Hallstrom wrote:

I apology for mysql question posted here, but, as I said once, I 
like you guys more! :)


have two tables: orders and special_orders. foreign key is trans_no.
I can't figure it out how to create a query that pulls orders from 
the "orders" tables that are NOT in "special_orders" table?




I can never remember the syntax, but you want to LEFT JOIN the tables 
and then only return rows where the resulting special_orders column 
is NULL.


something like this (most likely wrong syntax):

SELECT o.trans_no, s.trans_no FROM orders o LEFT JOIN special_orders 
s ON o.trans_no = s.trans_no WHERE s.trans_no IS NULL


But that should get you started...

-philip







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



Re: [PHP] one more mysql question

2005-08-12 Thread [EMAIL PROTECTED]

ok. accept critique. :(

@moderator: please take my mysql questions off the php list.

I apology to everybody for any inconviniance.

-afan


John Nichel wrote:


[EMAIL PROTECTED] wrote:

I apology for mysql question posted here, but, as I said once, I like 
you guys more! :)



I like my wife more than I like the people on these lists, but I don't 
go asking her my MySQL questions.  I go to the MySQL list for that. 
What you like doesn't make your post any less off topic, or any less 
against netiquitte.  To me, it's even a bigger offense than the newbie 
wo doesn't know any better...you know you're question is off topic, 
and yet you ask anyway...numerous times.




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



Re: [PHP] one more mysql question

2005-08-12 Thread Sebastian

[EMAIL PROTECTED] wrote:


I tried this one:
SELECT trans_no
FROM orders
WHERE trans_no IN (
SELECT trans_no
FROM special_orders )

but gives me an error:
You have an error in your SQL syntax. Check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near 'SELECT trans_no FROM special_orders )' at line 5


???


Philip Hallstrom wrote:

I apology for mysql question posted here, but, as I said once, I 
like you guys more! :)


have two tables: orders and special_orders. foreign key is trans_no.
I can't figure it out how to create a query that pulls orders from 
the "orders" tables that are NOT in "special_orders" table?




I can never remember the syntax, but you want to LEFT JOIN the tables 
and then only return rows where the resulting special_orders column 
is NULL.


something like this (most likely wrong syntax):

SELECT o.trans_no, s.trans_no FROM orders o LEFT JOIN special_orders 
s ON o.trans_no = s.trans_no WHERE s.trans_no IS NULL


But that should get you started...

-philip





try this (untested):

SELECT * FROM trans_no
LEFT JOIN special_orders ON (trans_no.id = special_orders.id)
WHERE special_orders.id IS NULL;

just change id to the primary key...


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.8/71 - Release Date: 8/12/2005

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



Re: [PHP] one more mysql question

2005-08-12 Thread Sebastian
take what other say with a grain of salt.. im sure you're using php to 
pull info from mysql anyway..


the fact is without mysql php would be nowhere where it is today.. its 
like peanut butter w/o the jelly..


see my reply in the other email.. im sure it will work for you.


[EMAIL PROTECTED] wrote:


ok. accept critique. :(

@moderator: please take my mysql questions off the php list.

I apology to everybody for any inconviniance.

-afan


John Nichel wrote:


[EMAIL PROTECTED] wrote:

I apology for mysql question posted here, but, as I said once, I 
like you guys more! :)




I like my wife more than I like the people on these lists, but I 
don't go asking her my MySQL questions.  I go to the MySQL list for 
that. What you like doesn't make your post any less off topic, or any 
less against netiquitte.  To me, it's even a bigger offense than the 
newbie wo doesn't know any better...you know you're question is off 
topic, and yet you ask anyway...numerous times.







--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.8/71 - Release Date: 8/12/2005

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



Re: [PHP] header redirect not working

2005-08-12 Thread Jasper Bryant-Greene

Pablo Gosse wrote:

[snip]
$conn->Execute("delete from cms_events where e_id = {$fd['e_id']}") or
$this->CMS_error(2,$this->mod_name,$query,$conn->ErrorMsg());

header("Location:{$this->CMS_base_path}mods/events_manager/cms.events_ma
nager.dsp.php");
[snip]
Can anyone think of any reason why the above code, just those two lines,
would redirect correctly in one environment, yet simply redirect to the
currently existing page in another?


Can you place the following code just before the header() line, and post 
what it prints?


die($this->CMS_base_path);

In other words, tell us what the $this->CMS_base_path field contains 
when that line is executed.


Jasper

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



[PHP] ALLOW FILE UPLOADS...?

2005-08-12 Thread << z a p a n >>
hello,

sorry in advance if my question is naive..  i'm trying to allow file
uploads. optimally i'd like to store these files (jpgs, mostly) directly to
a folder in my httpdocs..  i've heard something about file uploads not being
allowed if server is set to safemode..  not sure why but i've been getting
errors.. here're the two files if you have time to check them out.  thanks
for your time!

xo, -z
--
[file1.html]



FILENAME: 


--
[file2.php

";
continue 2;
   case 3:
print "the upload of file $filename was broken.  please try again.";
continue 2;
   }
  print "received: $filename.";
  print "type: $myfile['type'].";
  move_uploaded_file(
   $myfile['tmp_name'],
   $uploads_dir.$myfile['name']);
  }
?> 


-- 

fourthcity 2005 ; slow yr roll. ---> http://www.fourthcity.net/


 quick links:
 >http://www.fourthcity.net/   [fct]
 >http://www.zapan.net/[  zapan]
 >http://www.laptopbattle.org/ [ battle]
 >http://www.postermidget.com/ [ midget]


  +
   +
 +
 + +
 +
 +


> much love! from the fourthcity studios  <

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



Re: [PHP] header redirect not working

2005-08-12 Thread Chris Shiflett

Pablo Gosse wrote:

Can anyone think of any reason why the above code, just those two lines,
would redirect correctly in one environment, yet simply redirect to the
currently existing page in another?


I can think of a few, and my first instinct is to check to see whether 
your script produces any errors in one environment that it doesn't in 
the other. If you're displaying errors, they can affect the behavior of 
your scripts when you're also using header(). Replace header() with echo 
and compare the behavior.


Also, comparing php.ini can help you identify differences in 
configuration. Configuration directives can be modified through other 
means, but this is a good starting point (and a good candidate for 
version control anyway - inconsistencies can cause you to waste time and 
effort).


Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



[PHP] Help Building Dynamic Checkboxes

2005-08-12 Thread zedleon
I am  having an issue with building dynamic checkboxes.. They appeared to be
working properly...but then all the checkboxes in the array are "checking"
ater the initial checkbox is selected.
I am building a sticky form to present the data. so anything checked in the
HTML would be dynamically checked in the PHP.

I am grateful to Jochem Maas for getting me to this point...

Any help is appreciated...

Here is the HTML...


Dynamic Checkboxes






September 9th

October 14th

November 11thDecember 9th








Here is the PHP
September
9th';

if ($gmev) {
$checked = ' checked="checked"';
} else {
$checked = '';
}

echo 'October
14th';

if ($gmev) {
$checked = ' checked="checked"';
} else {
$checked = '';
}

echo 'November
11th';

if ($gmev) {
$checked = ' checked="checked"';
} else {
$checked = '';
}

echo 'December
9th';

?>
thanks
zedleon

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



Re: [PHP] one more mysql question

2005-08-12 Thread John Nichel

Sebastian wrote:
take what other say with a grain of salt.. im sure you're using php to 
pull info from mysql anyway..


And he might be using Apache on Linux like the majority of PHP users. 
More than likely outputting some HTML and maybe some JavaScript. 
Probably using a PC too.  So what?


the fact is without mysql php would be nowhere where it is today.. its 
like peanut butter w/o the jelly..


The fact is, without IBM, PHP would be nowhere it is today.  Say, here's 
an idea, let's just make this the "IBM and anything which relates to it" 
list.



see my reply in the other email.. im sure it will work for you.


I'll be sure to tell everyone on the MySQL list that they can shut it 
down, since you have it covered over here.


--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

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



[PHP] Mail-id validation script

2005-08-12 Thread Nahalingam Kanakavel
Hai all, 

This is naha, I am very new to PHP as well as this group, I am in need of 
your guidence all my way.

Now I am doing a project using PHP, in that I created a form.
That form has a field called e-mailid, to validate that I need a script 
(function), whether I have to write it in the server side or client side, 
which one is better?. I need your suggestions, If any script is there plz 
send it to me.


-- 
with regds,
Nahalingam.


Re: [PHP] Mail-id validation script

2005-08-12 Thread Jasper Bryant-Greene

Nahalingam Kanakavel wrote:

Now I am doing a project using PHP, in that I created a form.
That form has a field called e-mailid, to validate that I need a script 
(function), whether I have to write it in the server side or client side, 
which one is better?. I need your suggestions, If any script is there plz 
send it to me.


If I was creating such a script I would validate it both on the 
client-side and the server-side. The reason for this is that client-side 
validation can be fooled, but server-side validation requires a 
round-trip to the server.


If you validate on the client-side you will save your users time as 
errors will be detected without a trip to the server, but you still need 
to validate on the server-side to ensure that they haven't bypassed the 
client-side validation in any way.


As far as an actual script goes, either read the relevant RFC for email 
addresses at [1], or just Google for PHP email validation [2].


Jasper

[1] http://www.ietf.org/rfc.html
[2] http://www.google.com/search?q=php+email+validation

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