Re: [PHP] Sorry bout that...

2012-12-21 Thread Fatih P.
yah. we were just talking about that here too.

On Fri, Dec 21, 2012 at 8:22 AM, Steven Staples sstap...@mnsi.net wrote:

 I would like to let everyone know that the world didn't end this morning
 like it was supposed too.



 Sorry, carry on about your business.



 And HAPPY FRIDAY!!!



 Steven Staples




Re: [PHP] PDO question

2012-11-28 Thread Fatih P.
On Wed, Nov 28, 2012 at 9:22 PM, Jim Lucas li...@cmsws.com wrote:

 On 11/28/2012 12:58 PM, ad...@buskirkgraphics.com wrote:


 Guys,
 I am not quiet sure what is happening but every time i try to connect to a
 remote host it refers back to localhost.

 $pdo = new PDO('mysql:host=171.16.23.44;**dbname=test',
 'user','password');

 ERROR: Access denied for user 'user'@'localhost' (using password: YES) in
 /var/www/html/text.php

 Any clue as to WHY it keeps referring back to localhost when i clearly
 set the
 host parameter to another server.
 I checked the /etc/hosts records to see if there was a referral for that
 domain
 back to it's self there is NOT.


 There is a warning on the following page that talks about a possible issue
 with connections.  Might give it a look.

 http://www.php.net/manual/en/**ref.pdo-mysql.connection.phphttp://www.php.net/manual/en/ref.pdo-mysql.connection.php

 --
 Jim Lucas

 http://www.cmsws.com/
 http://www.cmsws.com/examples/


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




specify a user from your IP ( not the server IP: 171.16.23.44 ) and try
again.. If u dont have static IP,  set host parameter for user: % means any
host. and connect.


Re: [PHP] Mime Mail problem

2012-03-28 Thread Fatih P.
On Wed, Mar 28, 2012 at 9:26 PM, Alexis phplis...@antonakis.co.uk wrote:

 I am hitting my head over a problem with Mime Mail...which i am hoping
 some kind some can help me out on please

 The email is sent out fine and when viewing the source, appears to be
 fine, however neither the body of the email, nor the attachment are showing
 up when I view or open the email.


 I have checked the headers of the email which I have copied below, and I
 cannot see a problem with them, perhaps someone else can please.

 MTIA
 Alexis

 ---Headers---

 MIME-Version: 1.0
 Content-Type: multipart/mixed;
boundary=**a528ff729471083523feb6e73a0b9f**f7

 This is a multi-part message in MIME format.

 --**a528ff729471083523feb6e73a0b9f**f7
 Content-Type: text/plain;
charset=iso-8859-1
 Content-Transfer-Encoding: 7bit

 Daily Backups

 --**a528ff729471083523feb6e73a0b9f**f7
 Content-Type: text/plain;
name=Backup_LEPA_2012-03-25.**txt
 Content-Transfer-Encoding: base64
 Content-Disposition: attachment;
filename=Backup_LEPA_2012-03-**25.txt

 IkRhdGUiLCJUaW1lIiwiRmx0Tm8iLC**JBbHRGbHRObyIsIlJvdXRlIiwiUmVn**
 IgoiMjAxMi0wMy0y
 ...middle deleted.
 LUlTTiIKIjIwMTItMDMtMjUiLCIyMz**o0MCIsIlVYMTI5OCIsIiIsIk9SWS1Q**
 TUkiLCJFQy1LWEQi
 Cg==

 --**a528ff729471083523feb6e73a0b9f**f7--



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


if none is showing up, make sure you do the boundary as it should be.
and append new lines where necessary. cannot tell you much by looking at
the source your
where it includes some parts deleted.


Re: [PHP] Mime Mail problem

2012-03-28 Thread Fatih P.
On Wed, Mar 28, 2012 at 11:44 PM, Alexis phplis...@antonakis.co.uk wrote:

 If I insert the full stop after the \n then the output stops just before
 the fullstop.

 Currently I have \r\n \r\n
 That is a space between the two sets of \r\n's.  I tried it without any
 spaces and still got the same result.

 Would it be better if I post the code that creates the headers?
 I avoided doing that first as I was wondering if I got the headers
 themselves correct?

 btw sorry for calling you Faith before, I misread your name, Fatih

 Alexis


I guess it is better to see your code. that creates the headers and body
parts too.


Re: [PHP] time/task reporting

2012-03-01 Thread Fatih P.
On Thu, Mar 1, 2012 at 10:43 AM, Robert Nilsson rob...@myself.com wrote:

 Hi,
  Ok, I admit -I'm lazy!
  Been asked to make a reporting tool, what and how many hours spent on
  Possible with a save option, to enable continuously adding during the
 week, before sending off by mail to manager and one self.

  Surely I'm not the first person looking at a similar tool, been searching
 a bit but not found example code to use for adjustment to suite my group
 needs.

  Anyone care to share or point me to a site where I can find this?

  Thanks


hey, there is something called project hamster for gnome. might give you an
idea:

http://live.gnome.org/ProjectHamster
http://projecthamster.wordpress.com/
https://launchpad.net/hamster-applet


Re: [PHP] Apache 2.4.1 and php?

2012-02-24 Thread Fatih P.
On Fri, Feb 24, 2012 at 3:58 AM, Daniel Fenn danielx...@gmail.com wrote:

 Hi,

 Just a quick question, will I be able to run Apache 2.4.1 and php
 5.3.10 together? Or will I need to wait for php to be updated? I'm
 setting this up on CentOs 6.2

 Regards,
 Daniel Fenn

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


you can run both. make sure you have proper configuration for each


