RE: [PHP] A quick ereg translation

2012-08-25 Thread SagaciousDev PHP-Dev

You're correct in the fact that you've added delimiters to the pattern, however 
you also need to specify the s pattern modifier so that the search spans over 
multiple lines.


This should do the trick:

preg_match('#body(.*)/body#is', $content, $matches);


---

 Date: Sat, 25 Aug 2012 23:10:08 +0200
 From: krebs@gmail.com
 To: php-general@lists.php.net
 Subject: Re: [PHP] A quick ereg translation
 
 Am 25.08.2012 23:06, schrieb Lester Caine:
  ereg('body(.*)/body', $phpinfo, $regs);
 
  Pulls the body of phpinfo() to use with a tidy header of other system
  information, but I'm struggling to get a pcre alternative. Anybody
  already cracked this one?
 
 
 usually it's just fine to wrap the pattern into delimiter.
 
 | preg_match('~body(.*)/body~i', $phpinfo, $regs);
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
  

[PHP] different menus for different roles

2011-10-20 Thread drupal dev
Hi Gurus,

 I am new to php and drupal both .


I have created two domains in drupal. and two different roles.

Now i wanted to show different page for each role.can you anybody tell me
how to do it.

Or share with me if something is readily available.


Thanks,
S


[PHP] Image Rotation Script

2011-10-15 Thread dev
We have a simple script which rotates and image to a random value, saves
it to a cache directory and displays it. For some reason when I move the
script from a Debian box over to the production CentOS machine, it no
longer caches any of the images. the rest works, but not the cache. If you
could look at it and see if anything jumps out at you, please let me know.

install the code below to the directory /angles


.htaccess:
RewriteEngine on
RewriteRule ^rotate_(\d+)(?:_(?:\d+))?.png$ rotate.php?im=$1

rotate.php:
?php
// Setup
if(isset($_GET['im'])  file_exists($_GET['im'].'.png')) {
header('Content-type: image/png');
$im = $_GET['im'].'.png';
$degrees = rand(0, 360);
$save = 'cache/'.$_GET['im'].'_'.$degrees.'.png';
if(!file_exists($save)) {
// Rotate via command line and cache it
exec('convert '.$im.' -filter \'Lanczos\' -resize \'150x150\' -rotate
'.$degrees.' -black-threshold 40% '.$save, $out);
}
// Output out (newly?) cached file
echo file_get_contents($save);
} else {
die(Image not found);
}
?

Use it by url:
http://www.servername.com/angles/rotate_019.png
Each time you reload page the angle should rotate to a new position.
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: Seeking developer for short term project

2010-06-20 Thread Dev Job
Just wanted to let everyone know that we will be finishing up with interview
this week in order to make a decision.  So, if anyone is interested, please
let me know so we can discuss the project further.

U.S. and UK solo developers (no teams) please.

Thanks!


On Mon, Jun 14, 2010 at 12:46 PM, Dev Job job4d...@gmail.com wrote:

 Our company is looking to hire a PHP Developer for a short term project.
  We're currently in the last couple weeks of the interview phase to narrow
 down our options.  We are looking for a developer that is comfortable
 working with existing code as well as creating new code.  You must be
 skilled in PHP and MySQL in addition to HTML and javascript.  Experience in
 jQuery is a plus!

 We're looking for candidates from the U.S. and UK only right now.

 If you meet the requirements and are intersted, please respond with a
 resume and contact information.

 We'll be making a decision in the next couple weeks, so please respond
 soon!



[PHP] Re: Seeking developer for short term project

2010-06-16 Thread Dev Job
Just to clarify, we are looking for a single developer, not a team please.

Thanks!


On Mon, Jun 14, 2010 at 12:46 PM, Dev Job job4d...@gmail.com wrote:

 Our company is looking to hire a PHP Developer for a short term project.
  We're currently in the last couple weeks of the interview phase to narrow
 down our options.  We are looking for a developer that is comfortable
 working with existing code as well as creating new code.  You must be
 skilled in PHP and MySQL in addition to HTML and javascript.  Experience in
 jQuery is a plus!

 We're looking for candidates from the U.S. and UK only right now.

 If you meet the requirements and are intersted, please respond with a
 resume and contact information.

 We'll be making a decision in the next couple weeks, so please respond
 soon!



[PHP] Seeking developer for short term project

2010-06-14 Thread Dev Job
Our company is looking to hire a PHP Developer for a short term project.
 We're currently in the last couple weeks of the interview phase to narrow
down our options.  We are looking for a developer that is comfortable
working with existing code as well as creating new code.  You must be
skilled in PHP and MySQL in addition to HTML and javascript.  Experience in
jQuery is a plus!

We're looking for candidates from the U.S. and UK only right now.

If you meet the requirements and are intersted, please respond with a resume
and contact information.

We'll be making a decision in the next couple weeks, so please respond soon!


[PHP] clean data

2008-10-27 Thread blackwater dev
I have a project now where we would like to properly remove unwanted data
before it goes into the db such as ` and of course slashes.  The problem is
I have tons of pages.  Is there an easy way to add in a clean up routine on
the db side to clean it going in and coming out without having to touch each
page that inserts it into the db and each page that presents it?

I'm using a MySQL db.


Thanks!


Re: [PHP] clean data

2008-10-27 Thread blackwater dev
Yes, I agree but the code I am inheriting doesn't use abstraction
unfortunately.

On Mon, Oct 27, 2008 at 9:38 PM, Micah Gersten [EMAIL PROTECTED] wrote:

 Are you using MySQL abstraction?  That's the easiest way to control what
 data goes into your DB in a central place.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 blackwater dev wrote:
  I have a project now where we would like to properly remove unwanted data
  before it goes into the db such as ` and of course slashes.  The problem
 is
  I have tons of pages.  Is there an easy way to add in a clean up routine
 on
  the db side to clean it going in and coming out without having to touch
 each
  page that inserts it into the db and each page that presents it?
 
  I'm using a MySQL db.
 
 
  Thanks!
 
 



Re: [PHP] saving outside website content via php...

2008-06-01 Thread blackwater dev
Yes, but file_get_contents will get me the code which I could then echo back
out to the browser but that wouldn't give me any external images, css files
or js.



On Sun, Jun 1, 2008 at 11:23 AM, Shawn McKenzie [EMAIL PROTECTED]
wrote:

 Gabriel Sosa wrote:

 why no just save the searhed url in a db field. next time you just
 need call the iframe with the last or N search

 anyway if you still want to save all the searched page try using curl

 http://ar.php.net/manual/en/function.curl-exec.php

 saludos


 On Sat, May 31, 2008 at 8:11 PM, blackwater dev [EMAIL PROTECTED]
 wrote:

 I'm using the google api to allow people to search the web via my site.
  The
 pages are simply iframed within my site.  Is it possible for me to give
 them
 a 'save' button and let them save the page they are viewing in it's
 current
 state?  I don't mean save to their computer but I would use php to save
 it
 to disk or the db.  How can I do this and pull in all the css, images,
 etc?



 Thanks!





 Or if you don't have access to curl, you can use file_get_contents() on a
 URL if allow_url_fopen=on.

 -Shawn

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




[PHP] saving outside website content via php...

2008-05-31 Thread blackwater dev
I'm using the google api to allow people to search the web via my site.  The
pages are simply iframed within my site.  Is it possible for me to give them
a 'save' button and let them save the page they are viewing in it's current
state?  I don't mean save to their computer but I would use php to save it
to disk or the db.  How can I do this and pull in all the css, images, etc?



Thanks!


Re: [PHP] save image in database vs folder

2008-03-11 Thread dev

Quoting jeffry s [EMAIL PROTECTED]:


some friend of mine ague about this matter, this morning. they say, saving
image in
database is more professional. I am not really agree with that,since i am
just a novice programmer. i am asking
senior php programmer what you opinion about this?

which one is better. save in database or in folder?



Not this thread again :) Search the archives for this one. There have  
been numerous discussions about this topic. Personally i don't see  
what would make this technique more professional. It's just a matter  
of taste.


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



Re: [PHP] save image in database vs folder

2008-03-11 Thread dev

Quoting jeffry s [EMAIL PROTECTED]:


thanks Richard ..
sorry dev.. i don't know this subject is quite sensitive here :(


It's not so sensitive :) It's just one of those questions that pop''s  
up a lot. And some of those discussions were pretty heated.





I think I'm gonna dive into the archives then. To see for myself what
left such a scars upon that subject.


i guess, i have to prepare my oxygen tank to dive into the archives.
i am quite curious to find out what  happen about this..



Happy diving.



On Tue, Mar 11, 2008 at 7:18 PM, Richard Heyes [EMAIL PROTECTED] wrote:


 some friend of mine ague about this matter, this morning. they say,
saving
 image in
 database is more professional. I am not really agree with that,since i
am
 just a novice programmer.

Well, bearing in mind I only have experience of MySQL, the general
consensus is to save it to a file on you hard drive and store the file
name in the database. If for whatever reason you can't or don't want to
do that, then at least store it in a separate table that only gets
touched when the image is requested.

--
Richard Heyes
Employ me:
http://www.phpguru.org/cv







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



Re: [PHP] text messages

2008-02-05 Thread blackwater dev
Thanks,

We are basically just looking to prototype something with about 50 users for
now so I'll check these out.

Thanks again!

On Feb 5, 2008 12:30 PM, Richard Lynch [EMAIL PROTECTED] wrote:

 On Mon, February 4, 2008 9:15 pm, blackwater dev wrote:
  I know this isn't specific to php but I need to add some code to my
  php
  pages to start sending out text messages.  If anyone does this, how do
  you
  do it?  Do you simply use a free service like teleflip or do you use a
  paid
  aggregator company?

 If you want to do ANY kind of volume or have ANY kind of certainty
 that somebody at least tried to deliver the message, then pay an
 aggregator.

 If you're setting it up to let grandma send you a text, use teleflip.

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/from/lynch
 Yeah, I get a buck. So?




[PHP] text messages