Re: [PHP] Selecting checkboxes based on SQL query

2012-02-23 Thread Fatih P.
On Thu, Feb 23, 2012 at 8:49 PM, Rick Dwyer rpdw...@earthlink.net wrote:

 Hello all.

 I perform a SQL query like the following:

 $sql = 'select * from my_table where id=10

 It returns the the following array for 3 records:


 Array ( [0] = Array ( [cb] = 2 ) [1] = Array ( [cb] = 6 ) [2] = Array
 ( [cb] = 1 ) )

 The values of CB in the above array are the values of html checkboxes on a
 page.

 input type=checkbox name=cb[ ] value=1...
 input type=checkbox name=cb[ ] value=2...
 input type=checkbox name=cb[ ] value=3...
 input type=checkbox name=cb[ ] value=4... etc

 If the above array's cb value matches the value of a checkbox on the page,
 I need the default state of the checkbox to be checked so I know I'm
 going to have some ternary logic in each html checkbox.  But I don't know
 how to create a custom function from the above array to provide that logic.
  I've tried some tutorials, but with no success as the array I am receiving
 is not like those in the tutorials.

 Any help would be greatly appreciated.

 Thank you.


  --Rick



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


replace the name part as following

input type=checkbox name=cb[put_the_id_here] value=1.


when dumping into html from array


foreach ($sql_result as $value) {
   if ($value == $selected) {
   input type checkbox name=cb[$value['id']] value=$value['id']
checked=checked
   } else {
input type checkbox name=cb[$value['id']]   value=$value['id']
   }
}

hope this helps


Re: [PHP] Selecting checkboxes based on SQL query

2012-02-23 Thread Fatih P.
On Thu, Feb 23, 2012 at 9:30 PM, Rick Dwyer rpdw...@earthlink.net wrote:

 I should have been more explicit in my description...

 The SQL command that returns the array is not the same one that creates
 the checkboxes they are two different sql queries and I would prefer to
 keep them that way.

 I actually have it working for a form submit with a custom function I got
 off the web.  But the custom function relies on the array it's working on
 to look like this:

 [cb] = Array ( [0] = 1 [1] = 6 [2] = 2 [3] = 4 [4] = 3 )


 So, to use my existing function, how do I get the following array to look
 like the above one:


 Array ( [0] = Array ( [cb] = 2 ) [1] = Array ( [cb] = 6 ) [2] = Array
 ( [cb] = 1 ) )


  --Rick



 On Feb 23, 2012, at 2:08 PM, Fatih P. wrote:

  On Thu, Feb 23, 2012 at 8:49 PM, Rick Dwyer rpdw...@earthlink.net
 wrote:

  Hello all.

 I perform a SQL query like the following:

 $sql = 'select * from my_table where id=10

 It returns the the following array for 3 records:


 Array ( [0] = Array ( [cb] = 2 ) [1] = Array ( [cb] = 6 ) [2] =
 Array
 ( [cb] = 1 ) )

 The values of CB in the above array are the values of html checkboxes on
 a
 page.

 input type=checkbox name=cb[ ] value=1...
 input type=checkbox name=cb[ ] value=2...
 input type=checkbox name=cb[ ] value=3...
 input type=checkbox name=cb[ ] value=4... etc

 If the above array's cb value matches the value of a checkbox on the
 page,
 I need the default state of the checkbox to be checked so I know I'm
 going to have some ternary logic in each html checkbox.  But I don't know
 how to create a custom function from the above array to provide that
 logic.
 I've tried some tutorials, but with no success as the array I am
 receiving
 is not like those in the tutorials.

 Any help would be greatly appreciated.

 Thank you.


 --Rick



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


  replace the name part as following

 input type=checkbox name=cb[put_the_id_here] value=1.


 when dumping into html from array


 foreach ($sql_result as $value) {
  if ($value == $selected) {
  input type checkbox name=cb[$value['id']] value=$value['id']
 checked=checked
  } else {
   input type checkbox name=cb[$value['id']]   value=$value['id']
  }
 }

 hope this helps




read the manual!


Re: [PHP] Test

2012-02-20 Thread Fatih P.
On Mon, Feb 20, 2012 at 8:57 PM, Jay Blanchard 
jay.blanch...@sigmaphinothing.org wrote:

 Does this work?

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


it works


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
On Fri, Feb 17, 2012 at 1:26 PM, Negin Nickparsa nickpa...@gmail.comwrote:

 I have a Gams application
 http://interfaces.gams-software.com/doku.php?id=env%3aspawning_gams_from_php
 
  which I want to run it through php code after trying many things finally I
 found that for running in commmand line I should go to C:\Program
 Files\GAMS23.7 run a command in commandline for running the application as
 follows:

 gams.exe trnsport_php.gms

 the Gams wil be run successfully in commandline now I wanted to run it in
 php I added an alias with this path

 C:\Program Files\GAMS23.7

 and then I created my php file in there when I want to exacute it with this
 code in php:

 if(system('gams.exe trnsport_php.gms'))
 echo 'Not Error';
 else echo'Error';

 it shows me Error

 and again using this one:

 if(system('./gams.exe trnsport_php.gms'))
 echo 'Not Error';
 else echo'Error';

 has printed again Error

 I tried exec too but no result I don't know what is wrong here.

 I read the manual but I coudn't find what's wrong here

 echo system('dir')

 will show the files of   C:\Program Files\GAMS23.7


have you tried using shell_exec with full path rather than including its
executation path?

$out = shell_exec('/var/www/myapp/run arg1 arg2');


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
give the full path of trnsport_php.gms too.

shell_exec should be working fine on windows as well.


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
replace \ in path with /
then should work fine on windows too.


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
On Fri, Feb 17, 2012 at 2:19 PM, Stuart Dallas stu...@3ft9.com wrote:

 On 17 Feb 2012, at 12:12, Negin Nickparsa wrote:
  if (($out = system(' C:/Program Files/GAMS23.7/gams.exe C:/Program
  Files/GAMS23.7/trnsport_php.gms')) !== FALSE)
  {
  print('Not error!');
  printf('Output is %s', $out);
  }
  else
  {
  print('Error');
  }
  Fatih it shows again nothing why I should set the full path even when I
 run
  my file on the path I don't think so that it is needed I don't know how
 to
  work with these quotations was it right Duken?


 * Use back ticks to get the full output.
 * Use escapeshellcmd and escapeshellarg to ensure the command is built in
 a safe and valid way.
 * Redirect stderr to stdout using 21 so you see any error messages that
 are being generated.

 $cmd = escapeshellcmd('C:/Program Files/GAMS23.7/gams.exe').'
 '.escapeshellarg('C:/Program
 Files/GAMS23.7/trnsport_php.gms').' 21';
 $out = `$cmd`;
 var_dump($out);

 Try that, then you can build logic that checks the output for errors. You
 may also want to make sure that safe_mode is disabled, though I doubt
 that's the problem.

 -Stuart

 --
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/


it is espacing issue as Stuart stated.. try this one thats working for me
with spaces

//$out = shell_exec(\C:/Program Files/tws_date.exe\); tws_date is c
program prints date. nothing special
$out = shell_exec(\C:/Program Files/GAMS23.7/gams.exe\ \C:/Program
Files/GAMS23.7/trnsport_php.gms\);

if ($out) {
echo OK:  . $out;
} else {
echo ERROR;
}

var_dump($out);


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
ERRORNULL
maybe program Files which has space should have something like \ which I
don't know ha?
or because of Null It is correct?

means false.. it cannot find the path. you have problem with path.


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
On Fri, Feb 17, 2012 at 3:43 PM, Negin Nickparsa nickpa...@gmail.comwrote:

 Fatih C:\Program Files\GAMS23.7 this is where my Gams is.
 maybe the problem is with permissions
 what should I do for permissions?
 what shoud I do to write this path file:'(
 I need it!
 when echo system('dir')
 shows me files of C:\Program Files\GAMS23.7
 then it shoud run the command gams.exe transport.gms without giving
 pathfiles

 what's wrong here?
 what reason is here for setting path files?


 On Fri, Feb 17, 2012 at 5:06 PM, Fatih P. fatihpirist...@gmail.comwrote:

 ERRORNULL
 maybe program Files which has space should have something like \ which I
 don't know ha?
 or because of Null It is correct?

 means false.. it cannot find the path. you have problem with path.



for path:
$path = \C:/Program Files/GAMS23.7/gams.exe\;

qoute the paths using \ double quoutes outside. then pass them.


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
well then fix it. i m not using editor.


Re: [PHP] What's Your Favorite Design Pattern?

2012-02-07 Thread Fatih P.
mostly MVC, Singleton and Factory. depends on requirements.


Re: [PHP] Re: ArrayInterator always true

2012-01-28 Thread Fatih P.
2012/1/28 Mihai Anghel mihaigrim1...@gmail.com

If you enable notices you will see that PHP outputs this : Notice:
ArrayIterator::next(): Array was modified outside object and internal
position is no longer valid.This line seems to be the problem //Test
if next stream is an option for ( $iterator-next();
$iterator-valid(); $iterator-next() ) { . I think that maybe the
problem is that you are accessing the array in the second for, PHP
detects that when it gets to the first for and it doesn't know if the
array is still the same and starts over . Anyway, you are trying to
iterate over the array in a pretty strange way :) . My advice is to
use $arrayobject-count() to see how many elements you have and then
iterate with a for($i=0; $i  $arrayobject-count(); $i++) . Also, if
you accept only some options than just use getopt function.

On Sat, Jan 28, 2012 at 12:10 AM, TCP tgc...@gmail.com wrote:
 I've got a temporary fix but still the iterator always return true,
 still hope someone could help me out to point out the problem:)

 //parseOptions utilitiese by tgckpg
 function parseOptions ( $argStream, $handler ) {
//Chop first useless argument -- argv[0]
array_shift ( $argStream ) ;
//Initiate ArrayObject for iterator
$arrayobject = new ArrayObject ( $argStream ) ;
//Initiate iterator for iteration
$iterator = $arrayobject-getIterator();

//If options is set first
if( $iterator-valid()  preg_match ( '/^-\w$/',
$iterator-current() ) ) {
//iterate through whole argument stream
for (   ; $iterator-valid(); $iterator-next() ) {
//Check if reached next option
if( preg_match ( '/^-\w$/', $opts =
$iterator-current() ) ) {
//Get current options
$currOpt = $opts;
//echo $currOpt\n;
//Test if next stream is an option
for ( $iterator-next();
$iterator-valid(); $iterator-next() ) {
if ( preg_match ( '/^-\w$/', $opts
= $iterator-current() ) ) {
//echo $currOpt $opts\n;
$handler($currOpt);
$currOpt = $opts;
} else break;
//var_dump($iterator-valid());
}
}//End if
//echo $currOpt $opts\n;
$handler($currOpt, $opts);
//A temporary fix for infinite
loop--
if(!$iterator-valid())
break;
}// End for
//If option is not set first.
} else {
//Try other approach.
}// End if
 }

 On Tue, Jan 24, 2012 at 4:18 AM, TCP tgc...@gmail.com wrote:
 I'm trying to parse an $agrv array that contain options (without
 square brackets): [-a abc -b bbc bcc -d dbc -e -f]
 I use ArrayIterator to iterate through the line:
  - whenever it reach /-\w/, it read through the following qoutes
 until it reach another /-\w/.



 The problem is it seems the $iterator-valid() always return TRUE and
 cause infinte loop.


 function parseOptions ( $argStream, $handler ) {
//Chop first useless argument -- argv[0]
array_shift ( $argStream ) ;
//Initiate ArrayObject for iterator
$arrayobject = new ArrayObject ( $argStream ) ;
//Initiate iterator for iteration
$iterator = $arrayobject-getIterator();

//If options is set first
if( $iterator-valid()  preg_match ( '/^-\w$/',
$iterator-current() ) ) {
//iterate through whole argument stream
for (   ; $iterator-valid(); $iterator-next() ) {
//Check if reached next option
if( preg_match ( '/^-\w$/', $opts =
$iterator-current() ) ) {
//Get current options
$currOpt = $opts;
//echo $currOpt\n;
//Test if next stream is an option
for ($iterator-next();
$iterator-valid(); $iterator-next() ) {
if ( preg_match ( '/^-\w$/',
$opts = $iterator-current() ) ) {
//echo $currOpt $opts\n;
//$handler($currOpt,
$opts);
$currOpt = $opts;
}
var_dump($iterator-valid());
}
}//End if
//echo 

Re: [PHP] php sendmail_from

2012-01-09 Thread Fatih P
On Mon, 2012-01-09 at 13:53 -0500, alexus wrote:
 I need to change sendmail from field, I added following to my .htaccess:
 
 php_value sendmail_from 'x...@xxx.xxx'
 
 and tried to send out an email, but it still comes from apache@FQDN
 
 through phpinfo(); I see as local value my email address x...@xxx.xxx
 
 -- 
 http://alexus.org/
 



try this before sending mail:

$sender = 'some...@somewhere.com';

if (ini_get(sendmail_from) == null || ini_get(sendmail_from) == )
{
ini_set(sendmail_from, $sender);
}

it is working fine for me


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



Re: [PHP] Question about date calculations

2011-12-29 Thread Fatih P.
On Thu, Dec 29, 2011 at 11:40 PM, Frank Arensmeier farensme...@gmail.comwrote:

 29 dec 2011 kl. 22.22 skrev Eric Lommatsch:

  So far in looking at the functions that are available at
  http://www.php.net/manual/en/ref.datetime.php I have not been able to
 figure
  out how to do what I need to do.  Below is a snippet showing
 approximately
  what I am trying to do.

 On the same page you are referring, there are plenty of examples on how to
 calculate the difference between two dates. Choose one and see if it fits
 your bill. Or is there any particular reason why you're writing your own
 function?

 http://www.php.net/manual/en/ref.datetime.php#78981

 /frank


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


since you have everything in database tables why not to do this calculation
on database side which would be much appropriate place ?

/* columns
date_start = '2011-02-08';
date_end = ' 2011-03-04';
*/

select DATEDIFF(date_end, date_start);

http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_datediff


Re: [PHP] Question about date calculations

2011-12-29 Thread Fatih P.



On 12/30/2011 12:19 AM, ad...@buskirkgraphics.com wrote:

-Original Message-
From: Fatih P. [mailto:fatihpirist...@gmail.com]
Sent: Thursday, December 29, 2011 5:10 PM
To: Frank Arensmeier
Cc: Eric Lommatsch; php-general@lists.php.net
Subject: Re: [PHP] Question about date calculations

On Thu, Dec 29, 2011 at 11:40 PM, Frank Arensmeier
farensme...@gmail.comwrote:


29 dec 2011 kl. 22.22 skrev Eric Lommatsch:


So far in looking at the functions that are available at
http://www.php.net/manual/en/ref.datetime.php I have not been able

to

figure

out how to do what I need to do.  Below is a snippet showing

approximately

what I am trying to do.

On the same page you are referring, there are plenty of examples on

how to

calculate the difference between two dates. Choose one and see if it

fits

your bill. Or is there any particular reason why you're writing your

own

function?

http://www.php.net/manual/en/ref.datetime.php#78981

/frank


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



since you have everything in database tables why not to do this
calculation
on database side which would be much appropriate place ?

/* columns
date_start = '2011-02-08';
date_end = ' 2011-03-04';
*/

select DATEDIFF(date_end, date_start);

http://dev.mysql.com/doc/refman/5.5/en/date-and-time-
functions.html#function_datediff


I looked at this answer and see the date is from an array of a database and not 
2 fields with in the table.
While the DATEDIFF() is very useful in queries this will not help you unless 
both fields are in the table.

Try this example

$dteStartDate[$intCnt] = new DateTime($row[10]);
$dteEndDate[$intCnt] =new DateTime($row[11]);
$interval = $dteStartDate[$intCnt]-diff($dteEndDate[$intCnt]);
echo $interval-format('%R%a days');


well then look deeper in the question:

I have a page I am trying to create where I am comparing the values of two
MySQL date fields with the current date. One of the *MySQL Date fields 
*is a class start date,*the other* is the class end date.


all needs to do is modify his query.



Re: [PHP] Need Part-time Coder

2011-12-27 Thread Fatih P.
On Wed, Dec 28, 2011 at 12:54 AM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Tue, 2011-12-27 at 17:29 -0500, John R. Cornell II wrote:

  Email PHP sample for consideration


 ?php
 echo hello world;
 ?

 Reply to list with a few more details for a more detailed reply ;)


?php echo  ;) ; ?


Re: [PHP] Converting a Unicode code to related charachter

2011-12-18 Thread Fatih P.
there is iconv to do this. you should better check that.



On Sun, Dec 18, 2011 at 11:33 AM, Ali Asghar Toraby Parizy 
aliasghar.tor...@gmail.com wrote:

 Hi.
 As I was writing a php code last week, I struggled with a function that was
 supposed to convert Unicode code to a character. At last I wrote this
 function:

 function unicodeToChr($param) {

$a =json_decode('{t:'.$param.'}');

return $a-t;
 }


 In this function the $param should be something like '\u0627'. I want to
 know if it's acceptable to use this function? Does exist any better
 solution to do that?
 Thanks.



Re: [PHP] OOP problems

2011-12-15 Thread Fatih P.


On 12/15/2011 01:05 PM, Alex Pojarsky wrote:

I'm not sure I've understood you correctly, but you may try something
like the following primitive autoloader (I didn't debug it, it's just
an example):

class Base
{
 protected $_path = '';

 public function construct($base_path)
 {
 $this-_path = $base_path;
 }
 public function __get($name)
 {
 $requested_path = $this-_path . DIRECTORY_SEPARATOR . $name;
 if (is_dir($requested_path))
 {
 return new Base($requested_path);
 }
 else if (is_file($requested_path . '.php'))
 {
 include ($requested_path . '.php');
 $classname = ucfirst($name);
 return new $clasname();
 }
 }
}

// Assuming you have Mysql class in /home/user/project/classes/db/mysql.php
// you may try

$base = new Base(/home/user/project/classes/);
$base-db-mysql-someFunctionOfMysqlClass();

2011/12/15 Dominik Halvoníkdominik.halvo...@gmail.com:

Hello,

I would like to ask you for help. This days I am trying to build one of my
applications. But I have problem which stopped me. I have folder whit php
files like connect.php, delete.php etc. These files contains classes named
the same as files. So in file connect.php is class Connect. These files are
placed in folder named mysql and this folder is inside folder named db. In
folder db is a php file named mysql.php, in this file I include classes
from folder mysql, after include I declare class MySQL and in it I have
method __construct(). In this method I create dynamic objects from included
classes. And this is the problem that I can not solve, I have more then one
of this files(mysql.php[whit class MySQL], oracle.php[whit class Oracle]
etc.) and I need to include them to file called db.php that is in the main
folder of my app. In db.php is an class called db, how can I add classes
MySQL, Oracle etc. to class db? I try to use abstract class whit __set and
__get methods but I also need to include class db to main class
application. I am really sorry for my English, so please be indulgent. So I
need to connect classes like this:

application-db-mysql-connect, but I can not use extends because in php
you can have only one parent class. The reason why I am trying to do
something like this is because I want to call methods like this:
$test = new application();
$test-db-connect();

If it is mysql or othet database I set in config.php file.

I need to achieve this schema( -  is something like ../ it means that it is
one level up folder):

connec.php(class Connect MySql)-
select.php(class Select MySql) -
 -  mysql.php(class MySQL include all classes, Connect...)-
 -
... -
-  db.php(class db include all classes, MySQL, Oracle..)
connec.php(class Connect Oracle)-
select.php(class Select Oracle ) -
 -  oracle .php(class Oracle include all classes, Connect...)-
 -
... -

download.php(class Download)-
unzip.php(class Unzip) -
 -  files.php(class Files include all classes, Download...) -
file.php(class file include class Files)
 -
... -

hash.php(class Hash)-
capcha.php(class Capcha) -
 -  secure.php(class Secure include all classes, Hash...) -
security.php(class security include class Secure)
 -
... -
ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect.

And in the end, in the same folder as db.php and security.php I will have
file application.php which will contain class application and in its
__construct() method I will make link classes db, security, file ect. ect.
So I will just include file application.php make object from class
application and then just do $object-db-connect()(of course if it will by
MySql or other database will be stored in some config.php file).

Thanks,

Dominik

Why don't you modify include_path on initialization of 'Base' class?

would make things much simpler.

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



Re: [PHP] Syntax problem PDO and bindvalue

2011-12-12 Thread Fatih P.
On Mon, Dec 12, 2011 at 4:22 PM, FeIn aci...@gmail.com wrote:

 I don't think you're suppose to end your queries with a semicolon. Try:


you can end your queries with semicolon in prepared statements.

How can I see the prepared SQL statement before it is executed?
try-  var_dump ($statement);


Re: [PHP] Auto CRUD Generator

2011-11-26 Thread Fatih P.

On 11/26/2011 10:20 PM, Muhammad Hassan Samee wrote:

is there any class/script that can  automatically create a CRUD
[Create,Read,Update,Delete] grid table for any database table .?


Hi Hassan,

check my blog there are some functions I have been working on. it might 
give you some ideas.

http://blog.teknober.com/

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



Re: [PHP] newline and return issues in string

2011-10-11 Thread Fatih P.

On 10/11/2011 04:44 PM, Richard Quadling wrote:

On 11 October 2011 12:58,ad...@buskirkgraphics.com  wrote:

I have come across an issue with my string that I would like to find a
faster way to resolve.

It seems there are new lines and returns at different positions of the
string.



First I exploded on the new line explode(“\n”, $ string)

This gave me a nice array but when I try to implode I get the new lines
again.

There is not a consistent position and there seems to be some hidden returns
in the array as well.



Is there a way, or has someone written a filter that would allow me to
remove all the newlines and returns from the array or string.

Understand I have resolved this issue but I think I have to be going about
this the hard way because it is just too complex .



FYI

$filter = array(\r\n, \n, \r);

str_replace($filter,’’,$string) ß this is useless in this situation I have
tried and it does not change the string at all.

You don't want to remove them. You want to replace them with a constant.

$lines = explode(PHP_EOL, str_replace($filter, PHP_EOL, $string));

for example.







try to implement a string builder using array or arrayobject and on 
insert; filter / replace your text / characters using regex,



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



Re: [PHP] caching problem

2011-06-28 Thread Fatih P.
On Tue, Jun 28, 2011 at 5:12 PM, ad...@buskirkgraphics.com wrote:

 Faith,

 I actually did read from the beginning of the message.

 That does not make sense.
 PHP files are cached intentionally, the system does not Cache PHP on its
 own.
 Sounds to me like you have an issue re-declaring an object or calling the
 right script/path/class/method something.


 I have never heard of PHP being cached unless it was intentionally cached
 it. Thank god for security reason!
 HTML output?? Sure all the time helps the browser load the content faster.

 I have a real issue with who ever told you that PHP is being cached,
 because if that was the case there is SERIOUS security hole in your PHP.
 I am doubting that.

 I have cached PHP, it can be done.

 Are you using APC(Alternative PHP Cache)???

 I would not suggest it with complex scripting using classes and methods
 they are the whole reason NOT to cache.


 That’s just my opinion.

 Richard L. Buskirk


Well, seems you didn't read it carefully even to write my name correctly. if
this is an issue with PHP then it is an
issue with PHP. AsI said I am using pre-compiled binaries with default
settings. also mentioned no caching is
enabled to cache anything.  And NO i am not using APC either or something
else!!!


Re: [PHP] caching problem

2011-06-28 Thread Fatih P.
On Tue, Jun 28, 2011 at 5:30 PM, Stuart Dallas stu...@3ft9.com wrote:

 On Tue, Jun 28, 2011 at 4:23 PM, Fatih P. fatihpirist...@gmail.comwrote:

 On Tue, Jun 28, 2011 at 5:12 PM, ad...@buskirkgraphics.com wrote:

  Faith,
 
  I actually did read from the beginning of the message.
 
  That does not make sense.
  PHP files are cached intentionally, the system does not Cache PHP on its
  own.
  Sounds to me like you have an issue re-declaring an object or calling
 the
  right script/path/class/method something.
 
 
  I have never heard of PHP being cached unless it was intentionally
 cached
  it. Thank god for security reason!
  HTML output?? Sure all the time helps the browser load the content
 faster.
 
  I have a real issue with who ever told you that PHP is being cached,
  because if that was the case there is SERIOUS security hole in your PHP.
  I am doubting that.
 
  I have cached PHP, it can be done.
 
  Are you using APC(Alternative PHP Cache)???
 
  I would not suggest it with complex scripting using classes and methods
  they are the whole reason NOT to cache.
 
 
  That’s just my opinion.
 
  Richard L. Buskirk
 
 
 Well, seems you didn't read it carefully even to write my name correctly.
 if
 this is an issue with PHP then it is an
 issue with PHP. AsI said I am using pre-compiled binaries with default
 settings. also mentioned no caching is
 enabled to cache anything.  And NO i am not using APC either or something
 else!!!



 Fatih, please explain what you mean by the code files are being cached.
 and modifications in methods are skipped
 and not executed. How are you getting the modified files onto the server,
 and how are you running the scripts? Are you working directly on the server,
 or are you uploading the files to the server via FTP, SCP or some other
 mechanism?

 -Stuart

 --
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/


OK, this is a development machine, everything is running on it. nothing is
being uploaded  through ftp, scp or something else.
all kind of content caching is disabled.

and what I mean by the code files are being cached is: after the
modifications, i do get the result which was produced before modification.
which shows
that the file is not being interpreted by php. how i get to this point that
I see errors after restarting the machine which were not there during coding
or when
i dump an object it doesn't show up anything other than previous content.

to recover this situation,  either I have to restart httpd which sometimes
does work or when it gets more problematic,
i have to crush httpd / php on start. and only having this problem on
windows machines.

sounds funny to most of you but it is happening


Re: [PHP] caching problem

2011-06-28 Thread Fatih P.
On Tue, Jun 28, 2011 at 6:39 PM, ad...@buskirkgraphics.com wrote:

 Fatih,
I am sorry spell check auto corrected your name, I was not changing
 your name on purpose.
 It was not my intension to piss you off.

 I understand your frustration, trust me.
 I am running 5.3.6 on Windows Server 2008 R2 IIS, I am running massive
 class based methods in my own framework.
 I am trying to help you narrow down the issue. I never blame PHP first
 because in my trouble shooting steps, I never get to PHP before I find the
 issue.

 Segmentation Faults: that prevent the php script from completing locking up
 resources and causing a nightmare chain of events. It dumps the process at
 the fail point can look like it is a PHP thing but it is not. This can
 explain sometimes it works and sometimes it does not.

 This can be caused by a host of reasons:
 Buffer Overflow,
 Attempting to access memory the program does not own. (This also points to
 Storage Violations)
 Using uninitialized pointers,
 Dereferencing Null pointers

 Again suggestions please do not take offense.


 Richard L. Buskirk


already here to ask for suggestions not to take offense. Anyway, I will
re-check these points you have mentioned.

thanks.


[PHP] caching problem

2011-06-27 Thread Fatih P.
Hi guys,

the code files are being cached. and modifications in methods are skipped
and not executed. is there any parameter that i can pass it from ini file?
this has been so annoying for me. restarting apache, windows, etc does not
even help. im running apache 2.2.19, php ts 5.3.6 on windows 2003 r2
any ideas how to avoid this situation? thanks

Fatih


Re: [PHP] caching problem

2011-06-27 Thread Fatih P.
On Tue, Jun 28, 2011 at 7:40 AM, Nilesh Govindarajan
cont...@nileshgr.comwrote:

 On 06/28/2011 10:56 AM, Fatih P. wrote:
  Hi guys,
 
  the code files are being cached. and modifications in methods are skipped
  and not executed. is there any parameter that i can pass it from ini
 file?
  this has been so annoying for me. restarting apache, windows, etc does
 not
  even help. im running apache 2.2.19, php ts 5.3.6 on windows 2003 r2
  any ideas how to avoid this situation? thanks
 
  Fatih
 

 It seems you have a wrongly configured opcode cache runnning about which
 you're not aware of.

 --
 Regards,
 Nilesh Govindarajan
 @nileshgr on twitter/identica


basically using default configuration, have not changed anything except the
path for extensions in php.ini.
and there is nothing installed/configured to cache anything.


Re: [PHP] Re: Php filter validate url

2011-06-26 Thread Fatih P.
Guys, when you reply a mail, You should write your reply on the top of it,
not at the bottom of it.
makes it easier to follow.


On Sun, Jun 26, 2011 at 11:44 PM, Shawn McKenzie nos...@mckenzies.netwrote:

 On 06/26/2011 12:31 PM, Adam Tong wrote:
  Hi,
 
  I wanted tu use php filters for validation to avoid regular expresions.
  Is it possible that FILTER_VALIDATE_URL only checks if the string has
  http:// and do not check for the format domain.something?
  
  $url = 'http://wwwtestcom';
  $url = filter_var($url,FILTER_VALIDATE_URL);
  echo $url;
  -
 
  Or I am doing something wrong
 
  Thank you

 Unless I'm totally misunderstanding what you want (validate that a
 string starts with http://) try:

 if(strpos($url, 'http://') === 0) {
   //starts with http://
 } esle {
   // does not start with http://
 }

 --
 Thanks!
 -Shawn
 http://www.spidean.com

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




Re: [PHP] Re: Php filter validate url

2011-06-26 Thread Fatih P.
well, anyway ignore it then

On Sun, Jun 26, 2011 at 11:57 PM, Stuart Dallas stu...@3ft9.com wrote:


 On Sunday, 26 June 2011 at 22:50, Fatih P. wrote:
  Guys, when you reply a mail, You should write your reply on the top of
 it,
  not at the bottom of it.
  makes it easier to follow.
 This is a holy war, and not worth getting into again. The bottom line is
 that top posting breaks the rules, regardless of people's personal opinion
 of the merits of any particular posting style.

 http://php.net/reST/php-src/trunk_README.MAILINGLIST_RULES - item 3 near
 the bottom of the page.

 -Stuart

 --
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/



Re: [PHP] Re: Php filter validate url

2011-06-26 Thread Fatih P.
On Mon, Jun 27, 2011 at 1:15 AM, Richard Riley rile...@googlemail.comwrote:


 In mailing lists and usenet you should never top post. You integrate
 your reply or follow up.  This is well documented and makes sense in
 tech threads were context is everything.

 In adidition your content type in your post is incorrect.

 Your header contains

 Content-Type: multipart/alternative;
 boundary=00151747b53cf2927204a6a46ebb

 But its not multipart. This happens a lot in this group and I dont
 experience it elsewhere so I dont know if its a php programmer thing,
 an gmane artifact or something the mailing list does.



 Fatih P. fatihpirist...@gmail.com writes:



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



headers are set and sent by gmail itself

Content-Type: multipart/alternative;
boundary=00151747b53cf2927204a6a46ebb


Re: [PHP] Get all the keys from a hierarchical hash

2011-06-24 Thread Fatih P.
use recursive calls to fetch them all in one array and there will be memory
cost.
refer array_keys function: http://php.net/manual/en/function.array-keys.php

not sure but this should be working.

function *get_keys_recursive*($arr) {
while (list($k, $v) = each($arr)) {
   if (is_array($v) === true) {
 return array_keys(array_merge($v,* get_array_keys*($v)));
   } else {
 return array_keys($k);
   }
   }
}



On Thu, Jun 23, 2011 at 11:17 PM, Scott Baker bak...@canbytel.com wrote:

 I have a multi-tier hash (see below) and I'd like to be search the
 hash for a given $id, and return that section, regardless of how many
 layers deep it is. Sort of like how xpath works?

 Once I have that I'd like get ALL the children of a given node. So I
 could ask for 86, and get 36, 38, 56, etc and all THEIR children.
 Basically I want *all* the ID #s that are children.

 Array
 (
[88] = Array
(
[109] =
)

[86] = Array
(
[36] = Array
(
[8] =
[121] =
[127] =
[135] =
[144] =
[161] =
[165] =
)

[38] = Array
(
[18] =
[39] =
[156] =
[158] =
[182] =
)

[56] =
[97] =
[107] = Array
(
[240] =
)

[115] =
[123] =
[146] =
[149] =
[223] =
)

[157] = Array
(
[3] = Array
(
[5] = Array
(
[11] =
)

[13] = Array
(
[6] =
[7] =
[98] = Array
(
[81] =
)

)

[111] = Array
(
[10] =
[17] =
[110] =
)

)

[148] = Array
(
[9] =
[87] =
[102] =
[104] =
[114] =
[130] =
[133] =
[160] =
[201] =
[237] =
[238] =
)

)

 )

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




Re: [PHP] URL Rewriting

2011-06-22 Thread Fatih P.
try

RewriteEngine on
RewriteRule ^theme([0-9]+).php$  /index.php?theme=$1 [L]






On Wed, Jun 22, 2011 at 11:22 PM, Silvio Siefke li...@silvio-siefke.dewrote:

 Hello,

 is there a chance with php to use rewriting?

 Like Example:

 mysite.com/theme.php?id=1 to theme.php theme2.php etc.

 I have ask on the nginx list, but there they say i should use the power
 language php.

 When i search in google for Examples or Tutorials i only found
 mod_rewriting.


 Has someone a Link with Tutorials or other Information?

 Thank you.

 Nice Day.

 Silvio

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




[PHP] php 5.3.6

2011-06-20 Thread Fatih P.
Hi Guys,

installed php 5.3.6 TS VC9 and apache 2.2.19 OpenSSL 1.0 compiled with VC9
on windows 2003 R2 but now having strange problem that post variables are
not parsed.

i have tried file_gets_contents(php://input); this problems is there
especially when i post strings starting with capital letters containing
!@#$%^*

nothing logged that i can see as exception.

any ideas ?

Fatih


Re: [PHP] php 5.3.6

2011-06-20 Thread Fatih P.
P variable is there, i checked all the possible things that came to me. but
still nothing

the config file was used in 5.3.3 in production just applied changes for
5.3.6

variables_order = GPCS
request_order = GP
register_globals = Off ; tried with On nothing changed
post_max_size = 8M





On Mon, Jun 20, 2011 at 9:15 PM, Daniel Brown danbr...@php.net wrote:

 On Mon, Jun 20, 2011 at 15:09, Fatih P. fatihpirist...@gmail.com wrote:
  Hi Guys,
 
  installed php 5.3.6 TS VC9 and apache 2.2.19 OpenSSL 1.0 compiled with
 VC9
  on windows 2003 R2 but now having strange problem that post variables are
  not parsed.
 
  i have tried file_gets_contents(php://input); this problems is there
  especially when i post strings starting with capital letters containing
  !@#$%^*
 
  nothing logged that i can see as exception.
 
  any ideas ?

 Are you missing a P in variables_order in your php.ini?  For
 production systems, you'll probably want:

variables_order = GPCS

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/



Re: [PHP] 【N級、 S級、AAA級 財布、バッグ!】【ブランド館】

2011-06-20 Thread Fatih P.
ban it :)

2011/6/21 ad...@buskirkgraphics.com

 I see that it is actually from rjck...@gmail.com
 I am not bilingual in Japanese but this is what I can make out it is an
 Advertisement.


 (A/the N class, S class, AAA class purse, bag!  ) (A/the brand mansion)
 Japanese highest level copy brand 激 cheap market ☆*.
 http://www.special-price.biz/ ☆*.
 Main operation merchandise: a/the bag, purse, wrist watch, belt, writer!

 A foreign country brand-name goods safe shopping bag and purse etc. be
 a/the
 good buy!
 (New work arrival) ● ● ● (an ultra popular pawnshop)   Most new work
 Vitton purse new article, new material arrival
 ① ★ GUCCI in 2011 new work bag voluminous arrival ultra popular ★
 ② ★ LOUIS VUITTON in 2011 new work bag voluminous arrival ultra popular ★
 3 ★ Louis 2011 Vuitton new large fiscal the Dutch! !  !
 (News) ★ ROLEX-ロレックス N class highest grade clock voluminous arrival
 ultra popular ★

 Manager: 'a brand 激 cheap market' Tsuchida Kenichi
 I request it very much.
 Friend who deals, for long sincere reception (^o^)
 ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡   The carriage free   ≡ ≡ ≡ ≡ ≡
 ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡







 Richard L. Buskirk

 -Original Message-
 From: Sharl.Jimh.Tsin [mailto:amoiz.sh...@gmail.com]
 Sent: Monday, June 20, 2011 11:28 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] 【N級、 S級、AAA級 財布、バッグ!】【ブランド館】

 ・EURー葦・ぢ年06月21日 11:21, ◆送料無料◆ブランド激安市場 wrote:
  【N級、 S級、AAA級 財布、バッグ!】【ブランド館】
 
  日本最大級コピーブランド激安市場 ☆*.http://www.special-price.biz/  ☆*.
  ■主要取扱商品: バッグ、財布、腕時計、ベルト、ライタ!
  ≡≡≡
  海外ブランド品安心ショッピング バッグや財布等がお買得!
 
  【新作入荷】●●●【超人気質屋】◆最新作 ヴィトン 財布新品、新素材入荷
 
  ① ★GUCCI 2011年新作バッグ大量入荷超人気 ★
  http://www.special-price.biz/
 
 
  ② ★LOUIS VUITTON 2011年新作バッグ大量入荷超人気 ★
  http://www.special-price.biz/
 
 
  ③ ★LOUIS VUITTON 2011年新作財布大量入荷 !!!
  http://www.special-price.biz/
 
 
  【News】★ROLEX -ロレックスN級最高等級時計大量入荷超人気 ★
  http://www.special-price.biz/
 
 
  ■宜しくお願い申し上げます。
  ≡≡≡
  ◆誠実な接待、長い間取引する友達(^o^)
 
  ■URL:http://www.special-price.biz/
  ■店長:『ブランド激安市場』 土田健一
 
  ≡◆送料無料◆
 Advertisement?!

 --
 Best regards,
 Sharl.Jimh.Tsin (From China *Obviously Taiwan INCLUDED*)

 Using Gmail? Please read this important notice:
 http://www.fsf.org/campaigns/jstrap/gmail?10073.



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