2008-02-04 Thread blackwater dev
I know this isn't specific to php but I need to add some code to my php
pages to start sending out text messages.  If anyone does this, how do you
do it?  Do you simply use a free service like teleflip or do you use a paid
aggregator company?

Thanks!


Re: [PHP] building php with DB extension without installing DB locally

2008-01-22 Thread dev

Quoting Jochem Maas [EMAIL PROTECTED]:


hi guys,

I want to build php with firebirdDB (ibase) extension (for the purposes
of this exercise it could just as well be mysql) without installing firebird
on the local machine (i'm moving the DB to a seperate server) ...

I can't figure out how to do this apart from installing firebird,   
building php

then removing firebird again - although I'm not sure this would even work.

Does anyone know the correct way to go about such a thing?

TIA


Think it's the same as compiling with the mysql extension. You need  
the client libraries to build PHP. So just install the firebird client  
and compile against that. That should work .. right?


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



[PHP] a better way to do a data import?

2008-01-21 Thread blackwater dev
I  have a text file that contains 200k rows.   These rows are to be imported
into our database.  The majority of them will already exists while a few are
new.  Here are a few options I've tried:

I've had php cycle through the file row by row and if the row is there,
delete it and do a straight insert but that took a while.

Now I have php get the row from the text file and then to array_combine with
a default array I have in the class so I can have key value pairs.  I then
take that generated array and do array_diff to the data array I pulled from
the db and I then have the columns that are different so I do an update on
only those columns for that specific row.  This is slow and after about
180,000 rows, php throws a memory error.  I'm resetting all my vars to NULL
at each iteration so am not sure what's up.


Anyone have a better way to do this?  In MySQL, I could simply a replace on
each row...but not in postgres.

Thanks!


Re: [PHP] a better way to do a data import?

2008-01-21 Thread blackwater dev
I think that's possible, so I'll give it a shot.

For some reason, even with straight inserts my php script is dying around
180,000 rows.  Basically, I took out all the compare/update code so now I
grab the row from the db and if there isn't one, do an insert.  I've wiped
my db so should do straight inserts so I'm not sure what's taking up the
memory.



private function processFile($table, $key){

$this-openFileForReading(); //foudn in GLFile class
while (!feof($this-fileHandle)) {
$file_data = fgets($this-fileHandle);

$this-insert($table, $key, $file_data);

}
  $this-closeFile();

}

private function insert($table, $key, $data){
if (strlen($data)10) return false;

$data=$this-db-escape_string($data);

//this is the data we will use should we need to do an insert
$insert_data = str_replace(\, ', $data);

//this is a hack we need to change the separator of the file
//we need this because we need to put the data into an array and if
//we simply use the comma, then it splits address fields
$data = str_replace(\,\, ~, $data);
$data = str_replace(\,,$data); //let's remove the double quotes
$this-setDelimiter(~);
$dataToArray=$this-stringToArray($data);
//set it back for other functions
$this-setDelimiter(,);

//get the id, we trust it is the first column


$key_data=$dataToArray[0];

//does the value exist in the database already?
$sql=select * from prelim_$table where $key='$key_data';
$handle=$this-db-select($sql);
if ($this-db-row_count($handle)0){
$textData=array();
$colsToUpdate=;
$dataRow=;
$dataRow=$this-db-fetch_row($handle);
//now that we have the data, let's merge the row from the
//file with the column names

$textData=array_combine($this-carrierColumns,
$dataToArray);
//cast some values that are strings in the text file
$textData['cars1']=(int) $textData['cars1'];
$textData['car_amount']=(int)
$textData['car_amount'];

$textData['total_work']=trim($textData['total_work']);

$textData['business_zip']=trim($textData['business_zip']);
  //clean up some old db data
$dataRow['rfc_number']=trim($dataRow['rfc_number']);

$dataRow['business_zip']=trim($dataRow['business_zip']);



  $colsToUpdate=array_diff($textData,$dataRow);

//if we have columns to update, do it
if (count($colsToUpdate)0){

$colset=;
foreach ($colsToUpdate as $column=$value){
$colset.=$column='$value',;
}
//strip last comma
$colset=substr($colset, 0, -1);
$sql=update prelim_$table set $colset where
$key='$key_data';
$this-db-write($sql);

}

$dataRow=NULL;
$colsToUpdate=NULL;
$colset=NULL;
$textData=NULL;
 }
else{

//insert the row
$sql=insert into prelim_$table values (;
$sql.=trim($insert_data);
$sql.=);;
$this-db-write($sql);
}




}


On Jan 21, 2008 12:55 PM, Robert Cummings [EMAIL PROTECTED] wrote:


 On Mon, 2008-01-21 at 12:35 -0500, blackwater dev wrote:
  I  have a text file that contains 200k rows.   These rows are to be
 imported
  into our database.  The majority of them will already exists while a few
 are
  new.  Here are a few options I've tried:
 
  I've had php cycle through the file row by row and if the row is there,
  delete it and do a straight insert but that took a while.
 
  Now I have php get the row from the text file and then to array_combine
 with
  a default array I have in the class so I can have key value pairs.  I
 then
  take that generated array and do array_diff to the data array I pulled
 from
  the db and I then have the columns that are different so I do an update
 on
  only those columns for that specific row.  This is slow and after about
  180,000 rows, php throws a memory error.  I'm resetting all my vars to
 NULL
  at each iteration so am not sure what's up.
 
 
  Anyone have a better way to do this?  In MySQL, I could simply a replace
 on
  each row...but not in postgres.

 Does Postgres support any method of temporarily disabling keys/indexing?
 Indexing is what causes the inserts to take a while. MySQL can optimize
 an import by locking the table and allowing the keys/indexes to be
 temporarily disabled. You'll see the following lines in recent MySQL
 database dumps surrounding the inserts:

 /*!4 ALTER TABLE `xxx` DISABLE KEYS */;
 INSERT ...
 INSERT ...
 /*!4 ALTER TABLE `xxx` ENABLE KEYS */;

 Cheers

[PHP] sftp

2008-01-04 Thread blackwater dev
I have a script that has to make a connection via sftp and read the contents
of a file.  In the shell, I can simply type

sftp [EMAIL PROTECTED]

As I use the keys on the server so don't need a password.  How can I make
this connection in php so I can get the data contents nightly?  We installed
teh ssh2 pecl package and I saw an example showing:


$file=fopen(ssh2.sftp://[EMAIL PROTECTED]:22/files/myfile.txt,r);


Yet php throws the error that it can't find the ssh2.sftp wrapper.  First,
if ssh2 installed properly is this fopen syntax correct?  Second, how would
I know if ssh2 is install properly?

THanks!


[PHP] automatic caller

2008-01-02 Thread blackwater dev
I'm working on a prototype now and was wondering if anyone new of a service
where I could pass in text and a number and the service would call the
number and read the text.  I know I can do this with asterisk and it's php
api but don't have time to set up all the outgoing code/functionality.  Does
anyone know of a service that does this so I can show it as a proof of
concept.  I looked at GrandCentral but it doesn't appear to have this
feature.

Thanks!


[PHP] sftp connecting to remove server via php

2007-12-11 Thread blackwater dev
I have to write a script that will connect to a remove server using sftp and
pull in specific files for processing.  Currently I can get to the server by
just using sftp [EMAIL PROTECTED]  How can I open these files via php?  Is the
only way to use fopen with the PECL sftp, ssh2 modules?

Thanks!


Re: [PHP] sftp connecting to remove server via php

2007-12-11 Thread blackwater dev
Sorry, thanks for the info!

On Dec 11, 2007 3:26 PM, Jay Blanchard [EMAIL PROTECTED] wrote:

 [snip]
 Yes but will these handle sftp? I have a key on the other server so don't
 need a password.
 [/snip]

 http://us.php.net/manual/en/function.ftp-ssl-connect.php

 always reply to all so the mail gets back on the list



[PHP] nusoap service + php5 soap client problems

2007-10-02 Thread blackwater dev
Hello,

I have this nusoap service:

$server= new soap_server();
$server-register('authenticate_user', array(), array());

// Initialize WSDL support
$server-configureWSDL('authenticate', 'urn:authenticate');
// Register the method to expose
$server-register('authenticate_user',  // method name
array('key' = 'xsd:string','params'='xsd:array'), // input parameters
array('return' = 'xsd:array'), // output parameters
'urn:authenticate', // namespace
'urn:authenticate#authenticate_user',   // soapaction
'rpc',  // style
'encoded',  // use
'Authenticates User'  // documentation
);

function authenticate_user($key=null,$params=null){
$data['message']=true;
$data['key']=$key;
$data['params']=$params;
 return $data;
}

/* start the service */
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server-service($HTTP_RAW_POST_DATA);


I then have a php5 box calling the service:


$client = new SoapClient(http://mysite.com/authenticate.php?wsdl;);
$return=$client-authenticate_user(fdsfds,array(username=mynameis,password=fred));

Problem is, it throws an error of:

*Fatal error*: Uncaught SoapFault exception: [HTTP] Unable to parse URL in
/var/www/mysite/html/webservices/test_authenticate_service.php:9 Stack
trace: #0 [internal function]: SoapClient-__doRequest('?xml version=...',
'http:///~me...', 'urn:authenticat...', 1, 0) #1 [internal function]:
SoapClient-__call('authenticate_us...', Array) #2
/var/www/mysite/html/webservices/test_authenticate_service.php(9):
SoapClient-authenticate_user('fdsfds', Array) #3 {main} thrown in *
/var/www/mysite/html/webservices/test_authenticate_service.php* on line *9

How can I fix this?

Thanks!
*


Re: [PHP] nusoap service + php5 soap client problems

2007-10-02 Thread blackwater dev
Yeah, because that was just changed so I could post it here:

Here is the actual wsdl:

definitions targetNamespace=urn:authenticate
−
types
−
xsd:schema targetNamespace=urn:authenticate
xsd:import namespace=http://schemas.xmlsoap.org/soap/encoding//
xsd:import namespace=http://schemas.xmlsoap.org/wsdl//
/xsd:schema
/types
−
message name=authenticate_userRequest
part name=key type=xsd:string/
part name=params type=xsd:string/
/message
−
message name=authenticate_userResponse
part name=return type=xsd:array/
/message
−
portType name=authenticatePortType
−
operation name=authenticate_user
documentationAuthenticates Getloaded User/documentation
input message=tns:authenticate_userRequest/
output message=tns:authenticate_userResponse/
/operation
/portType
−
binding name=authenticateBinding type=tns:authenticatePortType
soap:binding style=rpc transport=http://schemas.xmlsoap.org/soap/http/
−
operation name=authenticate_user
soap:operation soapAction=urn:authenticate#authenticate_user
style=rpc/
−
input
soap:body use=encoded namespace=urn:authenticate encodingStyle=
http://schemas.xmlsoap.org/soap/encoding//
/input
−
output
soap:body use=encoded namespace=urn:authenticate encodingStyle=
http://schemas.xmlsoap.org/soap/encoding//
/output
/operation
/binding
−
service name=authenticate
−
port name=authenticatePort binding=tns:authenticateBinding
soap:address
location=http:///~jack/development/webservices/authenticate.gl/
/port
/service
/definitions

On 10/2/07, Nathan Nobbe [EMAIL PROTECTED] wrote:

 this doesnt look like a wsdl file to me
 http://mysite.com/authenticate.php?wsdl

 -nathan

 On 10/2/07, blackwater dev [EMAIL PROTECTED] wrote:

  Hello,
 
  I have this nusoap service:
 
  $server= new soap_server();
  $server-register('authenticate_user', array(), array());
 
  // Initialize WSDL support
  $server-configureWSDL('authenticate', 'urn:authenticate');
  // Register the method to expose
  $server-register('authenticate_user',  // method name
  array('key' = 'xsd:string','params'='xsd:array'), // input
  parameters
  array('return' = 'xsd:array'), // output
  parameters
  'urn:authenticate', // namespace
  'urn:authenticate#authenticate_user',   // soapaction
  'rpc',  // style
  'encoded',  // use
  'Authenticates User'  // documentation
  );
 
  function authenticate_user($key=null,$params=null){
  $data['message']=true;
  $data['key']=$key;
  $data['params']=$params;
   return $data;
  }
 
  /* start the service */
  $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA :
  '';
  $server-service($HTTP_RAW_POST_DATA);
 
 
  I then have a php5 box calling the service:
 
 
  $client = new SoapClient( http://mysite.com/authenticate.php?wsdl;);
  $return=$client-authenticate_user(fdsfds,array(username=mynameis,password=fred));
 
 
  Problem is, it throws an error of:
 
  *Fatal error*: Uncaught SoapFault exception: [HTTP] Unable to parse URL
  in
  /var/www/mysite/html/webservices/test_authenticate_service.php:9 Stack
  trace: #0 [internal function]: SoapClient-__doRequest('?xml
  version=...',
  'http:///~me...', 'urn:authenticat...', 1, 0) #1 [internal function]:
  SoapClient-__call('authenticate_us...', Array) #2
  /var/www/mysite/html/webservices/test_authenticate_service.php(9):
  SoapClient-authenticate_user('fdsfds', Array) #3 {main} thrown in *
  /var/www/mysite/html/webservices/test_authenticate_service.php* on line
  *9
 
  How can I fix this?
 
  Thanks!
  *
 




Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)

2007-09-14 Thread dev
On Fri, 14 Sep 2007 10:10:09 +0200, Per Jessen [EMAIL PROTECTED] wrote:
 Per Jessen wrote:
 
 To let a user script bring down the host environment is just not
 acceptable. IMHO.
 
 Here's an example from this morning - I have a situation where all I
 need to do is add a single superfluous double quote, and I get a
 segfault.  Is that not poor error handling somewhere?  
 
 
 
 
 /Per Jessen, Zürich
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Would love to see the code that caused this.

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



[PHP] good os, php drive classifieds package?

2007-08-20 Thread blackwater dev
I need to put together a car classifieds site and before I re-invent the
wheel was curious if anyone new of any good php driven OS packages
available.  Does anyone have any recommendations?

Thanks!


[PHP] OT- why is network solutions more than godaddy?

2007-08-03 Thread blackwater dev
I have to register a bunch of names and am trying to figure out why I would
pay $35 when I can just pay $9 at godaddy.  Does godaddy own it and I lease
it from them???

Thanks!


[PHP] headers-excel file-bad data

2007-07-31 Thread blackwater dev
Hello,

I have an excel file that I am generating.  If I copy over the generated
file and then open it in excel, it works fine, if I try to let the user
download it using the headers below, when I then open it excel complains
that it is an unrecognizable format and the info is garbled...any ideas???

Thanks!

header('Pragma: public');
header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);  //
Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); //
HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0');//
HTTP/1.1
header (Pragma: no-cache);
header(Expires: 0);
header('Content-Transfer-Encoding: none');
header('Content-Type: application/vnd.ms-excel;'); //
This should work for IE  Opera
header(Content-type: application/x-msexcel);//
This should work for the rest
header('Content-Disposition: attachment; filename=myfile.xls');
readfile(/tmp/myfile.xls);


[PHP] Re: headers-excel file-bad data

2007-07-31 Thread blackwater dev
Looks like I have an empty space somewhere...this code is called down in a
class and if I just cut this out and copy into it's own file and call that
file from the browser, it works fine.  It is someone getting garbled down in
the class.

On 7/31/07, blackwater dev [EMAIL PROTECTED] wrote:

 Hello,

 I have an excel file that I am generating.  If I copy over the generated
 file and then open it in excel, it works fine, if I try to let the user
 download it using the headers below, when I then open it excel complains
 that it is an unrecognizable format and the info is garbled...any ideas???

 Thanks!

 header('Pragma: public');
 header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);  //
 Date in the past
 header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
 header('Cache-Control: no-store, no-cache, must-revalidate'); //
 HTTP/1.1
 header('Cache-Control: pre-check=0, post-check=0, max-age=0');//
 HTTP/1.1
 header (Pragma: no-cache);
 header(Expires: 0);
 header('Content-Transfer-Encoding: none');
 header('Content-Type: application/vnd.ms-excel;'); //
 This should work for IE  Opera
 header(Content-type: application/x-msexcel);//
 This should work for the rest
 header('Content-Disposition: attachment; filename=myfile.xls');
 readfile(/tmp/myfile.xls);






Re: [PHP] Array Push question

2007-07-12 Thread dev
On Thu, 12 Jul 2007 18:45:36 +1000, John Comerford [EMAIL PROTECTED] wrote:
 Hi Folks,
 
 Is there a better way of doing the following:
 
 $Rows[] = array();
 $currentRow = count($Rows) - 1;
 $Rows[$currentRow]['test'] = this is a test;
 
 Specifically I am wonder if I can avoid having to use 'count'.
 
 TIA,
   JC
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

This code looks weird...

$currenRow will be numeric. So why would you do $currentRow['test']?
Anyway if you just wanna add an element to the end of the array use array_push

http://nl3.php.net/manual/en/function.array-push.php

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



[PHP] ob_start eval?

2007-07-05 Thread blackwater dev

I have a template system that takes some data, scrubs it and then with a
load method includes the required template.  I need to add a param so it
doesn't simply include but returns the contents of the template in a string
with all of the vars populated.  I tried:

ob_start();
 include my template
$template=ob_get_contents();
ob_clean();
return $template;

But this returns the template it's it's raw for with all of tha
?=$whatever? tags.  Can I fill these in and still pass as another var
without using eval()?

What do other template systems to do return a template as a string on load?


Thanks!


Re: [PHP] ob_start eval?

2007-07-05 Thread blackwater dev

We have short tags enabled as our templates work fine with them.

Thanks!

On 7/5/07, Larry Garfield [EMAIL PROTECTED] wrote:


If I understand what you're doing correctly, then it should work and I've
done
it many times.  First thing you should do, though, is switch from short
tags
to proper tags, ?php echo $whatever; ?.  If you have short tags
disabled,
it will not parse ?= syntax.

On Thursday 05 July 2007, blackwater dev wrote:
 I have a template system that takes some data, scrubs it and then with a
 load method includes the required template.  I need to add a param so it
 doesn't simply include but returns the contents of the template in a
string
 with all of the vars populated.  I tried:

 ob_start();
   include my template
 $template=ob_get_contents();
 ob_clean();
 return $template;

 But this returns the template it's it's raw for with all of tha
 ?=$whatever? tags.  Can I fill these in and still pass as another var
 without using eval()?

 What do other template systems to do return a template as a string on
load?


 Thanks!


--
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]  ICQ: 6817012

If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the
possession
of every one, and the receiver cannot dispossess himself of it.  --
Thomas
Jefferson

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




[PHP] php hosting-mediatemple/dreamhost

2007-05-24 Thread blackwater dev

Forgive me if this is a bit off topic but I currenly have several sites
hosted with dreamhost, it's cheap and well prone to be slow.  Does anyone
have experience with mediatemple?  I would just be running php/mysql sites.

Thanks!


[PHP] cloning $this php5

2007-05-11 Thread blackwater dev

I have a method within an class that should make a copy of itself, do some
stuff on the copy and return it.  The object contains data members that are
references to other objects.  I basically want a brand new copy of the
object.  The problem is, certain methods I call on the object throw this
error:

Call to undefined method stdClass::methodname

I've tried to copy it with just =, = and clone but they all through
errors.  What am I doing wrong?

Thanks!

function morph(){

$cloned_ob= clone $this;

$cloned_ob-run();
$cloned_ob-data_member=john;

return $cloned_ob;

}


[PHP] Re: cloning $this php5

2007-05-11 Thread blackwater dev

Actually, the error seems to be coming with inner objects call some of their
methods.  For example the object as a datamember that is a reference to
another object.  When I clone it, I can't seem to call methods on the data
member object.

Thanks!

On 5/11/07, blackwater dev [EMAIL PROTECTED] wrote:


I have a method within an class that should make a copy of itself, do some
stuff on the copy and return it.  The object contains data members that are
references to other objects.  I basically want a brand new copy of the
object.  The problem is, certain methods I call on the object throw this
error:

 Call to undefined method stdClass::methodname

I've tried to copy it with just =, = and clone but they all through
errors.  What am I doing wrong?

Thanks!

function morph(){

$cloned_ob= clone $this;

$cloned_ob-run();
$cloned_ob-data_member=john;

return $cloned_ob;

}



[PHP] filetype() and exec() issues

2007-04-23 Thread dev
This question is a two parter

a) anyone else noticing filetype() failing on ISO image files?

Warning: filetype(): Lstat failed for /var/lib/samba/some/file.iso

b) I have a script that during processing will eventually call

  exec('/usr/bin/file -bi '.$file)

over 1000 times, I've added a counter and when it dies on this line it's
always after 1020 exec calls, regardless of the file name I'm feeding to
`file`.  I've reproduced this with both exec, shell_exec, system and the
backticks.  What am I missing here?

My System:
Linux carbon 2.6.18-gentoo-r3
PHP 5.2.1-pl3-gentoo (cli) (built: Apr 19 2007 00:42:03)
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

/djb

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



[PHP] upload file then move between servers

2007-04-20 Thread blackwater dev

I need to allow a user to upload a file.  Once the file is up, I need to
then move it to another server and wsync it to our webclusters.  What's the
best way to do this with php?  I don't really want php issuing root
commands.  I've considered storing the file in the db but really need it to
be scanned (they should just be images) then pushed out to my servers.

Thanks!


[PHP] post via text message?

2007-04-16 Thread blackwater dev

I'm working on a site where I need to allow someone to send me a text
message and let the code take their message and respond or post it in the
db.  Can someone point me in the right direction on how this is done?

Thanks!


[PHP] php forcing a post??

2007-02-20 Thread blackwater dev

I currently have an html page that posts to a cgi function.  I need to
interject some php in the middle.  So, the form will post to itself, the php
page will catch the post, check on thing and then pass along to the cgi page
but the cgi page only handles posts.  How can I still php in the middle and
still have it 'post' to the cgi page?

Thanks!


Re: [PHP] Re: php forcing a post??

2007-02-20 Thread blackwater dev

Currently the form posts to /cgi/process

Process does all sorts of stuff.  I basically just want to step in the
middle and do one small php thing and then send the form on to the process
cgi script just like the form had posted it there.


On 2/20/07, Al [EMAIL PROTECTED] wrote:


One simple way would be to have php send the page to the client. Then,it
will
look for the response.

blackwater dev wrote:
 I currently have an html page that posts to a cgi function.  I need to
 interject some php in the middle.  So, the form will post to itself, the
 php
 page will catch the post, check on thing and then pass along to the cgi
 page
 but the cgi page only handles posts.  How can I still php in the middle
and
 still have it 'post' to the cgi page?

 Thanks!


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




[PHP] how do I just escape double quotes within a string?

2007-02-13 Thread blackwater dev

If I use add slashes, it strips everything, I just want to replace all the
double quotes with slash double quote but this, of course, throws errors:

str_replace(,\,$code);


Thanks!


[PHP] round to nearest 500?

2007-02-12 Thread blackwater dev

Is there an easy way in php to round to the nearest 500?

So if I have 600, I 500 and if I have 800 I want 1000?

Thanks!


[PHP] php based digg like package?

2007-02-10 Thread blackwater dev

A month or so ago I can across a php based open source community news
package.  I can't seem to find it now...does anyone know of one?

Thanks!


[PHP] bit wise math? Is there a function to easily return the bits?

2007-01-25 Thread blackwater dev

Is there a php function I can call to pass in a number and get the values
returned?

For example, pass in 7 and get 1,2,4 ?

Thanks!


[PHP] creating an api-which protocol do you use?

2007-01-23 Thread blackwater dev

I need to create some webservices for our web app and am really torn as to
which route to go...SOAP, XML_RPC, etc.?  I like the looks of REST but many
of our partners that will be using our services use cold fusion and I think
that has build in SOAP support.

Which protocol would you use?

Thanks!


[PHP] os php scheduler?

2007-01-20 Thread blackwater dev

Does anyone have recommendations for an open source php based,
'lightweight', scheduling app?  I just want something clean that I can use
to schedule trainings within our company.  I need to be able to put in
details for each training and then see a synopsis on a calender.  Just a
basic scheduler but clean and useful.

Thanks!


[PHP] webservice libraries/frameworks

2007-01-19 Thread blackwater dev

I've heard that there might be a php library or framework that allows you to
expose your code as a webservice with little to no extra code.  I heard the
code could potentially also allow access via several different protocols.

Has anyone come across anything similar, or do I need to pick a specific
protocol for my services?

Thanks!


[PHP] nuSoap -method '' not defined in service

2007-01-18 Thread blackwater dev

I have the following code but when I hit the page, I get the xml error of
method '' not defined in service.  I don't have a wsdl or anything defined.
Is there more I need to do to get the SOAP service set up?

Thanks!

include(nusoap/nusoap.php);

$server=new soap_server();
$server-register('getColumns');

function getColumns(){

   $search= new carSearch();

   return $search-getSearchColumns();

}
$server-service($HTTP_RAW_POST_DATA);


[PHP] sms through teleflip and php?

2007-01-16 Thread blackwater dev

Has anyone been able to successfully send a text message using php and the
mail function?

It works fine if I open up thunderbird and send a message to
[EMAIL PROTECTED] but if I use the mail function:

mail([EMAIL PROTECTED], test, test);

It doesn't work.  I've tried several different approaches so was curious if
others have used it successfully.

Thanks!


Re: [PHP] sms through teleflip and php?

2007-01-16 Thread blackwater dev

Thanks for all the insights.  It appears that it might have thought my email
was spam as I sent it from another server and it worked fine.

Thanks!

On 1/16/07, Jochem Maas [EMAIL PROTECTED] wrote:


also consider that there maybe a reverse lookup being done on the sending
MTA
that the sms gateway doesn't consider kosher .. and/or that the IP of the
sending MTA is grey-listed/black-listed.

also a check may be being done to see if the sender's account exists
on the sender's [your servers] domain.

check the relevant logs on your server to see what (if anything)
the sms gateway is asking your server. (no idea what/where those logs
are hiding out).

sorry if this all sounds vague, I'm mostly parroting what others have said
in the past - I'm hardly what you would call knowledgable with regard to
mail servers
and all that jazz.

[EMAIL PROTECTED] wrote:
 Maybe phpMailer isn't sending the correct headers either.  Sometimes all
it takes is one missing header that a system is looking for and it may
filter it as spam or something.

 Again, I encourage you to examine the headers from your Thunderbird
good email and compare it to your PHP and/or phpMailer headers that are
getting sent.  Possibly try to emulate the successful email as much as
possible by copying the headers from a known successful message.

 If that doesn't work, then you may contact teleflip or whatever service
you're trying to send text messages to and ask them if they can provide any
information as to why it may not be going through.  Never know, might find
someone with half a brain who can help.

 -TG

 = = = Original message = = =

 I tried using phpMailer and all and it nothing seems to work right.  I
can
 send it fine through thunderbird but it just seems to complain via
php.  Not
 sure why.

 On 1/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED]

 wrote:
 I'm guessing the SMS system is rejecting the email because it's lacking
 some headers that mail programs tend to use... and spammers sometimes
 forget.

 You might send your email from Thunderbird.. CC yourself on it.  Verify
 that it went through as a text message, then open the CC'd copy and
look at
 the headers.  You can start by taking all those headers and putting
them
 into your PHP script then slowly commenting some out until you get just
what
 you need and not a lot of extra garbage (to keep it simple and
 semi-elegant).

 That's where I'd start at least.

 -TG

 = = = Original message = = =

 Has anyone been able to successfully send a text message using php and
the
 mail function?

 It works fine if I open up thunderbird and send a message to
 [EMAIL PROTECTED] but if I use the mail function:

 mail([EMAIL PROTECTED], test, test);

 It doesn't work.  I've tried several different approaches so was
curious
 if
 others have used it successfully.

 Thanks!


 ___
 Sent by ePrompter, the premier email notification software.
 Free download at http://www.ePrompter.com.





[PHP] use_trans_id doesn't add PHPSESSID to url string

2006-12-20 Thread blackwater dev

I have session.user_trans_id set to 1 in my php.ini file yet when I see
links, the PHPSESSID isn't automatically added.  I have another site where
this is done by php but on another box it isn't.  The broken box uses
4.3.11with the following ini settings.  What am I missing?

Thanks!

session.auto_startOffOff session.bug_compat_42OnOn session.bug_compat_warnOn
On session.cache_expire00 session.cache_limiternocachenocache
session.cookie_domain*no value**no value* session.cookie_lifetime00
session.cookie_path// session.cookie_secureOffOff session.entropy_file/de/de
session.entropy_length00 session.gc_divisor100100 session.gc_maxlifetime
2160021600 session.gc_probability0.00010.0001 session.namePHPSESSIDPHPSESSID
session.referer_check*no value**no value* session.save_handlerfilesfiles
session.save_path/tmp/tmp session.serialize_handlerphpphp
session.use_cookiesOffOff session.use_only_cookiesOffOff
session.use_trans_sidOnOn


[PHP] inheritance php4

2006-12-12 Thread blackwater dev

Ok,

I have a class which inherits from a parent class.  My first thought is that
the child class inherits all of the functions of the parent but that doesn't
seem to be the case, do I really have to put parent::somefunction() to call
each one?  Why can't I just use $this-parentfunction(); within the child
class?

Thanks!


class Parent{

function getAddress(){}

}

class Child extends Parent{

   function getInfo(){

   $this-getAddress(); //throws error

}

}


[PHP] Re: inheritance php4

2006-12-12 Thread blackwater dev

nevermind, I was doing something stupid.

On 12/12/06, blackwater dev [EMAIL PROTECTED] wrote:


Ok,

I have a class which inherits from a parent class.  My first thought is
that the child class inherits all of the functions of the parent but that
doesn't seem to be the case, do I really have to put parent::somefunction()
to call each one?  Why can't I just use $this-parentfunction(); within the
child class?

Thanks!


class Parent{

 function getAddress(){}

}

class Child extends Parent{

function getInfo(){

$this-getAddress(); //throws error

}

}



[PHP] turning use session cookies off still uses cookies?

2006-11-30 Thread blackwater dev

I asked a similar question the other day but I have been having an issue
lately with my sessions and certain browsers.  I then tried to set my
session.use_cookies var in php.ini to 0 yet if I log in and don't have
cookies turned on, the sessions still don't seem to work.  Can I really use
sessions without using cookies?  Below is my code and sessions settings.  If
I can use sessions without cookies, seems like that would solve the issue of
people having cookies turned on.

Thanks,

//this is from the login routine
if ($this-db-getField('user_id')){

   session_start();

$_SESSION['user']['user_id']=$this-db-getField('user_id');

$_SESSION['user']['email']=$this-db-getField('email');
   return true;
}

   ?
   //only show if they are logged in
   if (isset($_SESSION['user']['user_id'])  !$_REQUEST['mlsid']){
//show something
}
   ?

Session Support enabled Registered save handlers files user Registered
serializer handlers php php_binary wddx
DirectiveLocal ValueMaster Value session.auto_startOffOff
session.bug_compat_42OffOff session.bug_compat_warnOnOn session.cache_expire
180180 session.cache_limiternocachenocache session.cookie_domain*no value**no
value* session.cookie_lifetime00 session.cookie_path// session.cookie_secure
OffOff session.entropy_file*no value**no value* session.entropy_length00
session.gc_divisor10001000 session.gc_maxlifetime14401440
session.gc_probability11 session.hash_bits_per_character55
session.hash_function00 session.namePHPSESSIDPHPSESSID session.referer_check
*no value**no value* session.save_handlerfilesfiles session.save_path
/var/lib/php/session/var/lib/php/session session.serialize_handlerphpphp
session.use_cookiesOffOff session.use_only_cookiesOffOff
session.use_trans_sid00


[PHP] session issues on ie

2006-11-28 Thread blackwater dev

I have code which logs someone in and then allows them to see certain info
if they are logged in.  I have users who claim it works fin in some of their
browsers, firefox, safari, etc and some versions of IE but not all and I'm
stumped.

Here's the code:


//this is from the login routine
if ($this-db-getField('user_id')){

   session_start();

$_SESSION['user']['user_id']=$this-db-getField('user_id');

$_SESSION['user']['email']=$this-db-getField('email');
   return true;
}

   ?
   //only show if they are logged in
   if (isset($_SESSION['user']['user_id'])  !$_REQUEST['mlsid']){
//show something
}
   ?

People are claiming it tells them they are logged in yet they don't see what
is displayed under the code which checks their session.  For some reason,
sessions don't seem to be there on all browsers yet they claim that cookies
and all are on.

Any ideas?

Thanks!


Re: [PHP] strange errors from command line vs. web

2006-09-28 Thread blackwater dev

Ok, I've set up a username and password using Grant All Privileges, blah.
with username and password.  For some reason though the web now can't login
with that.  I then changed the root db password and put that in the config
and the web side does run properly with that username, password.  I still
can't run the script from the command line even when I su to root.  I am in
a virtual hosting situation so not sure if that's it.  Does it not know what
to do with localhost in a virtual hosting situation when running it from the
command line but does from the web?  I'm trying to print the error but it
just seems to die:

echo about to connect;
$this-connectionID= @mysql_connect($this-host, $this-user,
$this-password);
echo after connect;


From the command line, it never prints the after connect...just seems to die

without error...or at least no error to the screen and I do have a check
right after to kick off the mysql error if there is no connection ID but
again, I am su'ing to root so I thought it would always have rights.  Not
really sure what to do next.

Thanks!

On 9/27/06, Richard Lynch [EMAIL PROTECTED] wrote:


On Wed, September 27, 2006 11:36 am, blackwater dev wrote:
 I have some code that makes a connection to the db.  When I run this
 code
 from the command line, it stops at the db connection.

Show us the code, without any embedded passwords, of course...


 If I call the
 script
 from the browser, it works fine.

This almost always boils down to:
PHP runs as nobody or a similarly unpowered user
You log in as you, blackwaterdev or whatever, with many powers.

In this case, it looks like 'nobody' has their own database, and is
allowed to connect to it, but you are not.

 I've changed the permissions and
 that
 didn't work.

Changed which permissions?

mysql_admin?
If so, did you reload the permissions after change?

File executable?

What?

 The db connection is the basic, localhost, root, with no
 password.

Now that is an entirely separate problem.

DON'T DO THAT!

:-)

 What else can I try?

You're going to have to create a user and set a password anyway, so do
that first.

There's no point in getting localhost/root/[blank] to work when it's
not what you want anyway.

--
Like Music?
http://l-i-e.com/artists.htm





Re: [PHP] strange errors from command line vs. web

2006-09-28 Thread blackwater dev

Ok, dumb question but how do I do that?  I know how to re-compile the
standard php.  My code also uses mssql via freetds, does that somehow need
to be enabled as it doesn't seem to fail there.

Thanks!

On 9/28/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote:


Hi,

(sorry for top-posting)

This is the great way PHP-cli lets you know it hasn't got any MySQL
support :)

Enable that, and you're good to go. Mind you, PHP-cli has a separate
php.ini file.

Ivo



On Thu, 28 Sep 2006 08:26:13 -0400, blackwater dev wrote:
 Ok, I've set up a username and password using Grant All Privileges,
blah.
 with username and password.  For some reason though the web now can't
login
 with that.  I then changed the root db password and put that in the
config
 and the web side does run properly with that username, password.  I
still
 can't run the script from the command line even when I su to root.  I am
in
 a virtual hosting situation so not sure if that's it.  Does it not know
what
 to do with localhost in a virtual hosting situation when running it from
the
 command line but does from the web?  I'm trying to print the error but
it
 just seems to die:

 echo about to connect;
 $this-connectionID= @mysql_connect($this-host, $this-user,
 $this-password);
 echo after connect;

 From the command line, it never prints the after connect...just seems to
die
 without error...or at least no error to the screen and I do have a check
 right after to kick off the mysql error if there is no connection ID but
 again, I am su'ing to root so I thought it would always have
rights.  Not
 really sure what to do next.

 Thanks!

 On 9/27/06, Richard Lynch [EMAIL PROTECTED] wrote:

 On Wed, September 27, 2006 11:36 am, blackwater dev wrote:
  I have some code that makes a connection to the db.  When I run this
  code
  from the command line, it stops at the db connection.

 Show us the code, without any embedded passwords, of course...


  If I call the
  script
  from the browser, it works fine.

 This almost always boils down to:
 PHP runs as nobody or a similarly unpowered user
 You log in as you, blackwaterdev or whatever, with many powers.

 In this case, it looks like 'nobody' has their own database, and is
 allowed to connect to it, but you are not.

  I've changed the permissions and
  that
  didn't work.

 Changed which permissions?

 mysql_admin?
 If so, did you reload the permissions after change?

 File executable?

 What?

  The db connection is the basic, localhost, root, with no
  password.

 Now that is an entirely separate problem.

 DON'T DO THAT!

 :-)

  What else can I try?

 You're going to have to create a user and set a password anyway, so do
 that first.

 There's no point in getting localhost/root/[blank] to work when it's
 not what you want anyway.

 --
 Like Music?
 http://l-i-e.com/artists.htm




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




Re: [PHP] strange errors from command line vs. web

2006-09-28 Thread blackwater dev

Yep, I get called to undefined function so I need to somehow re-compile the
cli version?  How do I give support to just the cli version?  I'm going to
the docs now.

Thanks!

On 9/28/06, Travis Doherty [EMAIL PROTECTED] wrote:


blackwater dev wrote:

 Ok, dumb question but how do I do that?  I know how to re-compile the
 standard php.  My code also uses mssql via freetds, does that somehow
 need
 to be enabled as it doesn't seem to fail there.

 Thanks!

 
  echo about to connect;
  $this-connectionID= @mysql_connect($this-host, $this-user,
  $this-password);
  echo after connect;
 

Just to verify that this is in fact the problem you should remove the
'@' sign from mysql_connect.  '@' is a way of supressing errors, you
specifically WANT that error.  Is there a reason you have the '@' there?

If the error is 'Undefined function mysql_connect' then you do need to
get MySQL support compiled in...  If it is available on the apache
module it should be available to the CLI as well.

If there is no 'undefined function' error then you should also be
calling 'echo mysql_error()' to see what the error is after connecting.
That error is going to give you more info than any of us can.

Travis



[PHP] strange errors from command line vs. web

2006-09-27 Thread blackwater dev

I have some code that makes a connection to the db.  When I run this code
from the command line, it stops at the db connection.  If I call the script
from the browser, it works fine.  I've changed the permissions and that
didn't work.  The db connection is the basic, localhost, root, with no
password.

What else can I try?


[PHP] storing function names in db and running them as row is output?

2006-09-20 Thread blackwater dev

First, the example I have is not the real situation, just an example so I
don't want to get into why are you doing it like that, etc.  Just want to
see if it's possible.

Basically, I want to store stuff in a text field in a db like this johns
name is ucfirst('john adams') .

When I cycle through that row for output in my php script, I want it to not
see ucfirst as text but as the php function and run ithow is the
possible?

Thanks.


Re: [PHP] storing function names in db and running them as row is output?

2006-09-20 Thread blackwater dev

great, thanks.  So if it's just text, eval won't do anything?

On 9/20/06, Christopher Weldon [EMAIL PROTECTED] wrote:


blackwater dev wrote:
 First, the example I have is not the real situation, just an example so
I
 don't want to get into why are you doing it like that, etc.  Just want
to
 see if it's possible.

 Basically, I want to store stuff in a text field in a db like this
johns
 name is ucfirst('john adams') .

 When I cycle through that row for output in my php script, I want it to
not
 see ucfirst as text but as the php function and run ithow is the
 possible?

 Thanks.


$db_query = mysql_query(select command from table);
if ($db_query  mysql_num_rows($db_query)  0) {
   while ($array = mysql_fetch_array($db_query)) {
 eval($array['command']);
   }
}

eval() is your solution.

--
Christopher Weldon, ZCE
President  CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
979.739.5874



[PHP] live chat support

2006-09-01 Thread blackwater dev

Does anyone have any recommendations on some good live chat support apps?
These are the ones where someone can go to your site, click a button and
open a chat window with a customer service person.  I'm particularly
interested in ones where we handled the server and everything.

Thanks!


[PHP] globals, simpletest and php from command line

2006-08-30 Thread blackwater dev

I have a php app that runs on php4.  I am writing some unit tests now using
SimpleTest but some of the libraries that I have to pull in for testing are
failing.  For example, my db library sets some params:

$dname=mydatabase;
$usr=me;
..etc

I then have some mysql functions that connect using

function con(){
 global $dname;
 ..etc.

}

When this is all run from the browser, things are fine but via simpletest
and command line, the globals are lost.  Is this just a problem with the
command line or with simpletest?

Thanks.


[PHP] sessions no longer work

2006-08-09 Thread blackwater dev

Hello,

I have a site that was coded a while ago.  I was just told that the admin
side no longer works.  I looked and the host recently put php 4.4.2 on the
site.  I have tried a few things but nothing seems to work.  The problem is
once you log in the admin page always kicks you back, doesn't see the
session vars.  What could be wrong?  Here is the code:

?php  require_once('Connections/db.php'); ?
? if (isset($_POST[uname])){
$uname=$_POST[uname];
$pword=md5($_POST[pword]);
 $SQL=select * from users where admin=1 and pword='$pword' and
uname='$uname';
mysql_select_db($database, $wards);
   $Result1 = mysql_query($SQL, $wards) or die(mysql_error());
   $affected_rows = mysql_num_rows($Result1);
if ($affected_rows0){
session_start();
 $_SESSION['wardadmin']=yes;
 header(location: admin.php);
 }
   else {$bad=Incorrect username and Password;}
}

I can echo out the session here and see yes, but I have this code in
admin.php

?
session_start();
if ($_SESSION['wardadmin']!=yes) { header(location: login.php);
exit;
}
?

Thanks!


Re: [PHP] sessions no longer work

2006-08-09 Thread blackwater dev

Sorry if you are getting this multiple times, email is acting a bit screwy.

Nope. still doesn't work.  Sessions just aren't saved.


On 8/9/06, Jochem Maas [EMAIL PROTECTED] wrote:


blackwater dev wrote:
 Hello,

 I have a site that was coded a while ago.  I was just told that the
admin
 side no longer works.  I looked and the host recently put php 4.4.2 on
the
 site.  I have tried a few things but nothing seems to work.  The problem
is
 once you log in the admin page always kicks you back, doesn't see the
 session vars.  What could be wrong?  Here is the code:

 ?php  require_once('Connections/db.php'); ?
 ? if (isset($_POST[uname])){
 $uname=$_POST[uname];
 $pword=md5($_POST[pword]);
  $SQL=select * from users where admin=1 and pword='$pword' and
 uname='$uname';
 mysql_select_db($database, $wards);
$Result1 = mysql_query($SQL, $wards) or die(mysql_error());
$affected_rows = mysql_num_rows($Result1);
 if ($affected_rows0){
 session_start();
  $_SESSION['wardadmin']=yes;

try this here:

session_write_close();

  header(location: admin.php);
  }
else {$bad=Incorrect username and Password;}
 }

 I can echo out the session here and see yes, but I have this code in
 admin.php

 ?
 session_start();
 if ($_SESSION['wardadmin']!=yes) { header(location: login.php);
 exit;
 }
 ?

 Thanks!





Re: [PHP] sessions no longer work

2006-08-09 Thread blackwater dev

It doesn't matter if I just surf to the page and they do seem to get the
same phpsessionid..interestingly enough the first three cars are 'BAD'.  Not
sure if the path is writable through.

On 8/9/06, Jochem Maas [EMAIL PROTECTED] wrote:


blackwater dev wrote:
 Sorry if you are getting this multiple times, email is acting a bit
screwy.

 Nope. still doesn't work.  Sessions just aren't saved.

check that the session save path is writable and have a look to
see if you are getting a new session id each time.



 On 8/9/06, Jochem Maas [EMAIL PROTECTED] wrote:

 blackwater dev wrote:
  Hello,
 
  I have a site that was coded a while ago.  I was just told that the
 admin
  side no longer works.  I looked and the host recently put php 4.4.2on
 the
  site.  I have tried a few things but nothing seems to work.  The
 problem
 is
  once you log in the admin page always kicks you back, doesn't see the
  session vars.  What could be wrong?  Here is the code:
 
  ?php  require_once('Connections/db.php'); ?
  ? if (isset($_POST[uname])){
  $uname=$_POST[uname];
  $pword=md5($_POST[pword]);
   $SQL=select * from users where admin=1 and pword='$pword' and
  uname='$uname';
  mysql_select_db($database, $wards);
 $Result1 = mysql_query($SQL, $wards) or die(mysql_error());
 $affected_rows = mysql_num_rows($Result1);
  if ($affected_rows0){
  session_start();
   $_SESSION['wardadmin']=yes;

 try this here:

 session_write_close();

   header(location: admin.php);
   }
 else {$bad=Incorrect username and Password;}
  }
 
  I can echo out the session here and see yes, but I have this code in
  admin.php
 
  ?
  session_start();
  if ($_SESSION['wardadmin']!=yes) { header(location: login.php);
  exit;
  }
  ?
 
  Thanks!
 







[PHP] yahoo thinks html mail is spam, what's wrong with header?

2006-08-07 Thread blackwater dev

Hello all,

When I try to send email from my server as html, my yahoo account and
several of my user's email accounts mark it as spam.  I can send a normal
email via mail() just fine but when I try to to html, it's bad.  I've played
with a few things but can't seem to figure it out.  The html I am sending
just includes a table, no body, head, etc, just table html code.Here is what
I am using for the header:


$header=From:[EMAIL PROTECTED] [EMAIL PROTECTED]
\r\nContent-Type:text/html\r\n;

Here are some of the headers from yahoo:

X-Apparently-To: [EMAIL PROTECTED] via 66.196.97.50; Sun, 06 Aug 2006
13:46:30 -0700 X-YahooFilteredBulk: 64.140.230.68 X-Originating-IP: [
64.140.230.68] Return-Path: [EMAIL PROTECTED]
Authentication-Results: mta333.mail.re4.yahoo.com from=bwdev.com;
domainkeys=neutral (no sig) Received: from 64.140.230.68 (EHLO
localhost.localdomain) (64.140.230.68) by mta333.mail.re4.yahoo.com with
SMTP; Sun, 06 Aug 2006 13:46:30 -0700 Received: from
localhost.localdomain(web5 [
127.0.0.1]) by localhost.localdomain (8.13.1/8.13.1) with ESMTP id
k76JlHch008629 for [EMAIL PROTECTED]; Sun, 6 Aug 2006 15:47:17 -0400
Received: (from [EMAIL PROTECTED]) by localhost.localdomain 
(8.13.1/8.13.1/Submit)
id k76JlH8k008628; Sun, 6 Aug 2006 15:47:17 -0400 Date: Sun, 6 Aug 2006
15:47:17 -0400 Message-Id: 
[EMAIL PROTECTED]

Thanks for any info!


[PHP] stupid question...compiling php

2006-08-07 Thread blackwater dev

Ok,

I am using a hosted server and php is installed from the linux distro.  I
usually have all the stuff in a php file somewhere so I can just go back
./configure, etc.  I can't seem to find the configure for php on this box so
I can recompile but I know it is there as I can use php and see the version,
how can I find the configure to use?

Thanks!


Re: [PHP] stupid question...compiling php

2006-08-07 Thread blackwater dev

Ok, doing that now and it's taking a while.  I can do phpinfo but that tells
me the config line and where the ini files are, not necessarily where the
configure stuff is to recompile...correct?

On 8/7/06, Jochem Maas [EMAIL PROTECTED] wrote:


blackwater dev wrote:
 Ok,

 I am using a hosted server and php is installed from the linux
distro.  I
 usually have all the stuff in a php file somewhere so I can just go back
 ./configure, etc.  I can't seem to find the configure for php on this
 box so
 I can recompile but I know it is there as I can use php and see the
 version,
 how can I find the configure to use?

php -l | grep configure

or

? phpinfo();


 Thanks!





[PHP] writing to fild on another server

2006-08-04 Thread blackwater dev

I have a web server and an images server.  My web server doesn't have
enought space for the images, hence the images server.  I have to download
properties from a realty database hourly and the data goes in to a db on my
webserver while the image needs to be taken from a MSSQL db and written to
the images server as an actual .jpg or .gif file.  Fopen, however, won't let
me write using the http protocol.  How can I open and write files between
servers?

Thanks!


[PHP] automated gui testing of php apps

2006-08-03 Thread blackwater dev

What do you all recommend for testing the gui side of your php
applications?  I've played with badboy a bit but we all run linux here at
work and I was looking for something more robust and would live to find a
free/inexpensive tool.  I've also tried SimpleTest for the ui side but it
seemed to be cumbersome to use for ui stuff.

Thanks!


[PHP] order of include on include()

2006-06-14 Thread blackwater dev

If I have a file:

/code/folder1/test.php

and in that file, it has these includes:

include_once(../../file1.php);
include_once(../../file2.php);
include_once(../../file3.php);


I then have another file:

/code/test2.php

That file pulls in test.php.

include_once(folder1/test.php);

Why do I get errors on the includes?  Does php first pull in the includes of
test.php before pulling it into test2.php?  It seems to be looking for the
includes in test.php from where I am in test2.php and is failing.

Thanks!


[PHP] checking if any values in one array are in another

2006-06-12 Thread blackwater dev

Is there a single php function that will tell me if any values in one array
are in another without looping through one of the arrays and doing in_array?

Thanks!


[PHP] php stopped sending mail

2006-06-12 Thread blackwater dev

Hello,

I have some code which uses mail() and a day or so ago, the server stopped
sending mail.   The code is the same and I checked that sendmail is
running.  I also checked maillog which showed the messaged as qued but they
never come through in email.  How can I debug this and what might have
caused the problem??

Thanks!


Re: [PHP] sending mail via php and unix box-clients thinks it's spam

2006-06-10 Thread blackwater dev

Here is what I use as the header:

   $header=From:[EMAIL PROTECTED]: text/html;

Thanks!

On 5/31/06, Richard Lynch [EMAIL PROTECTED] wrote:


On Tue, May 30, 2006 12:45 pm, blackwater dev wrote:
 I have a site running on a linux box.  If I use my mail server via an
 email
 client, the email works fine but if I send email through the mail
 function,
 clients mark it as spam.  I see the line in php.ini for SMTP but that
 says
 windows only.  How do I tell php to use my mail server?

While it is possible that the IP has been logged as a spammer, it's
more likely that the email headers are tripping you up...

Compare the two sets of email headers and see what you get, and also
look at the information provided by the spam filters about WHY they
think it's spam.

--
Like Music?
http://l-i-e.com/artists.htm





[PHP] sending mail via php and unix box-clients thinks it's spam

2006-05-30 Thread blackwater dev

I have a site running on a linux box.  If I use my mail server via an email
client, the email works fine but if I send email through the mail function,
clients mark it as spam.  I see the line in php.ini for SMTP but that says
windows only.  How do I tell php to use my mail server?

Thanks!


[PHP] getting $_GET params from iFrame window to parent

2006-05-10 Thread blackwater dev

Hello all,

I have a small site which provides search functionalities.  My search sites
are framed in my clients sites via iframe.  I have a client who would like
to put the search form somewhere else on their site (it is currenly all on
my page within the iframe) and then call their search page to do the search,
so in essence I need a way to grab the $_REQUEST params from the calling
site if they exist...is this possible?


main site url=mainsite.com?param1=helloparam2=there
**How do I see these params from within the iFrame?

iFrame mysite url=mysite.com?param2=goodparam3=bye
I, of course, can see these params fine as this is my site
/main

Thanks!


[PHP] cookie style saving without cookies

2006-05-09 Thread blackwater dev

I have a realty site where people want to be able to save properties but
don't want to enter a username/password, etc.  My first thought is just to
save the info to a cookie but am not sure if this is the best way.  If
cookies aren't allowed, they will loose this functionality.  I had thought
about grabbing their ip and just writing it to the db but the ip isn't
necessarily static.  Is there a better way to do this?

Thanks!


Re: [PHP] php script fails when run from cron

2006-05-04 Thread blackwater dev

I finally got it working and Chris was correct.  It appears that cron was
using the wrong php.  Pumping the errors of even logging them wouldn't have
helped as I was tweaking the ini for the php I thought it was using.  When I
explicitly tell it which one to use, it seems to work fine.

Thanks!

On 5/4/06, Jay Blanchard [EMAIL PROTECTED] wrote:


[snip]
The code then goes on to move some data from a remote SQL Server db to
the
local mysql.  When finished, the log stops at got two classes.  I am
trying to debug now to see which of the two classes it seems to be
failing
on.  I don't have anything in the php error log.  The MSSQL connection
uses
freetds so I am not sure if it is something there but again this script
runs
fine with just php myfile.php.
[/snip]

Are you logging errors? If so you will likely locate the cause there. If
I were to hazard a guess at would be because include files are not
getting included as I have seen that behavior before.



[PHP] mod_rewrite help

2006-05-03 Thread blackwater dev

Hello all,

I am trying to create a simply rule so that when someone goes to:

mysite.com/users/1

They are redirected to:

mysite.com/users/index.php?uid=1

But am a bit lost looking through all the docs.  I know people do this all
the time so am looking for some help.

Thanks!


[PHP] php script fails when run from cron

2006-05-03 Thread blackwater dev

I have a script which runs fine from the command line but when I try to run
it via cron, it seems to fail when the db class is instatiated, here is some
code:

$yesterday  = date(Y-m-d,mktime(0, 0, 0, date(m)  , date(d)-1,
date(Y)));
$file=fopen(/usr/local/apache2/htdocs/core/logs/import.log,a);
fwrite($file,-DATE:.date(Y-m-d).-\n);
fwrite($file,Starting:.date(H:i:s).\n);
include(/usr/local/apache2/htdocs/includes/lib/ms_db.class.php);
include(/usr/local/apache2/htdocs/includes/lib/database.php);
fwrite($file,got two classes:.date(H:i:s).\n);
 $ms_sql= new ms_db();
 $my_sql=new Database();

fwrite($file,got 1:.date(H:i:s).\n);


The code then goes on to move some data from a remote SQL Server db to the
local mysql.  When finished, the log stops at got two classes.  I am
trying to debug now to see which of the two classes it seems to be failing
on.  I don't have anything in the php error log.  The MSSQL connection uses
freetds so I am not sure if it is something there but again this script runs
fine with just php myfile.php.

Any ideas?

Thanks!


[PHP] a better way to transfer data?

2006-04-11 Thread blackwater dev
Hello all,

I am currently running freetds on a linux box that needs to move data from a
remote mssql db to the local mysql db.  I wanted to use bcp but freetds
couldn't as the data I am moving contains a blob field.  I am currently
using php to select all the rows from the mssql db, and then looping through
the results and putting them into the local mysql db but this is horribly
slow and there has to be a better way.

How can I do this more efficiently?

Thanks!


[PHP] pulling in template file in var and populating vars?

2006-03-22 Thread blackwater dev
I have a chunk of html data that I want to output for each iteration through
a db result

while($result){

   $list.=file_get_contents(my_template_file.php);

}
return $list;

The template file looks like this:

table
tr
 td?php echo $result[name];?/td
/tr
/table

I basically want a good way to keep the template file out of the class so I
don't have to code:
 $list.=tabletr...etc

The problem is with the method I have, it doesn't translate the
vars...what's the best way to do this?

Thanks!


[PHP] adding code and beginning and end without includes

2006-03-16 Thread blackwater dev
Is there a way to intercept and add code at the beginning and end of every
http request - WITHOUT having to put an include at the top and bottom of
every page?

This is something we need to be app specific so don't really want to do it
globally like chanse the php.ini or something.

Thanks!


[PHP] dumping array to file

2006-03-15 Thread blackwater dev
I am doing a select from a mssql db and will then pump it into a mysql db.
What is the easiest way to take the result array from the mssql db and dump
it to a file that I can just pull into MySQL short of writing out to the
file row by row.

Thanks.


[PHP] moving data from mssql to mysql on linux

2006-03-14 Thread blackwater dev
I have a project where I need to connect to a remote SQL Server and move
data from their to my localy MySQL server.  On the remote SQL Server, I only
have access to a few views but need to get their data and move it to my
local MySQL db.  What is the best way to do this?  I have freetds compiled
and configured for php on my server and currently connect to the SQL Server,
do my query and then loop through the result inserting into MySQL a row at a
time but this just takes to longis there a better way?

Thanks!


[PHP] installing freetds

2006-02-26 Thread blackwater dev
I am a linux newbie but just compiled freetds on my fedora box.  I used the
basic options:

./configure
make
make install
make clean

According to the docs it should install to /usr/local/freetds

After all this I don't have a freetds folder in /local/.  If I go into
/usr/local/bin, I do have a tsql which I believe are part of freetds so I
think it installed.  Where do I set the directory when I recompile php
--with-mssql?

Thanks!


[PHP] recompiling php

2006-02-26 Thread blackwater dev
I am trying to recompile php 5 with freetds so am using this :

./configure '--with-apxs2=/usr/local/apache2/bin/apxs'
'--with-mysql=/root/mysql-standard-4.1.9-pc-linux-gnu-i686'
'--with-mssql=/usr/local/freetds'

Things seem ok so I do make and at the end of make I get this error:

/usr/bin/ld:ext/mssql/php_mssql.lo: file format not recognized; treating as
linker script
/usr/bin/ld:ext/mssql/php_mssql.lo:2: syntax error
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1

I then did make install and of course got the same error:

/usr/bin/ld:ext/mssql/php_mssql.lo: file format not recognized; treating as
linker script
/usr/bin/ld:ext/mssql/php_mssql.lo:2: syntax error
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1


I then do make clean.  Of course, it doesn't seem to regenerate the
libphp5.so so once I restart apache, and check out phpinfo, it shows the old
configuration.

What's wrong?

Thanks!


[PHP] php+ ajax

2006-02-20 Thread blackwater dev
Hello,

I am trying to do a pre-search to let the users know how many rows
will be returned before they actually hit submit.  I think this is
more of a js question but :

I have this js function:

function preSearch() {
//Put the form data into a variable
var min_price= document.getElementById('min_price').value  ;
var max_price= document.getElementById('max_price').value  ;
document.getElementById('prop_num').innerHTML = Searching...;

   var url = 'ajax.php?min_price=' + min_price +'max_price=' + max_price;
xmlhttp.open('GET',   url, true);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4  xmlhttp.status == 200) {
 document.getElementById('prop_num').innerHTML ='TotalRecords:
' + xmlhttp.responseText + ' ';
} else {
//If the PHP script fails to send a
response, or sends back an error, display a simple user-friendly
notification
   
document.getElementById('prop_num').innerHTML = '';
}
};
xmlhttp.send(null);
   // }
}

And have this for inputs:

input name=min_price id=min_price etc.

I would really like to have all of my inputs has part of an arry so:

input name=search[min_price] id=search[min_price] etc

The problem is js seems to get confused trying to look this up by id
and I don't think I can use an array like this with a GET, how can I
use arrays for all this??

Thanks!

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



[PHP] how to learn php

2006-02-10 Thread /dev/null

hello

i have been trying to learn php.

what is the best approach to learning php for someone who has no 
programming experience?


i am very familiar with html, xhtml, and css. i'm not an idiot when it 
comes to using computers.
i have bought several books and have subscribed to a couple of the php 
mailing lists, but i feel that i could be doing more to learn php.


what approach (and steps) did you take in learning this really cool 
scripting language? should i look into taking classes or stick with an 
autodidact approach?


any advice and/or opinions would be greatly appreciated.

thanks.

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



[PHP] Ajax+ PHP Map

2006-02-02 Thread blackwater dev
I have a client who wants to add some searching capabilities to their
site. We want the searches to be cool so need to somehow provide a map
of the state broken down by counties and allow people to search for
items within that certain county. I wanted to do something cool with
Ajax and PHP but really don't know where to start. I have looked at
Yahoo and Google maps but I don't need to map to the street level,
just a county breakdown...does anyone know of an app that could create
a map for me? Do I need to start from scratch and get out photoshop or
fireworks and actually try to draw a map? Does anyone know of anything
like this online?

Thanks!

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



[PHP] zde users...help

2006-01-16 Thread blackwater dev
I am going to try to post this to Zend.com also, just am hoping I can
get a quicker response here.  I have Zend Studio 4 on my mac and just
installed a few updates from apple...quicktime, itunes, safari.  I
then rebooted and it asked to update my key chain like normal and now
when I try to open Studio, nothing happens...I tried to run the
zendide.jar but it just brings up the window loading screen and hangs,
clicking on the Studio icon to open does nothing...

Any ZDE experienced people have some ideas of how I can get it running again?

Thanks!

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



[PHP] ternary operator in heredoc string

2005-12-31 Thread dev lamp
Hi

I am trying to use the ternary operator inside heredoc string
to select the bgcolor based on the flag value, but it
does not seem to work.

$summary=STR
table width=100%
tr
td bgcolor={$reqstat ? green : red;}$reqno/td
/tr
/table
STR;

I looked up php documentation but could not find any details.

What would be an optimal way to write the code for the above situation ?

thanks
Dev.

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



Re: [PHP] unable to load perl extension

2005-12-31 Thread dev lamp
On 12/31/05, Richard Lynch [EMAIL PROTECTED] wrote:
 On Thu, December 29, 2005 9:17 am, dev lamp wrote:
  Scenario 2:
  the perl extension does not get loaded and the PHP script crashes.

 Define crashes...

 Does it literally crash the PHP/Apache process, or does it just print
 out Not loaded?


It just prints Not loaded.

 Either way, crank up your error settings to E_ALL and check your
 Apache error log to find out *WHY* it's not getting loaded.

 Could you live with:
 ?php
   exec(/usr/local/bin/perl script.pl, $output, $error);
   $output = implode(br /\n, $output);
   if ($error) die(OS Error: $errorbr /\n$output);
   echo $output; //probably do something more interesting here
 ?


Well, I would like to avoid this, since the PERL objects have to be used
and want to invoke methods.

thanks for your time.

thanks
Dev.

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



[PHP] how to call perl code from PHP

2005-12-29 Thread dev lamp
Hi

I am unable to call perl code from PHP, since the extension does not
get loaded !

Scenario 1:
use dl('perl.so'); in the php code and invoke the script from the command line
The script works fine and the perl code gets executed as well.

Scenario 2:
the perl extension does not get loaded and the PHP script crashes.

I have read the article
http://www.zend.com/php5/articles/php5-perl.php

If anybody has faced this issue, please share how you solved the problem ?

Thanks in advance.

Here are the environment Details:
RHEL 4.0
PHP 5.0.5 (self compiled)
PECL/PERL package checked out from CVS

PHP 5.0.5 compilation details
---
./configure  --with-apxs2=/usr/local/apache2/bin/apxs 
--with-mysql=/usr/bin/mysql_config 
--with-mysqli=/usr/bin/mysql_config --with-openssl-dir=/usr/local/ssl
--with-libxml-dir=/usr/lib --enable-soap --enable-sockets
--enable-sqlite-utf8  --enable-wddx --with-gnu-ld  --with-gd
--with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/local/lib
--with-zlib-dir=/usr/local/lib --with-gd=/usr/local 
--enable-gd-native-ttf --enable-maintainer-zts  --with-pear
make
make install


pecl/perl package compilation details
-
export PHP_PREFIX=/usr/local
export PERL_PREFIX=/usr
echo $PHP_PREFIX
echo $PERL_PREFIX
$PHP_PREFIX/bin/phpize
./configure --with-perl=$PERL_PREFIX
--with-php-config=$PHP_PREFIX/bin/php-config
make
make install

entries in php.ini file
--

extension_dir = /usr/local/lib/php/extensions/no-debug-zts-20041030/
extension=perl.so


sample test code is as follows -
?php
if (!extension_loaded('perl'))
{
print perl extension not loaded;
exit;
}
?

--
Dev.

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



[PHP] unable to load perl extension

2005-12-29 Thread dev lamp
Hi

I am unable to call perl code from PHP, since the extension does not
get loaded !

Scenario 1:
use dl('perl.so'); in the php code and invoke the script from the command line
The script works fine and the perl code gets executed as well.

Scenario 2:
the perl extension does not get loaded and the PHP script crashes.

I have read the article
http://www.zend.com/php5/articles/php5-perl.php

If anybody has faced this issue, please share how you solved the problem ?

Thanks in advance.

Here are the environment Details:
RHEL 4.0
PHP 5.0.5 (self compiled)
PECL/PERL package checked out from CVS

PHP 5.0.5 compilation details
---
./configure  --with-apxs2=/usr/local/apache2/bin/apxs
--with-mysql=/usr/bin/mysql_config
--with-mysqli=/usr/bin/mysql_config --with-openssl-dir=/usr/local/ssl
--with-libxml-dir=/usr/lib --enable-soap --enable-sockets
--enable-sqlite-utf8  --enable-wddx --with-gnu-ld  --with-gd
--with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/local/lib
--with-zlib-dir=/usr/local/lib --with-gd=/usr/local
--enable-gd-native-ttf --enable-maintainer-zts  --with-pear
make
make install


pecl/perl package compilation details
-
export PHP_PREFIX=/usr/local
export PERL_PREFIX=/usr
echo $PHP_PREFIX
echo $PERL_PREFIX
$PHP_PREFIX/bin/phpize
./configure --with-perl=$PERL_PREFIX
--with-php-config=$PHP_PREFIX/bin/php-config
make
make install

entries in php.ini file
--

extension_dir = /usr/local/lib/php/extensions/no-debug-zts-20041030/
extension=perl.so


sample test code is as follows -
?php
if (!extension_loaded('perl'))
{
   print perl extension not loaded;
   exit;
}
?

--
Dev.

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



Re: [PHP] unable to load perl extension

2005-12-29 Thread dev lamp
On 12/29/05, Jochem Maas [EMAIL PROTECTED] wrote:
 dev lamp wrote:
  Hi
 
  I am unable to call perl code from PHP, since the extension does not
  get loaded !
 
  Scenario 1:
  use dl('perl.so'); in the php code and invoke the script from the command 
  line
  The script works fine and the perl code gets executed as well.

 so the extension is not being loaded automatically right?
 but if you dl() it everything is fine, right?
 then double check the 'right' ini file is being used!


There is only one php.ini
I have checked the extensions path information using phpinfo().

Is there something else that I need to checkout ?

 

 is the apache module using the php.ini that you think it is ?? -
 that kind of thing has caught me out more than once!

 

How do I check that ?
I downloaded apache sources and compiled it.
Why do I need to specify the path of the php.ini file to the apache web server ?


Dev.

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



[PHP] checkboxes

2005-11-29 Thread blackwater dev
I have a form where I am dynamically building a bunch of checkbox
inputs.  Then when submitted, I need to update the db.  Problem is, of
course, if the checkbox is unchecked then the $_POST doesn't have the
value in the array.  How can I get the value from $_POST even though
it's unchecked?

For example, here would be the generated form:

input type=checkbox name=cars[2] value=1Car 1
input type=checkbox name=cars[3] value=1Car 2
input type=checkbox name=cars[4] value=1Car 3
input type=checkbox name=cars[5] value=1Car 4

Then in the update I loop through:

foreach($_POST[cars] as $id=$value){
//update vehicles set value to yes or no

}

But, if the unchecked values aren't in $_POST, how do I know to update them???

Thanks!

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



[PHP] array woes

2005-11-25 Thread blackwater dev
Hello all,

I have some array code driving me nuts.

I am pulling from a db:

select id, vehicle, has_quotes from cars where active=1

I then loop through these and build an array that contains the id's and cars.

while($res){

$cars[$res[id]]=$res[vehicle];
//here is the problem, when has_quotes is 1, I call another function
to grab the quotes
   if ($res[has_quotes]1){
$cars[$res[id]]=grabQuotes($res[id]);
   }

}

The grabQuotes function returns an array and works fine.  THe problem
is when I go to display these, I cycle through the car array printing
id and vehicle name.  I do a check so if vehicle name is an array, I
print out the quotes from the inner array, problem is I have lost the
vehicle name!  How can I fix this?

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



[PHP] recursive queries-tree view implementation

2005-11-18 Thread blackwater dev
I am sure others have encountered this so I am just looking for ideas.

Say I have an ancestry application where the users can enter parents,
children, etc.  The children have children, etc.

table people
  id
  parent_id

what is the best way to pull this from the db minimizing the number of
queries to build a tree view of parents to children?

Thanks!

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



[PHP] checkng if string is a number

2005-11-17 Thread blackwater dev
How can I check to see if a string var holds a number?  Is regex the
only way to do this?  For example I have code where the var could hold
10 or ten.  If the string is a number, do one thing, if it isn't
do something else. is_int doesn't work, intval converts ten to a
number so that doesn't work

Thanks!

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



  1   2   >