[PHP] date problem

2011-04-01 Thread Dan Dan
Hi Folks,

I am trying to get the day of month for a particular day of week (e.g.
Tuesday) for the first, second, third, fourth week in a month. The code i
have seems issues in March, but works e.g. in April:

print date("d-m-Y H:i:s",strtotime('1 March 2011 Tuesday'));
>> 01-03-2011 00:00:00

print date("d-m-Y H:i:s",strtotime('1 March 2011 first Tuesday'));
>> 08-03-2011 00:00:00

While in April, I have

print date("d-m-Y H:i:s",strtotime('1 April 2011 Tuesday'));
>> 05-04-2011 00:00:00

print date("d-m-Y H:i:s",strtotime('1 April 2011 first Tuesday'));
>> 05-04-2011 00:00:00

Could someone help whats wrong with the technique i am trying to find that
day of month. Is there any better way ?

Thanks
-dani


Re: [PHP] date problem

2011-04-01 Thread Dan Dan
I removed the day (1 before the March), but its still giving the same
result, i.e. different days of month with and without the 'first'. Any
further help ?

print "first Tuesday :".date("d-m-Y H:i:s",strtotime('March 2011
Tuesday'))."\n";
print "first: ".date("d-m-Y H:i:s",strtotime('March 2011 first
Tuesday'))."\n";
print "second: ".date("d-m-Y H:i:s",strtotime('March 2011 second
Tuesday'))."\n";
print "third: ".date("d-m-Y H:i:s",strtotime('March 2011 third
Tuesday'))."\n";
print "fourth: ".date("d-m-Y H:i:s",strtotime('March 2011 fourth
Tuesday'))."\n";

first Tuesday :01-03-2011 00:00:00
first: 08-03-2011 00:00:00
second: 15-03-2011 00:00:00
third: 22-03-2011 00:00:00
fourth: 29-03-2011 00:00:00

Thanks
-dani



On Fri, Apr 1, 2011 at 9:37 AM, Daniel Brown  wrote:

> On Fri, Apr 1, 2011 at 12:35, Dan Dan  wrote:
> > Hi Folks,
> >
> > I am trying to get the day of month for a particular day of week (e.g.
> > Tuesday) for the first, second, third, fourth week in a month. The code i
> > have seems issues in March, but works e.g. in April:
> >
> > print date("d-m-Y H:i:s",strtotime('1 March 2011 Tuesday'));
> >>> 01-03-2011 00:00:00
> >
> > print date("d-m-Y H:i:s",strtotime('1 March 2011 first Tuesday'));
> >>> 08-03-2011 00:00:00
> >
> > While in April, I have
> >
> > print date("d-m-Y H:i:s",strtotime('1 April 2011 Tuesday'));
> >>> 05-04-2011 00:00:00
> >
> > print date("d-m-Y H:i:s",strtotime('1 April 2011 first Tuesday'));
> >>> 05-04-2011 00:00:00
> >
> > Could someone help whats wrong with the technique i am trying to find
> that
> > day of month. Is there any better way ?
>
> Because you're combining the date with the day of the week.  It so
> happens that 1 March was a Tuesday, but today - 1 April - is a Friday.
>  Pick one or the other, not both.
>
> --
> 
> Network Infrastructure Manager
> http://www.php.net/
>


Re: [PHP] date problem

2011-04-02 Thread Dan Dan
It seems different php versions have different outputs for this code:

Fedora Core 14 (x86):

first: 01-03-2011 00:00:00
second: 08-03-2011 00:00:00
third: 22-03-2011 00:00:00
fourth: 22-03-2011 00:00:00
fifth: 29-03-2011 00:00:00

Fedora Core11 (x86_64):

first: 31-12-1969 16:00:00
second: 31-12-1969 16:00:00
third: 22-03-2011 00:00:00
fourth: 31-12-1969 16:00:00
fifth: 31-12-1969 16:00:00

However it works if reorder Year and Month like:

echo "first: ".date("d-m-Y H:i:s",strtotime('2011 March first
wednesday'))."\n";
echo "second: ".date("d-m-Y H:i:s",strtotime('2011 March second
wednesday'))."\n";
echo "third: ".date("d-m-Y H:i:s",strtotime('2011 March third
wednesday'))."\n";
echo "fourth: ".date("d-m-Y H:i:s",strtotime('2011 March fourth
wednesday'))."\n";
echo "fifth: ".date("d-m-Y H:i:s",strtotime('2011 March fifth
wednesday'))."\n";

first: 02-03-2011 00:00:00
second: 09-03-2011 00:00:00
third: 16-03-2011 00:00:00
fourth: 23-03-2011 00:00:00
fifth: 30-03-2011 00:00:00

Thanks
-dani


On Sat, Apr 2, 2011 at 1:17 AM, Louis Huppenbauer <
louis.huppenba...@gmail.com> wrote:

> Just try "of March". Worked for me.
>
>
> print "first: ".date("d-m-Y H:i:s",strtotime('first Tuesday of March
> 2011'))."\n";
> print "second: ".date("d-m-Y H:i:s",strtotime('second Tuesday of March
> 2011'))."\n";
> print "third: ".date("d-m-Y H:i:s",strtotime('third Tuesday of March
> 2011'))."\n";
> print "fourth: ".date("d-m-Y H:i:s",strtotime('fourth Tuesday of March
> 2011'))."\n";
> print "fifth: ".date("d-m-Y H:i:s",strtotime('fifth Tuesday of March
> 2011'))."\n";
>
>
> 2011/4/2 Dan Dan :
> > I removed the day (1 before the March), but its still giving the same
> > result, i.e. different days of month with and without the 'first'. Any
> > further help ?
> >
> > print "first Tuesday :".date("d-m-Y H:i:s",strtotime('March 2011
> > Tuesday'))."\n";
> > print "first: ".date("d-m-Y H:i:s",strtotime('March 2011 first
> > Tuesday'))."\n";
> > print "second: ".date("d-m-Y H:i:s",strtotime('March 2011 second
> > Tuesday'))."\n";
> > print "third: ".date("d-m-Y H:i:s",strtotime('March 2011 third
> > Tuesday'))."\n";
> > print "fourth: ".date("d-m-Y H:i:s",strtotime('March 2011 fourth
> > Tuesday'))."\n";
> >
> > first Tuesday :01-03-2011 00:00:00
> > first: 08-03-2011 00:00:00
> > second: 15-03-2011 00:00:00
> > third: 22-03-2011 00:00:00
> > fourth: 29-03-2011 00:00:00
> >
> > Thanks
> > -dani
> >
> >
> >
> > On Fri, Apr 1, 2011 at 9:37 AM, Daniel Brown  wrote:
> >
> >> On Fri, Apr 1, 2011 at 12:35, Dan Dan  wrote:
> >> > Hi Folks,
> >> >
> >> > I am trying to get the day of month for a particular day of week (e.g.
> >> > Tuesday) for the first, second, third, fourth week in a month. The
> code i
> >> > have seems issues in March, but works e.g. in April:
> >> >
> >> > print date("d-m-Y H:i:s",strtotime('1 March 2011 Tuesday'));
> >> >>> 01-03-2011 00:00:00
> >> >
> >> > print date("d-m-Y H:i:s",strtotime('1 March 2011 first Tuesday'));
> >> >>> 08-03-2011 00:00:00
> >> >
> >> > While in April, I have
> >> >
> >> > print date("d-m-Y H:i:s",strtotime('1 April 2011 Tuesday'));
> >> >>> 05-04-2011 00:00:00
> >> >
> >> > print date("d-m-Y H:i:s",strtotime('1 April 2011 first Tuesday'));
> >> >>> 05-04-2011 00:00:00
> >> >
> >> > Could someone help whats wrong with the technique i am trying to find
> >> that
> >> > day of month. Is there any better way ?
> >>
> >> Because you're combining the date with the day of the week.  It so
> >> happens that 1 March was a Tuesday, but today - 1 April - is a Friday.
> >>  Pick one or the other, not both.
> >>
> >> --
> >> 
> >> Network Infrastructure Manager
> >> http://www.php.net/
> >>
> >
>


[PHP] php.net links page question

2003-01-30 Thread dan
i would like to suggest a link for the php.net links page, how would i 
go about doing that?


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



[PHP] Re: redirecting a domain

2003-03-27 Thread Dan
On Fri, 14 Jul 2000 22:26:05 -0400, [EMAIL PROTECTED] (Unknown
Sender) wrote:

>I have an apache question and I have NO idea where to post it.  Is there
>a newsgroup or mailing list simply for apache?
>
>I have multipal domain names: domain.net & domain.org.  I would like to
>configure apache such that when someone goes to www.domain.org, they are
>"redirect" to www.domain.net.  They are both the exact same web site, I
>simply want the domain name to show up as www.domain.net.  Any thoughs
>on how to do that?
>
>Sam

The easiest way is to put this in you index.html file without the
comment markup of course.



Dan

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



[PHP] Re: Make thumbnail online

2003-03-27 Thread Dan
On Sun, 11 Jan 2004 16:32:36 +0330, [EMAIL PROTECTED] (Sadeq Naqashzade)
wrote:

>Hi every one,
>I want to create thumbnail of a photo stored in MySQL table online.
>
>Best Wishes,
>S. Naqashzade
>
>

http://www.php.net/manual/en/ref.image.php


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



[PHP] Re: Internet Explorer toolbar

2003-03-27 Thread Dan
On Thu, 27 Mar 2003 12:32:06 -0800 (PST), [EMAIL PROTECTED] (Manuel
Ochoa) wrote:

>Is there any way of using php to launch a new browser without the IE toolbars?

No. PHP is server side, not client side.


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



[PHP] Installing PHP

2002-10-03 Thread Dan

I am trying to create a message board. I setup a windows 2000 server and
installed IIS. In order to setup this messageboard i need to have PHP
installed. I downloaded the PHP installer and tried to run it but i get a
error message stating that there was a missing OCX component and it cant
configure the webserver. Does any know where i can get step by step
instructions in setting this up. The instructions that come from php.net are
too confusing.


THanks

Dan





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




[PHP] Arrays

2002-06-10 Thread Dan

I'm trying to get my head around arrays and how to munipulate them.

what I need to do is add html around the arrays eg.
".$name.";

I have my head around that but I the number of lines the I need to create is
going to change so I need the script to repeat untill all the arrays are
used.

--
-
Daniel Broome, siliconBLUE Ltd, Web Author,
http://siliconblue.com
Mob: 64-21-178-5120



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




[PHP] Re: Arrays

2002-06-10 Thread Dan

I have figured out how to do it thanks for you guys help..

Just one thing...

 'More Info'
, 'contact.php' => 'Contact Us'
, 'apage.php' => 'A Page'
);
foreach ($contact as $link => $name)
{
 echo "". $name ."";
}
?>

What I need to do now is in the echo string is make use something like:

 $echo = "". $name ."";

I have tryed doing it this way but it will only desplay one array when I
call $echo down the page.

What can I do to desplay all of them?


"Dan" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm trying to get my head around arrays and how to munipulate them.
>
> what I need to do is add html around the arrays eg.
> ".$name.";
>
> I have my head around that but I the number of lines the I need to create
is
> going to change so I need the script to repeat untill all the arrays are
> used.
>
> --
> -
> Daniel Broome, siliconBLUE Ltd, Web Author,
> http://siliconblue.com
> Mob: 64-21-178-5120
>
>



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




[PHP] How do I stop foreach if $menu not set??

2002-06-11 Thread Dan

I Have worked out this, but when $menu is not set it does the foreach
function anyway, and desplays an error.

What Can I do to stop the foreach function from working if $menu is not
set??

 'Overview',
'moreinfo.php' => 'More Info'
);
}

#These parts are topics and there may be more than two.

if ($menu==(support)) {$sub = array(
'sitemap.php' => 'Site Map',
'contact.php' => 'Contact Us'
);
}

foreach ($sub as $link => $name) (
 $sublink .= "".$name."";
?>
Introduction


Support



-
Daniel Broome, siliconBLUE Ltd, Web Author,
http://siliconblue.com
Mob: 64-21-178-5120



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




[PHP] contents from a database

2002-07-16 Thread Dan

I have a script that can desplay all the contents from a database but I need
the result to equil a variable, but when I do this it only desplays one line
from the database. I used to know this but I lost the info that I was given.

this is the script I am using..

$query = "SELECT * FROM content WHERE section='$section' ";
$result = mysql_query($query);

 while($res = mysql_fetch_array($result)) {
  $sub="".$res[art_
name]."
"; }

I know there is something I can add after $sub. Please can you tell me what
it is?
thanks heaps,
Dan



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




Re: [PHP] String Array Creation and assigment

2003-10-29 Thread Dan
please help with the following:

I tried this first :
$b[] = 'Book Worzel, Richard (1989). From Employee to Entrepreneur:  how to
turn your experience into a fortune.  Toronto:  Key Porter books.';
$b[] = 'Book Ries, Al and Jack Trout (1994). The 22 Immutable Laws of
Marketing.  New York:  Harper Business';
...

then tried this :
$b[0] = 'Book Worzel, Richard (1989). From Employee to Entrepreneur:  how to
turn your experience into a fortune.  Toronto:  Key Porter books.';
$b[1] = 'Book Ries, Al and Jack Trout (1994). The 22 Immutable Laws of
Marketing.  New York:  Harper Business';
...

none of the above work, what's right?

help will be appreciated.

Dan

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



Re: [PHP] String Array Creation and assigment

2003-11-03 Thread Dan
i found the problem myself, array has to be defined like this:

$b=array[0=>0];

then $b can be any array of any type of index and values as you wish to
"assign" to it.

"Dan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> please help with the following:
>
> I tried this first :
> $b[] = 'Book Worzel, Richard (1989). From Employee to Entrepreneur:  how
to
> turn your experience into a fortune.  Toronto:  Key Porter books.';
> $b[] = 'Book Ries, Al and Jack Trout (1994). The 22 Immutable Laws of
> Marketing.  New York:  Harper Business';
> ...
>
> then tried this :
> $b[0] = 'Book Worzel, Richard (1989). From Employee to Entrepreneur:  how
to
> turn your experience into a fortune.  Toronto:  Key Porter books.';
> $b[1] = 'Book Ries, Al and Jack Trout (1994). The 22 Immutable Laws of
> Marketing.  New York:  Harper Business';
> ...
>
> none of the above work, what's right?
>
> help will be appreciated.
>
> Dan

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



RE: [PHP] html or php to pdf whith pdflib?

2003-12-20 Thread dan
i use htmldoc, which converts html to pdf, saves trying to render lines
and borders in a pdflib how painful.

On Sat, 2003-12-20 at 10:20, Chris wrote:
> Hi Reicardo,
> This can't be done by using the pdf_* functions in php without reading the
> whole source file, parsing the HTML and then working the $x and $y for each
> line.
> 
> There are some alternatives. If you don't really care to much about
> formatting you could try this:
> 
> $pdf = pdf_new();
> 
> pdf_open_file($pdf);
> pdf_begin_page($pdf, 595, 842);
> $font = pdf_findfont($pdf, "Times-Roman", "winansi", 0);
> if ($font) {
>pdf_setfont($pdf, $font, 10);
> }else{
>  die("Font Error");
> }
> pdf_set_value($pdf, "textrendering", 1);
> PDF_show_wraped($pdf,strip_tags(implode("",file($filename))), 50,750,500);
> 
> pdf_end_page($pdf);
> pdf_close($pdf);   
> 
> $data = pdf_get_buffer($pdf);
> 
> header("Content-type: application/pdf");
> header("Content-disposition: inline; filename=test.pdf");
> header("Content-length: " . strlen($data));
> echo $data;
> 
> 
> 
> function PDF_show_wraped(&$pdf, $text, $left, $top, $width){
> $fontsize = pdf_get_value($pdf,'leading');
> $length = pdf_stringwidth($pdf,$text);
> $textHeight = ceil($length/$width)*$fontsize;
> $h_align='left';
> while(pdf_show_boxed($pdf,$text,
> $left,$top,$width,$textHeight,$h_align,'blind') > 1){
> $textHeight += $fontsize;
> }
> $top-=$textHeight;
> pdf_show_boxed($pdf,$text,$left,$top,$width,$textHeight,$h_align);
> return $top-$textHeight;
> }
> 
> Of course you would need to do something about page wrapping but that should
> be quite easy.
> 
> 
> Also you could exec() an external programme like txt2pdf
> (). I have seen a
> html2pdf as well but can't remember where right now.
> 
> 
> 
> Chris 
> 
> > -Original Message-
> > From: E. Ricardo Santos [mailto:[EMAIL PROTECTED] 
> > Sent: 20 December 2003 02:22
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] html or php to pdf whith pdflib?
> > 
> > Hello, somebody knows like turning a file HTML or php to pdf 
> > by means of pdflib but without having to write  line  to  line?
> > 
> > 
> > 
> > that is, a file already existing php or HTML, can be turned 
> > with pdflib?
> > 
> > 
> > 
> > This  I ask it because to where it studies pdflib, exit pdf 
> > is due to write line  by  line  and coordinate by coordinate. 
> > A pdf  already  created can also be mattered and to combine 
> > it with the new exit. But what  I did not find  he is all 
> > this is the particularitity that I raise.
> > 
> > 
> > 
> > I hope  has explained to me correctly
> > 
> > --
> > PHP General Mailing List (http://www.php.net/) To 
> > unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> > 

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



[PHP] lookin for a Menuing System...

2002-04-28 Thread Dan

I could do this myself but I don't want to waist time writing something that
I could have just asked for..

what I need is a menuing system..

When link is clicked the sub-topics appear under the topic you just clicked
on..

e.g. if you where to click on Contact.

Contact
--becomes:

Contact
   Enquires
   Account / Billing
   Media Enquiries

Much like this JavaScript one... except I need it in PHP...
http://www.dynamicdrive.com/dynamicindex1/navigate1.htm



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




[PHP] Re: lookin for a Menuing System...

2002-04-29 Thread Dan

The reason I wanted it in PHP not JavaScript's is because I wouldn't have to
worry about it being supported in other browsers... also the loading time is
already long enough I don't want people on slow connections to have to wait
for ages before they can go anywhere..

When a link on the menu is clicked the page refreshes to another page anyway
and desplays the sub-tpoic at the same time anyway.. Also with PHP if a user
clicks back on the browser window the script knows where is was.. or if
someone refreshes the page the script stays where it is...

Thanks
Dan.

"Dan" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I could do this myself but I don't want to waist time writing something
that
> I could have just asked for..
>
> what I need is a menuing system..
>
> When link is clicked the sub-topics appear under the topic you just
clicked
> on..
>
> e.g. if you where to click on Contact.
>
> Contact
> --becomes:
>
> Contact
>Enquires
>Account / Billing
>Media Enquiries
>
> Much like this JavaScript one... except I need it in PHP...
> http://www.dynamicdrive.com/dynamicindex1/navigate1.htm
>
>



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




[PHP] Can't AddType .htm

2002-04-03 Thread Dan

I run Linux, Apache and PHP4.06.
I want PHP to parse .htm documents.
I have done this before on other servers with no problem by editing the
following line in my httpd.conf.

AddType application/x-httpd-php .htm .php .php4 .php3

But after restarting it doesn't do anything.
.php files still work and .htm files don't work.
If I try other suffixes other than .htm say ".dog" for example that works.
So it seems something elsewhere is over riding it.
Anyone got any suggestions.

Regards

Dan




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




[PHP] Extract data

2001-12-04 Thread Dan

Hello guys

I'm making poll script that stores  data like this: 

0|0|0|0|0




But i'm getting this error all the time:
 
Warning: unexpected regex error (14) in c:\program files\apache 
group\apache\htdocs\eztatic\poll.php on line 25

25: list(q1,q2,q3,q4,q5)= split ("|", $answer, 5);


Could any help

Thank you very much in advance



-
Hot Mobiil - helinad, logod ja piltsõnumid!
http://www.hot.ee



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


[PHP] assignment operator works for comparison??

2001-04-10 Thread Dan

This confused me for awhile, because the single equal sign seemed to work
for comparison, but created inexplicable errors in my programs.  It seems
strange to me that a successful variable value assignment does not return
true.

example:



--Dan



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




Re: [PHP] assignment operator works for comparison??

2001-04-10 Thread Dan


>
>  > if($shiny = 0){
> This does not compare anyting, it assigns 0 to $shiny

yes i know, but shouldnt this operation return true?

>
>  > echo( $shiny ) // this will return 0
> That's normal, you just assign 0 to it ;)
>
> = assignment operator
> == comparison operator
>
> py
>
>
> At 01:53 PM 4/10/01 -0700, you wrote:
> >This confused me for awhile, because the single equal sign seemed to work
> >for comparison, but created inexplicable errors in my programs.  It seems
> >strange to me that a successful variable value assignment does not return
> >true.
> >
> >example:
> >
> > >
> >  $shiny = 1;
> >  if($shiny = 0){ echo("This wont print"); }
> >  echo( $shiny ); //this will return 0
> >
> >?>
> >
> >--Dan
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> + ==
> + Pierre-Yves Lem@ire
> + E-MedHosting.com
> + (514) 729-8100
> + [EMAIL PROTECTED]
> + ==
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] assignment operator works for comparison??

2001-04-10 Thread Dan

You are right, thank you.

> It looks to me like the value of an assignment is the value assigned, as
in
> Perl. But I don't know for sure, haven't come across this in the manual.
>
> Kirk
>
> > >  > if($shiny = 0){
> > > This does not compare anyting, it assigns 0 to $shiny
> >
> > yes i know, but shouldnt this operation return true?




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




[PHP] limiting lines

2001-07-29 Thread dan

Hi,

I would like to run a variable of unlimited length through a filter that
would limit its length to 55 lines (ie limiting it's length to less than 1
printed page).  Does anyone know of an easy way to do this?

thanks.

Regards,

Dan Barber
Mojolin
 
---
Mojolin: The Open Source/Linux Employment Site
http://www.mojolin.com



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




Re: [PHP] Re: limiting lines

2001-07-29 Thread dan

Thanks for the quick answers. 

Problem is, the only new lines are at the end of paragraphs, so that, in
effect, is limiting them to 55 paragraphs.  I'm using a  which says that it adds a "%0A%0D" (carriage return/line
feed) at the end of each line.  

Anyone know how to convert that to a "\n" ?

thanks again.

Dan
Mojolin: The Linux Employment Site
http://mojolin.com

> If you're expecting new lines, you could do this:
> 
> $length = explode("\n", $message);
> 
> if (sizeof($length) > 55) {
> // error
> }
> 



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




[PHP] cross-compile PHP

2004-09-27 Thread Dan
Has anybody gained general experience with crosscompling PHP?
I want to run PHP on an axis devboard82 in combination with sqlite.
The crosscompiler is gcc-cris (cris-dist-1.56).
I appreciate any feedback, thanks,
Daniel

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



[PHP] cross-compile PHP

2004-09-27 Thread Dan
Has anybody gained general experience with crosscompling PHP?
I want to run PHP on an axis devboard82 in combination with sqlite.
The crosscompiler is gcc-cris (cris-dist-1.56).
I appreciate any feedback, thanks,
Daniel

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



[PHP] BOA and PHP

2004-10-05 Thread Dan
Is it possible to run PHP with a BOA webserver? What have I to change to
make them work togehther?
Feedback is appriciated, thanks,
Daniel

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



Re: [PHP] Re: anchor name on URL

2008-11-20 Thread Dan
>
> The Webkist engine afaik is licensed under the GPL, because of the use
> of the code from the original KHTML. I'm not sure how this fits with M$
> proprietary plan however...
>

Webkit is licensed under LGPL and BSD licenses.

> You say that, have you heard the latest for IE9? They're already
> planning it, and apparently it's going to use the Webkit engine!

Actually they haven't planned that at all. There was a comment by Steve
Ballmer in an interview that it was an interesting project, and something
they may look at, but that comment was quickly countered the next day by
Microsoft PR. Also, 'look at' != 'adopt'. They have no intention of using
Webkit, as they feel it important that they're able to continue to 'extend
the web' with proprietary additions to Trident. ;)


Re: [PHP] My project requires creating office documents on PHP. Any recommendations on what to use?

2010-11-20 Thread Dan


On Nov 20, 2010, at 1:10 AM, chetan ahuja  wrote:

> My project requires creating office documents on PHP. Any recommendations on
> what to use?

When you say office documents do you mean you have to create them using 
Microsoft office? Or just need to replicate current paper documents?

If you need to replicate current paper documents into an electronic version 
that can automatically be filled in by using PHP, I would recommend FPDF.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Intelligent Forms and Form Processing

2005-02-15 Thread dan
Hello, all -
I am working on a few small projects to try and teach myself how to 
build intelligent forms.  I have come as far as making a few simple ones 
that are created when their parent function is called.  Something like 
the following:

function displayMyForm($username='',$password='',$account='') {
// do some stuff for the vars that were passed
// create form
}
Nothing much, but it gives me a good footing on the use of displaying 
forms dynamically even when some data is missing - making use of default 
values.

The problem that I am faced with now, as simple as it seems, is a 
situation such as the following:

User goes to index.php, enters in some information.  ACTION='' is the action.  Some data is carried in the 
form of variables that were entered in on a form.

I want that same page to "catch" that data and process it.  If the data 
is complete and valid, pass to another section of the form.  If it is 
not, prompt the user to re-enter some data.

I don't really know what I'm asking here.  I guess ultimately I'm 
curious as to how people make intelligent forms such as this.  How do 
you deal with missing/incomplete values?  What about multiple "steps" of 
a form?  How do you verify that, if a user is on "step 2", they came 
from "step 1"?  Do you mix $_GET and $_POST to verify the process?

Not coming from a big programming background, some people might think 
that these questions are pretty lame, and I'll go ahead and tell you 
that you are absolutely correct.  However, as I start, I would like to 
develope and work on good programming habits, so I don't learn bad 
habits to begin with.

Any feedback will be appreciated.
Thanks
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Intelligent Forms and Form Processing

2005-02-15 Thread dan
Matt M. wrote:
Any feedback will be appreciated.

why reinvent the wheel?
take a look at:
http://pear.php.net/package/Html_quickform
To the people who want to truly understand how the system works, the 
wheel, as it stands, is wothless :)

I know I can use a drop-in solution, and I might consider it in the 
future.  However, if I understood in more detail the entire process, I 
would be able to troubleshoot and add advanced features to the wheel.

That's how I look at it, anyway.
Thanks
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] MySQL and MySQLi compiling

2005-02-17 Thread dan
Chris wrote:
Hi, I've been trying to get these 2 compiled together for a while, and 
have had no luck.

WHere my problem lies, I think, is that I'm not sure what directory 
should be specified on the --with-mysql part

./configure --with-apxs2=/usr/local/apache/bin/apxs 
--with-mysql=/usr/include/mysql/ --with-mysqli=/usr/bin/mysql_config

I have my own compiled Apache (It is Apache 2) , and MySQL 4.1.9 
installed (the packages off mysql.com). The PHP documentation jsut says 
point it to the install dir. I'm nto sure what counts as the install dir 
for the MySQL packages.

Any advice would be appreciated.
Below is a snippet of some of the error I'm getting I'm actually getting 
ALOT more, they all seem to be "First defined here" errors.

Thanks,
Chris
/usr/lib/mysql/libmysqlclient.a(vio.o)(.text+0x40): first defined here
/usr/lib/mysql/libmysqlclient.a(vio.o)(.text+0xc0): In function 
`vio_delete':
: multiple definition of `vio_delete'
>snip<
I had in my mind that they could not be used together, and I began to 
wonder why again, as I had since forgotten.  When I try to use 
"--with-mysql --with-mysqli", I get the following:
...
...
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... /tmp/mysql.sock
checking for mysql_close in -lmysqlclient... (cached) yes
checking for MySQLi support... yes
checking whether to enable embedded MySQLi support... no
configure: error: --with-mysql (using bundled libs) can not be used 
together with --with-mysqli.

So I guess that might help you out.  The only other thing I can think of 
is if you have two different mysql-devel or mysql library packages 
installed.

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


Re: [PHP] mysql query

2005-02-17 Thread dan
Sebastian wrote:
Hello,
im working on an article system and looking to avoid running three queries.
example, i have this query:
SELECT id,title FROM articles WHERE id=$_GET[id]
now say $_GET[id] = 5
I would like to get the previous id 4 and the next id 6 (if there is one)
so i can do something like:
<< Previous Article [Title]
Next Article [Ttitle] >>
i would assume this is impossible without running mulitple queries? just
thought i'd ask in case i am wrong. i am using mysql 4x
thanks
Is it possible to make a function that would increase/decrease a 
"counter" which would contain the page number that they were on?  I am 
not sure about doing all this, since I am a bit new, but I believe 
that's what I'd investigate.

$pagenumber = thepagenumberthatweareon
int getNextPage(int currentPage, int scale), where scale 'up' or 'down'
function getNextPage($currentPage, $scale) {
global $pagenumber;
if ($scale = 'up') {
return "$currentpage" + "1";
} else {
return "$currentpage" - "1";
}

}
That could be a totally bogus function, but I thought it'd be fun to 
throw that out.  It at least gives you something to go on, I guess.

As long as we're looking at this, anyone want to suggest to me if I had 
done anything wrong with that function, and how I can improve on it?

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


Re: [PHP] php temporary files

2005-02-21 Thread dan
Péntek Imre wrote:
Hi,
Now I want to see all my temporary php files in /tmp/php.
I made these settings:
[EMAIL PROTECTED]:~# cat /etc/php.ini |grep /tmp/php
upload_tmp_dir =/tmp/php
session.save_path = "/tmp/php"
soap.wsdl_cache_dir="/tmp/php"
[EMAIL PROTECTED]:~# 
But when I use gzopen() or gzfile() the temporary files are still stored 
in /tmp/
What other settings should I make?
I'm not sure if PHP works this way, but did you completely shut down 
Apache and then restart it after making these changes?

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


[PHP] Re: [MondayMorningRant] Re: [PHP] Semi-OT: Anti-password trading/sharing solutions

2005-02-28 Thread dan
Jochem Maas wrote:
if you any of the following might apply to you, please hit delete now:
1. easily offended.
2. think this email _needs_ a reply.
3. no sense of humour.
4. can't accept that humour varies from person to person.
thanks, that will save alot of heart-ache and bandwidth...
LETS RANT BABY :-)
Dan Trainor wrote:
Hello, all -
First, I'd like to appologize for treading a bit off-topic here, but I 
think that it will cover a lot of questions that others may have.

My company hosts several "Adult-oriented" Web Sites.  Among other tools 

dunno about the rest of the list but that sounds like pr0n to me.
that we use to combat Password Trading are ProxyPass and iProtect. 
They're both amazing products, which stop the use of Shared Passwords by 

right up there with Clippy(tm) and the AOL webbrowser.
detecting multiple logins from different IPs, and they also maintain a 
database of known abused proxies that are often used in conjunction 
with these shared/traded passwords, and block connections from them 
accordingly.

The real magic comes about when you consider how these pieces of 
software actually work.  They don't modify any existing authentication 
systems, but rather, they're both Apache modules.  I've been unable to 
find an Open Source version of these programs, which I've been looking 
for, for quite some time.  At more than $50.00 per license for 
ProxyPass and $300.00+ for iProtect, this would be more than a handful 
back in the pockets of my company, and ultimately, mine, when you 
consider the amount of our servers that run these tools.

so you spend 350 dollars per server, you wouldn't do it unless it made 
money,
besides I'll bet the clients actually pay it (or you spend your own 
money to
provide free hosting to hard-up 'adult content providers') - so really your
looking for a OS variation so that you can pocket the extra 350.

ah do all the other pr0n peddlers have TWO porsches'? poor little Dan 
must be
feeling left out.

I've found one solution that looks promising called PureMember, but 
this too, costs a bit.  Seeing that is what prompted me to write to 
the PHP list, because it makes itself into an Apache module using an 
mmencode procedure.

With that being said, what kind of solutions might the PHP community 
suggest to combat the trading and abusing of shared or traded passwords? 

solution: try re-prioritizing other peoples misery above your own greed...
tada.
I CAN HONESTLY SAY I DON'T GIVE A F*** ABOUT YOUR ABUSED pr0n PASSWDS,
on the contrary I hope your whole insdustry gets pirated and hacked into
oblivion, I wish upon your inbox 1 times the number of sick spam 
messages
all your clients have ever sent out.

 These solutions cannot modify the existing authentication procedures 
- meaning, I cannot convert a site that relies on .htaccess/.htpasswd 
authentication to a SQL-based authentication.  The solution needs to 
have some sort of logging, either locally or remotely.  The solution 
also has to be Open Source.

I eagerly await some feedback on this, because like I said, I'm sure 
there are others that have some of these same questions.

can anyone else see a good reason to sit down a write a a free OS
apache module that stops passwd sharing so that some porn peddler
can make more money?

I for one would love to donate all my free time to making you rich,
but only on the condition that you can prove at 50% of all the females
portrayed in the media offered by 'your clients' can truthfully have
the following said about them:
1. they have been forced fed drugs.
2. they have had their passport withheld.
3. they are beaten/raped regularly.
4. they have Shires Horses forced upon them.

 or maybe you could go f*** yourself (no doubt one of your clients can
provide an instruction video).
Thanks for your time

Thanks for continuing and support a wholy abusive industry and mindset, 
thanks
for destroying/perverting/twisting the sexuality of millions, nice one ace.

PS - anyone who might get the impression I some kind of fanatical religious
virgin: I have a kid, I have utter contempt for organised religion and 
I'm just
to lazy to be fanatical about anything. BUT p0rn as an industry ain't no 
good
for peoples state of being... otherwise the Kama Sutra would have a
'throatf***ing' edition. Or maybe everyone disagrees, maybe I'm just a 
lone nut,
maybe the "objectification of women" is the way, the truth and the 
light

PPS - Here in Holland, we have a current top 'musical' 10 which includes 
a 'song'
entitled - "I just want to call you my bitch", which is simultaneously 
the complete
lyrics to said 'song' - super smashing great, a truly inspirational 
piece of art
sprung forth from the fertile cultural environment we live in - hiphip 
hooray for
pr0n peddlers everywhere!

PPPS - anyone still reading is 

Re: [PHP] Apache and PHP

2005-02-28 Thread dan
Gustav Wiberg wrote:
Hi there!
I've just installed Apache on a new computer. (just for testing)
It's Windows XP. I've then installed PHP and it says that Apache could 
be not configured automatically.

Newbies question as hell probably but here it goes:
I can access my Apache-server, I have the document-root to c:\webb and 
the apace-files is in c:\program\Apache
I've changed a little in httpd.conf file and restarted the 
Apace-service. I have changed the documentRoot and another parameter 
that was very alike documentRoot...

But my problem...
The sourcecode for PHP shows when I access the http-server with php-files.
I don't cant getting any full support answers on this, just give me 
hints... :-)

/G
@varupiraten.se
Check out:
http://www.php.net/manual/en/install.windows.apache2.php
Pay particular attention to the AddType directives.  This will make 
Apache "process" PHP files.

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


Re: [PHP] Semi-OT: Anti-password trading/sharing solutions

2005-02-28 Thread dan
Richard Lynch wrote:
Dan Trainor wrote:
I'm not quite sure why you chose the PHP community as a recipient -- There
are quite a few Apache modules out there.
And Modules such as mod_auth_mysql and mod_auth_ldap (?) and, really, any
old mod_auth_XYZ module would be a closer "match" for what you want, I
think.
I know absolutely nothing about how ProxyPass, iProtect, and PureMember
work, however, so perhaps there is something about them that just screams
"use PHP to do this"  [I doubt it though]
It seems to me, however, that you're still a bit off-target on
PHP-General, as your target audience is not those who use PHP, but those
who wrote it and maintain it, particularly the Apache Module part of it.
I believe, in fact, that the Apache Module part of it boils down to the
code Rasmus Lerdorf wrote ages and ages ago, and that mostly Rasmus (I
think) has maintained since then.
Perhaps with Apache 2, somebody else stepped up to write/maintain that
code, and I'm under-informed.
Or maybe Rasmus hasn't touched that code in ages, and somebody else is
doing it now.  Apologies to those individuals who I've slighted by not
naming them at this time.
At any rate, you're trying to get in contact with a handful of people by
sending email to thousands.  Bad Idea #1.
NOTE: Contacting Rasmus directly and offering him $$$ to do this would
maybe not be a Bad Idea.  Asking him to do it for free would be really
stupid.
Next, let's look at your proposal:
You want something that Member Sites need, to avoid the theft/sharing of
username/passwords.
So, in particular, only for-pay Member Sites need this, mostly, as there's
not much point in stealing/sharing a username/password if you can just get
one for free.
So, basically, it's a for-profit motivator that drives this request.
Yet nowhere do I see an offer of recompense for the developers who write
this software for you.  Bad Idea #2.
I highly recommend you figure out what it would be worth to you and some
of your colleagues/friends to have an OpenSource solution to rival the
current proprietary technologies.
Take up a collection or form a very loose consortium with some of your
colleagues to fund the project.
Then write up a specification for what you want done, and make an offer to
PAY somebody and fund the resources needed to get the project from its
current state (gleam in your eye) to a usable state.
You could and probably should still make it OpenSource -- Perhaps with
"Funded by: " attributions on all source code and materials to plug your
consortium and its members -- and then when it's at the stage of
usefulness that you need, you will probably find that some people are
willing to maintain it for little or no money at all.
Right now, though, you've got a lot of people seeing:
"I want you to work for me for free so I can save thousands of dollars
every month"
That ain't gonna happen, dude.
People wrote PHP and Apache and other OpenSource software because THEY
needed it for THEIR own use, and were willing to give it to you for FREE
because they knew that giving away 10,000 free copies would get them one
(1) more Developer to help build/improve the software.
They did *NOT* do it because they wanted you to be able to run your
company on free software.
Which is not to say that they *MIND* that you can do that -- Only that
they're not going to just up and code something just because *YOU* happen
to need it to run your company more efficiently.
You've got zero incentive for the Developer here -- They don't need the
Module you want, and you're not paying them.  [shrug]

Go ahead and look at my first email.  For some reason you didn't get the 
idea that I was looking for solutions.  Ideas.  I wasn't looking for 
anything solid.

The reason why I wrote to the PHP community was to get some ideas. 
Aside from the two people who have sent me hatemail today, the PHP 
comunity is very intelligent, very clever, and might have worked on 
something like this in the past.  That's the information that I was after.

Rasmus?  Waht's he got to do with anything?  Sure, I value and credit 
the work he's put into PHP, but I really think that using his name in 
this context has no point.

Who asked anyone to write any software for me?  Again, let's focus on 
the primary purpose of this email - to gather information so that I can 
do some further investigation.

You know, you're right.  It's stupid for me to think that Open Source 
software is used in for-profit situations.  PHP, Apache, MySQL, Linux in 
general - it's really stupid to think that they might actually help 
someone make money, isn't it.  This is what you are saying, as per 
"Stupid Idea #2".

I'm not going to get into an argue with you over the moral values of 
Open Source software.  I understand them fully.  Gratitude and in some 
cases money is given to 

Re: [PHP] Re: Authentication fails - problem line found

2005-03-04 Thread dan
phpninja wrote:
I think all php functions are case sensitive and must be all
lowercase. try changing "IsSet" to "isset" and give it a run. I im not
100% sure because i always type every function in php lowercase and
keep it the same throughout the application so i dont ever have to
worry about that. Just a thought.
-phpninja
-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 04, 2005 11:03 AM
To: John Swartzentruber
Cc: php-general@lists.php.net
Subject: Re: [PHP] Re: Authentication fails - problem line found

John Swartzentruber wrote:
I stripped down my original script until it started receiving POST data,
then I kept modifying it until I figured out where the problem was. I
found it, but I'm still as clueless as every.
To summarize: I have a form that posts to the same script that contains
the form. In its original state, when the script is called after I
submit the form data, the $_POST[] data is completely empty and the
_SERVER variable that indicates the type of data is set to "GET".
In the script is the following code:
if (IsSet($_POST["action"])) {
//$action = $_POST["action"];
} else {
$action = $_GET["action"];
}
Normally the second line is not commented. When I comment out that line,
then the $_POST array has all of the data I would expect it to. When it
is not commented, then it does not work.
Just to make sure that I am really confused, this bit of code is *after*
the call to var_dump($_POST), but *before* the code that creates the form.
Does anyone have any ideas about why setting this variable has such a
large and seemingly unrelated affect?

WILD GUESS:
Somewhere in your form and/or the logic, you are sending GET data for
$action as well as POST data for $action, and you are confusing the two.
Show us your stripped-down but still-broken code.
How about using single quotes around all the action phrases:
if (IsSet($_POST['action'])) {
//$action = $_POST['action'];
} else {
 $action = $_GET['action'];
}
I'm slowly learning, myself, on the proper placement of quotes.
Thanks
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Authentication fails - problem line found

2005-03-04 Thread dan
John Swartzentruber wrote:
On 3/4/2005 2:23 PM Dan wrote:
phpninja wrote:
I think all php functions are case sensitive and must be all
lowercase. try changing "IsSet" to "isset" and give it a run. I im not
100% sure because i always type every function in php lowercase and
keep it the same throughout the application so i dont ever have to
worry about that. Just a thought.
How about using single quotes around all the action phrases:
if (IsSet($_POST['action'])) {
//$action = $_POST['action'];
} else {
 $action = $_GET['action'];
}
I'm slowly learning, myself, on the proper placement of quotes.
Thanks
-dant

I tried that. I also doubt that isset would work any better because that 
condition is being processed correctly.

This script is not something that I wrote, it is something I downloaded. 
I assume that it works correctly for the author on the author's system.

what I do sometimes is throw in keywords or the like:
if (IsSet($_POST['action'])) {
//$action = $_POST['action'];
  echo "stage 1";
} else {
// $action = $_GET['action'];
  echo "stage 2";
}
That helps me to determine the logical order of execution.  I don't 
think case has anything to do with it, as Chris had asked, but I don't 
suppose it would hurt.

YOu can also use phpinfo('INFO_VARIABLES'); to print all env vars to see 
if your var is even coming through.  However, the above example will 
pretty much determine this.

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


Re: [PHP] a new it company

2005-03-09 Thread dan
Dan Tappin wrote:
I think Rory has trouble jumping to conclusions.  I was attacked off 
list by Rory thinking I was another list member... another dant 
(remember the OT adult content rant / thread?).

I would agree that this is not really spam... just bad judgment.  The 
flood of angry replies to this poster should teach them their lesson 
about mailing list etiquette.  If it continues they will simply be 
banned from the list.

With free speech you have to live with the odd incident like this.
Dan Tappin (Dan T)
On Mar 9, 2005, at 11:29 AM, Jochem Maas wrote:
Rory Browne wrote:
SPAMMER
From your email address I'm assuming that your name is Sharvan Saxena.
It seems like too much of a coincidence that the contact person on
that site(Tanuj Saxena), and your good self, have the same surname.
Because it seems your are a spammer, and a liar(you concealed your

I'd class him as stupid or ignorant maybe - but one hand sent email 
doesn't
really class someone as a spammer does it, I thought the bar was a little
higher than 1 email :-)

(top-post, please)
You guys are still sore about that?  heh
Is this a solicitation, or a "manual spam"?
Thanks
-(the other dant)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Temporary storage of data

2005-03-10 Thread dan
Hello, all -
I am building a script that basically records some data on the local 
server for a period of about one hour.  At that time, the data is sent 
to another server by means of HTTP POST.

The problem I'm faced with is how to store the data locally.  There are 
a few things that we're going to have to assume, due to options that are 
not under my control:

Solution has to rely on internal PHP functions, i.e. nothing compiled 
into PHP (I was hoping a DMB-style database would be good, but cannot be 
used since it has to be compiled into PHP)

Solution has to store data in a public place, i.e. /tmp/somedata/, as 
the person using the script may not have access to change permissions.

I would like to store data in a public folder, but would also like for 
this data to be encoded somehow.  serialize()'d data can still be 
visually decoded, else I'd use that, as well.

Solution cannot assume that MySQL, PGSQL, or any other database 
application is available to use.

I guess the problem is, how would one go about making multiple secured 
read/writes to a file, such as a mini-database, without relying on any 
options that are compiled into PHP?  We're talking on a bare-bones 
vanilla PHP installation, with no DBM, MySQL, PGSQL, dbm, or otherwise 
"real" database support in it.

Any input on this would be very greatly appreciated.
Thanks
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Temporary storage of data

2005-03-10 Thread dan
dan wrote:
Hello, all -
I am building a script that basically records some data on the local 
server for a period of about one hour.  At that time, the data is sent 
to another server by means of HTTP POST.

The problem I'm faced with is how to store the data locally.  There are 
a few things that we're going to have to assume, due to options that are 
not under my control:

Solution has to rely on internal PHP functions, i.e. nothing compiled 
into PHP (I was hoping a DMB-style database would be good, but cannot be 
used since it has to be compiled into PHP)

Solution has to store data in a public place, i.e. /tmp/somedata/, as 
the person using the script may not have access to change permissions.

I would like to store data in a public folder, but would also like for 
this data to be encoded somehow.  serialize()'d data can still be 
visually decoded, else I'd use that, as well.

Solution cannot assume that MySQL, PGSQL, or any other database 
application is available to use.

I guess the problem is, how would one go about making multiple secured 
read/writes to a file, such as a mini-database, without relying on any 
options that are compiled into PHP?  We're talking on a bare-bones 
vanilla PHP installation, with no DBM, MySQL, PGSQL, dbm, or otherwise 
"real" database support in it.

Any input on this would be very greatly appreciated.
Thanks
-dant
Ah, we're also going to have to assume that system() and exec() 
functions and all those related will not be available, as well.

I'm sure this is a problem that many have faced before, especially when 
making "dummy" and/or "drop-in" scripts where you would not want the 
Administrator to make any modifications to ease installation.

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


Re: [PHP] Regular Expressions?

2005-04-08 Thread dan
[EMAIL PROTECTED] wrote:
Windows 2000 Server
IIS 5/Apache 1.3.33
MySQL 4.1.1
Smarty 2.6.9
PHP 5.0.3
Hi all,
I am looking for help handling a form input to SQL. I believe the solution has to do with regular expressions.
My big problem is that when a user submits data such as: 

Joe's Crabshack
The ' apostrophe or " can cause an early truncation of the data. My code thinks 
that the closing identifier is after the word Joe and the rest of the input is lost. 
Further, if the data does get by and it could possibly break a SQL statement.
Am I right in thinking the solution in this matter is using regular expressions? If so, where is a good resource to polish my skills? 

What about turning off/on magic quotes?
John
If you don't plan on doing anything this weekend, pick yourself up a 
copy of O'Reilly's Regular Expressions.  It's "The Owl Book", by the cover.

The reason why I ask if you have all weekend is because it's a good 
book, but at 300+ pages, it's a good read.  I still don't know my 
regex's very well, but then again, I just kinda skipped through it. 
However, it is laid out in a format that makes it a very good reference 
book, so if you're looking to do something, then this book makes it easy 
to "piece things together" and find a regex that works quite well.

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


[PHP] Creating intelligent forms

2005-04-13 Thread dan
Hello, all -
I had some questions regarding the creation of "intelligent" forms - 
forms that take data, and then parse it for errors, "real" data, etc etc.

The first idea I had was to make a function to display the form.  When 
the form is submitted, the page would be called again (i.e. the form's 
ACTION=itself), and then the POST or GET or SESSION variables will be 
the arguments to the form.  The idea is, when this happens, the form 
will be able to check the data that was sent, verify it, etc etc.  If 
there are no problems with the data, then the user is directed to step 2 
of the form, or the second page, to enter in additional data.  But how 
should the redirection happen?

At that point, am I able to manipulate the headers for a different 
Location:, that location being the second form to be filled out?  Since 
this would be the first data sent to the BROWSER, I thought that this 
might work.

I've been toying with both of these ideas with varying success, but 
haven't quite gotten it figured out.  I'm sure that, with due time, I'll 
be able to figure it out.  However, I just want to make sure that this 
is a "correct" way of writing forms, and if it's normally accepted as a 
common practice, so I don't waste my time doing something that might not 
actually work.

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


[PHP] Global Variables

2005-04-28 Thread Dan
Hi all.
I taught myself PHP before the frenzy over register_globals.
After a reasonable break from the language, I'm back for more.
I'm building a site where I'll be holding a lot of variables in memory 
for each session. How do I do that? Apparently I can't use 
session_register() if register_globals is turned off. I've read a little 
about the consequences of writing bad scripts with register_globals on 
... I'm fine with this explanation. I agree that I don't want people 
injecting variables into my session. What I want is for ME to be able to 
set variables and remember them throughout the session. How do I do that?

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


[PHP] Re: editor that typesets the php code

2005-04-28 Thread Dan
Dasmeet Singh wrote:
Hi!
I have just completed coding for a script... i want to take a printout 
of the code.. but the code is very hotch potch..

Is there any software to automatically set the code with proper 
spacing/tabs extra..and possibly give colors to it too...??

Thanks in advance :)
ActiveState's Komodo ( http://www.activestate.com ) is very good. It 
handles Perl, PHP, HTML, XML, Python, and a whole lot of other things 
too. It does Perl and PHP debuggin, which is a godsend.

I *think* it's about $25 for a 'home' type of license, which covers you 
for making open-source stuff. Otherwise you need a commercial license.

I know a lot of people kick up a stink about non-free software, but 
ActiveState are pretty good as companies come, and Komodo really is 
cool. It's based on Mozilla, and cross-platform ( a little - Win32 and 
Linux, no OS-X ).

Otherwise, there's bluefish ( gtk2-based ) , which does a very nice job 
of syntax highlighting etc, and it's open-source. I used it for ages 
until I decided a needed a debugger that didn't suck.

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


Re: [PHP] mail() Problem

2005-05-09 Thread dan
Mary-Anne Nayler wrote:
Hi.
I am very new to this group and this is my first request for help so 
please be patient.

when I try to use the mail() function in a PHP based webpage I get the 
following error:

Fatal error: Call to undefined function: mail() in  on line 

I have tried changing some mail config details in php.ini. For instance, 
the path to sendmail used to be: "/usr/lib" and I have changed it to: 
"/usr/lib/sendmail -t -i".  The permissions on sendmail are 555, owner 
is root and group is other.

I guess you could say I am well and truly clutching at straws now!!
Has anyone else ever had this problem? If so how was it resolved?
Mary-Anne
Mary -
This error occours when PHP can't find sendmail at compile-time.  Your 
best bet would be to install sendmail or a sendmail-compatible MTA, and 
then rebuild PHP.

Postfix is my second love, so naturally I'd recommend it - www.postfix.org.
Thanks
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Form handling

2005-05-11 Thread dan
Hello, all -
I've been researching how to handle forms properly, and I think I 
figured out a way that might be beneficial for me to use.  It is as follows:

(index.php)
session_start();
if (isset($_SESSION['step'])) {
switch $_SESSION['step'] {
case "1":
require('step1.php');
break;
case "2":
require('step2.php');
break;
case "3":
require('step3.php');
break;
// add more case statements here if I need to
default:
require('step1.php');
break;
}
} else {
$_SESSION['step'] = '1';
require('step1.php');
}
Each stepX.php file would look something similar to this:
(step1.php)
// if submitted, check data for completeness
// if complete, set 'step' to 2, to be used as argument to index.php
$_SESSION['step'] = '2'
// redirect back to index.php, use new value of 'step' to direct
header('Location: http://somesite.com/index.php');
// else display form data

Now, this is, really, one of my first experiences with doing forms.  I 
just want to know if I can/should/would anticipate any problems down the 
road while doing this.  I think it would work quite well, but I've only 
been doing this for a short while.

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


[PHP] auto_prepend_file in Apache Directory container

2005-05-12 Thread dan
Hello, all -
I'm trying to override the value of php.ini's 'auto_prepend_file' 
function, inside of an Apache Directory container.  I'm not having much 
luck.  In fact, no luck at all.  This never happens.

So I'm wondering now, are functions set by 'php_value' inside of an 
Apache config file only good for the entire VirtualHost in question, or 
can they be applied on a per-directory basis using Apache's Directory 
directive?  Or am I justflat-out doing something wrong? I have something 
similar to this:


...apache config...
php_value auto_prepend_file \
 /var/www/virtual/pornpromoter.net/dev1/auto_prepend_file_02.php
...more apache config...

Threw in the '\' there for the sake of some mail clients that would wrap 
the line.  The '\' is not present in the configuration file.

I've been doing some research and have come up dry.  I was hoping 
someone would be kind enough to provide some answers here.

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


Re: [PHP] Best CC gateway

2005-05-12 Thread dan
Sam Smith wrote:
 

Any recommendation for the easiest credit card gate way for PHP running on
FreeBSD?
Authorize.net?
Thanks
Sam -
I've been using CyberSource and have been quite happy with it.  I got a 
deal on it by gonig through Bank of America and acquiring a merchant 
account, as well - although they do have options to just purchase the 
gateway functionality.

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


Re: [PHP] Form handling

2005-05-12 Thread dan
Richard Lynch wrote:
While this *CAN* work, and a lot of people like it, it tends to add a fair
amount of "cruft" for not that much benefit, really...
What do you GAIN having this big old switch statement?
What data/processing is really really shared in all these steps?
On Wed, May 11, 2005 4:57 pm, dan said:
Hello, all -
I've been researching how to handle forms properly, and I think I
figured out a way that might be beneficial for me to use.  It is as
follows:
(index.php)
session_start();
if (isset($_SESSION['step'])) {
switch $_SESSION['step'] {
case "1":
require('step1.php');
break;
case "2":
require('step2.php');
break;
case "3":
require('step3.php');
break;

Simpler:
case "1":
case "2":
case "3":
  require "step$step.php";
break;
Also not that it's pretty unlikely that your default will kick in, since
somebody would have to intentationally hack $step to be, say, 4 or
something to reach that line of code... [more]

// add more case statements here if I need to
default:
require('step1.php');
break;
}
} else {
$_SESSION['step'] = '1';
require('step1.php');
}

So you might want to start off with:
$step = isset($_SESSION['step']) ? $_SESSION['step'] : 1;
Then you could do your switch, and default to step1, thereby having all
the same functionality, but with fewer branches in the actual algorithm.

Each stepX.php file would look something similar to this:
(step1.php)
// if submitted, check data for completeness
// if complete, set 'step' to 2, to be used as argument to index.php
$_SESSION['step'] = '2'
// redirect back to index.php, use new value of 'step' to direct
header('Location: http://somesite.com/index.php');
// else display form data

Now, this is, really, one of my first experiences with doing forms.  I
just want to know if I can/should/would anticipate any problems down the
road while doing this.  I think it would work quite well, but I've only
been doing this for a short while.

I did it this way at first, but quicly found that the amount of shared
code between steps was so minimal, that it was better to just have each
step as a separate form, with filenames that made sense for the
information gathered at that stage.
It's also sometimes good to let the user fill in different steps in
whatever order they prefer -- depending on the data gathered and what your
business goals are.
I've seen a particularly nice implementation of this at CDBaby (which is
not real useful to anybody reading this unless you happen to be a musician
with a CD you want to sell...) where the steps can be done in any order,
but the first five are MUST DO and are flagged as such in RED until you do
them, and the last three are OPTIONAL and are in yellow until you do them.
 Completed steps are changed to green.
Since some of the steps could require a fair amount of background work
(writing/editing/fixing-up your Bio, for example, or getting a complete
track listing with titles in order) he lets you do them in the order that
fits into your life, not in the order he happened to program that morning.
 Very nice.
Richard -
I was just looking for some sort of confirmity and ease of use.  I've 
been experimenting with some of my own ways to handle form data. 
There's nothing that I hate more than clutter, so that's why I wanted to 
break the form apart inside of these smaller files.

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


Re: [PHP] auto_prepend_file in Apache Directory container

2005-05-12 Thread dan
dan wrote:
Hello, all -
I'm trying to override the value of php.ini's 'auto_prepend_file' 
function, inside of an Apache Directory container.  I'm not having much 
luck.  In fact, no luck at all.  This never happens.

So I'm wondering now, are functions set by 'php_value' inside of an 
Apache config file only good for the entire VirtualHost in question, or 
can they be applied on a per-directory basis using Apache's Directory 
directive?  Or am I justflat-out doing something wrong? I have something 
similar to this:


...apache config...
php_value auto_prepend_file \
 /var/www/virtual/pornpromoter.net/dev1/auto_prepend_file_02.php
...more apache config...

Threw in the '\' there for the sake of some mail clients that would wrap 
the line.  The '\' is not present in the configuration file.

I've been doing some research and have come up dry.  I was hoping 
someone would be kind enough to provide some answers here.

Thanks!
-dant
Hello -
Doing some more research, even on the following page:
http://us3.php.net/manual/en/ini.php#ini.list
...shows that php_prepend_file should still work inside an Apache 
directory container (as indicated by "changeable" PHP_INI_PERDIR), but 
it is not.

Has anyone had this kind of problem before?
Thanks!
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Form handling

2005-05-13 Thread dan
Richard Lynch wrote:
On Thu, May 12, 2005 12:55 pm, dan said:
I was just looking for some sort of confirmity and ease of use.  I've
been experimenting with some of my own ways to handle form data.
There's nothing that I hate more than clutter, so that's why I wanted to
break the form apart inside of these smaller files.

I'm only suggesting that you take that farther -- break the form apart
into smaller files, with no super-structure trying to control them.
The "value added" of the central switch seems dubious to me.
Just my opinion.
Richard -
I want your opinion, which is why I'm taking a stab at the list ;)
What other methods would be good to use?  Using a giant if statement?
Thanks
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] auto_prepend_file in Apache Directory container

2005-05-13 Thread dan
Richard Lynch wrote:
On Thu, May 12, 2005 12:48 pm, dan said:
I'm trying to override the value of php.ini's 'auto_prepend_file'
function, inside of an Apache Directory container.  I'm not having much
luck.  In fact, no luck at all.  This never happens.
So I'm wondering now, are functions set by 'php_value' inside of an
Apache config file only good for the entire VirtualHost in question, or
can they be applied on a per-directory basis using Apache's Directory
directive?

Certainly some php_value directives can be over-ridden in .htaccess,
regardless of whether they were set globally in httpd.conf or in a
VirtualHost or Directory block.
Equally certainly, some cannot be over-ridden.
I am almost 100% certain that php_value makes no distinction between
*where* in httpd.conf the setting comes from.  I daresay php_value in
.htaccess can't even tell the difference from one part of httpd.conf to
the other.
http://php.net/ has a page devoted to describing exactly which php_value
settings can be over-ridden where.  Check that.
It's also possible that once auto_prepend_file is set, it's set, and
that's it -- Regardless of where it is set, you're stuck with it at that
value.
So it's more of a 'define' for a constant that some kind of variable you
can change on a whim.  Part of that could easily be to provide web host
administrators with a way to guarantee that some PHP code of theirs gets
run no matter what their clients may try to do...  Which I could see might
be handy for some hosts, and they'd not want it over-ridden.  These last
two paragraphs are pure speculation on my part.  But it could be true, and
it wouldn't really fit into that nifty chart in the manual.
Richard -
Yes, I agree with you.  I think it's an "all-on" or "all-off" sort of 
thing, and you cannot be terribly specific with it's usage.  THe only 
way I've found to combat this issue is to make a different virtualhost 
or some such, which is what I'm ging to end up doing.

I did take a look at php.net's page devoted to describing exactly which 
php_value settings can be over-ridden, and it does claim that this 
option can be set in a per-directory context.

Thanks for your time
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Form handling

2005-05-13 Thread dan
Jason Barnett wrote:
Dan wrote:
Richard Lynch wrote:
...
The "value added" of the central switch seems dubious to me.
Just my opinion.
Richard -
I want your opinion, which is why I'm taking a stab at the list ;)
What other methods would be good to use?  Using a giant if statement?
Thanks
-dant

Nononono a giant "if" statement is still a case of you trying to 
control all form processing in one centralized location.  I won't 
venture a guess as to why Richard doesn't approve of the centralized 
approach, but rather just pointing out that if() is logically similar to 
switch().

Now going back to your original question... one easy to predict problem 
is that you've forgotten to handle form submission errors.  I mean 
surely you will want to validate the incoming data and do something 
sensible if the data doesn't match some regular expression(s).  If 
you're really trying to go for a centralized approach then I'd say this 
validation should be handled through this main script.

A simple alternative?  Each form has its "target" attribute set to 
itself.  You start out with invalid data.  Then when the form POSTs to 
itself you can validate the incoming data within the same script where 
the form elements are located.  This approach puts all of the business 
logic for one page *inside the one page*.  It makes debugging a lot 
simpler because, well, if you have a problem with page1.php then you 
know it lies somewhere in the script page1.php instead of any of the 
following:

- page1.php
- controller.php
- index.php
- page2.php
- etc.
One of the easiest ways to reduce maintenance is to make it easy to find 
your bugs.  I'm not being condescending to you, because we all have 
bugs.  But it sure is easier to fix them when you can find them.  :)


Jason -
Very valueable input, I appreciate that.
I did not forget about error checking.  Error checking (or currently 
lack thereof) is the reason why I sent a message to this list.

However, since I'm anal, I want the entire page to be named index.php, 
which is why I am stuck on the idea of making each page's "target" set 
to index.php WITH $_SESSION['step'] being set to 1, 2, 3, whichever is 
the next step in the process.  If this is bad, what are my alternatives now?

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


[PHP] Re: www.soongy.com

2007-08-17 Thread Dan
What is this supposed to be exactly?  I gather from looking at it quickly 
that uses can signup, then send messages to other signed up users right?


So it's like email, but you can only send messages to other people that 
signup, and login through that specific webpage.  Forgive me but I don't see 
the appeal, what is this for?


- Dan

""Gevorg Harutyunyan"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Hello,



I am Gevorg.

I just wanted to introduce you my new PHP based work here www.soongy.com
<http://www.soongy.com/> .

It is working on PHP and MySQL and here is used DHTML, AJAX.



Thank you very much.



Waiting for your response



Regards,

Gevorg






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



[PHP] Re: About Session And Cookies

2007-08-31 Thread Dan
Wow, you really need to be carefull when ever you're dealing with money, 
although if you're just handing the objects in a cart and passing that to a 
secure payment system then it's not as big of a deal.


Cookies can be stolen.

Sessions are vulnerable to snooping if you're on a shared server.

They have their pros and cons, and it would take way to long to explain the 
way each of them work.  You're best off to learn about both in a depth with 
a security standpoint.



"Kelvin Park" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

I am trying to setup a secure login system.
I've heard that if I use just cookies for login, members without cookie
turned out won't be able to see the member pages.

Is using session recommended for e-commerce websites with shopping carts?
Or, using both of them might be more effective in some way.



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



[PHP] Re: text to HTML

2007-08-31 Thread Dan
As I know there's no real WYSIWYG text to html converters.  Plus this 
wouldn't do much more than handling paragraphs and new lines.


If you're looking for a way to write html from a textbox check out 
FCKEditor.


Sorry I couldn't help much.  If you really do have only the limited need of 
paragaphs and newlines then go with Ron's solution, it'll work just fine.


- Dan

"Ron Piggott" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]


Is there a PHP command that turns text into HTML?

EXAMPLE:

"before"

Hi.

How are you doing?

"after"

Hi.

How are you doing?




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



Re: [PHP] help with session

2007-08-31 Thread Dan
You should be sanatizing code here.  When you save it to the session and 
when it's output.  Look arround the newsgroups or online for info about it, 
it's everywhere.


- Dan

"mike" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On 8/26/07, Jason Cartledge <[EMAIL PROTECTED]> wrote:

I would replace $_REQUEST with $_GET or $_POST (as appropriate)


  if ( !empty($_REQUEST['gender']) )
 {
   $registrationGender=$_REQUEST['gender'];
 }
 else {


Personally I would use if(isset($_SESSION['registrationGender'])) here


if (session_is_registered('registrationGender'))
 {
  $registrationGender=$_SESSION['registrationGender'];
  print "you are preregistered as a $registrationGender";
 }
 else
 {
  print "your gender is unknown, youare assumed to be a 
male";


   $_SESSION['registrationGender']='male';

I would change it to assign it here. No need to assign it a second
time below, since you are just printing the session variable if it is
already set


 }
  }



Those are a couple quick things my tired bloodshot eyes thought of.



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



[PHP] Re: Which CAPTCHA is the besta?

2007-08-31 Thread Dan
Well what do you mean by "best"?  Best at keeping spammers away, ease of 
use(playing sound for handicapped people), fastest?


If you want to keep spammers away you could go with some super complicated 
script that distorts letters so much that it's really hard.  This keeps away 
not only spambots but also your users :'(.  If you go for ease of use then 
it's probably a popular script and people already have bots that look for 
sites using those particular scripts and have other bots which can crack the 
capchas.


In my opinion the best of both worlds can be done by making it yourslef... 
yes form scratch.  If there's a one of a kind script nobody has seen it 
before and they probably dont' have programs to crack it.  Plus it's really 
easy for users to use since it can be made simple.  Plus then you have 
control over the source.


- Dan

""Tony Di Croce"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

I need a CAPTCHA script Which one is the best? (I dont mind if its
somewhat difficult).



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



Re: [PHP] for loop inside a switch

2007-08-31 Thread Dan
Sanjeev is right.  You're thinking about the problem backwards.  You're 
trying to build a Switch inside a loop.  Remember, if you ever have to do 
some operating multiple times you're using a forloop, then the thing that 
you want to repeat(switch case) is INSIDE the for loop.


- Dan

""Sanjeev N"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

This will not work at all..
Instead of switch try with if condition as follows

for ($i=0; $i <21; $i++) {
if(faq$i == $q){
echo $faq1;
break;
}
}
Now it works..

You can write the code to display the result how you want.. but you cant
write the code to write a code :)

Cheers

Warm Regards,
Sanjeev
http://www.sanchanworld.com
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan
-Original Message-
From: Hulf [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 16, 2007 3:11 PM
To: php-general@lists.php.net
Subject: [PHP] for loop inside a switch

Hi,

switch ($q) {

for ($i=0; $i <21; $i++) {
case 'faq$i':
   echo $faq1;
   break;
}
}


I just want to loop out a big long list of cases.

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


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



[PHP] Sessions running out of storage space - Increase memory?

2007-10-03 Thread Dan
I need to retrieve a huge amount of data form a database and do so many 
times.  To eliminate the overhead of connecting to the database and pulling 
down all that info over and over, I'm trying to pull it down only once and 
stick it into a session.  The problem is I get the first few results and 
everything works fine.  But then after those first 5 or so I only get 0's. 
My first thought is that this is because of a limit on memory that sessions 
can take up or file size/space where the sessions are stored.  I looked in 
the PHP.INI and I didn't find anything though.


Any ideas on how to fix this problem or a more elegant solution to my huge 
data needs?


- Dan 


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



Re: [PHP] Sessions running out of storage space - Increase memory?

2007-10-03 Thread Dan
After thinking about this a while I also thought of making my own cache. 
The problem with that is would it be any faster or have any less strain on 
the server than having multiple requests/connections to the database?


- Dan

"Per Jessen" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Dan wrote:


I need to retrieve a huge amount of data form a database and do so
many times.  To eliminate the overhead of connecting to the database
and pulling down all that info over and over, I'm trying to pull it
down only once and stick it into a session.  The problem is I get the
first few results  and everything works fine.  But then after those
first 5 or so I only get 0's. My first thought is that this is because
of a limit on memory  that sessions can take up or file size/space
where the sessions are stored.  I looked in the PHP.INI and I didn't
find anything though.

Any ideas on how to fix this problem or a more elegant solution to my
huge data needs?


IF there is a problem in using session storage, you could just use your
own file cache instead.
Or you could the database query cache, depending on how much data you're
talking about.


/Per Jessen, ZĂĽrich 



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



Re: [PHP] Sessions running out of storage space - Increase memory?

2007-10-03 Thread Dan
The data doesn't change often but the querys do.  Thats why I was 
origionally thinking of just storing the entire result in a session and just 
use the part of the session I needed.   So caching wouldn't really work. 
That was something intresting though that I didn't know earlier thanks!


- Dan

"Gary Josack" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Does the data change often? If not you could just enable query cache and 
cache connection threads and you'd probably be fine.


Dan wrote:
After thinking about this a while I also thought of making my own cache. 
The problem with that is would it be any faster or have any less strain 
on the server than having multiple requests/connections to the database?


- Dan

"Per Jessen" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Dan wrote:


I need to retrieve a huge amount of data form a database and do so
many times.  To eliminate the overhead of connecting to the database
and pulling down all that info over and over, I'm trying to pull it
down only once and stick it into a session.  The problem is I get the
first few results  and everything works fine.  But then after those
first 5 or so I only get 0's. My first thought is that this is because
of a limit on memory  that sessions can take up or file size/space
where the sessions are stored.  I looked in the PHP.INI and I didn't
find anything though.

Any ideas on how to fix this problem or a more elegant solution to my
huge data needs?


IF there is a problem in using session storage, you could just use your
own file cache instead.
Or you could the database query cache, depending on how much data you're
talking about.


/Per Jessen, ZĂĽrich





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



Re: [PHP] Sessions running out of storage space - Increase memory?

2007-10-05 Thread Dan
It's already in an array format.  I don't remember off the top of my head but 
there's some function like resultsarray which turns the resutls into an array.  
I'm already storing the array in the session.
  ""John A DAVIS"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
  stick in in an array in a session



  >>> "Dan" <[EMAIL PROTECTED]> 10/3/2007 2:21 PM >>>

  I need to retrieve a huge amount of data form a database and do so many 
  times.  To eliminate the overhead of connecting to the database and pulling 
  down all that info over and over, I'm trying to pull it down only once and 
  stick it into a session.  The problem is I get the first few results and 
  everything works fine.  But then after those first 5 or so I only get 0's. 
  My first thought is that this is because of a limit on memory that sessions 
  can take up or file size/space where the sessions are stored.  I looked in 
  the PHP.INI and I didn't find anything though.

  Any ideas on how to fix this problem or a more elegant solution to my huge 
  data needs?

  - Dan 

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




Re: [PHP] A two flavored post

2007-10-12 Thread Dan
In addition to what everyone else has suggested you probably also want to 
have your page work for people without javascript enabled, or the 
handicapped.  One way you could do this is have a div and the PHP generates 
the div where you would put the link, with code for the link inside with the 
PHP variable so you have

--
|  abc.com/?a=value  |
--
the div wouldn't really have a border, it's just there so you can see it.
Anyway, for those lucky people who have JavaScript enabled you could simply 
use JS to change the innerhtml of the div to have the new JS generated link.


- Dan

Nathan Nobbe"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On 10/4/07, tedd <[EMAIL PROTECTED]> wrote:


Hi gang:

I asked this question on the javascript list, but for some reason
it's taking forever to post there. So, I figured that I would ask
here as well.

I'm currently sending data (the value of s) to another script via the
html statement:

Click here

However, I need to add another variable, namely a javascript
variable, to the GET string.

How can I send both a php and a javascript variable together at the same
time?




the question is when is the variable you want to append available to the
javascript.
as soon as you get the variable in the javascript the next thing you can 
do

is append
it to the value of the href attribute of the  tag.


   
   
   window.onload = function() {
</pre><tt>   var someLinkHref = 
</tt><tt>document.getElementById('someLink').href;
</tt><pre style="margin: 0em;">
   someLinkHref += "&anotherVar=8";
   alert(someLinkHref);
   }
   
   
   
   http://somesite.com?a=5";>
   click here
   
   


if you want to use the onclick event handler as rob suggested, you could
stash the variable in the Window
global object, then reference it in the implementation of the onclick
function (though i still have mixed feelings
about that approach [the Window object part that is]).

-nathan


-nathan



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



Re: [PHP] Function return

2007-11-02 Thread Dan
I know that while you should be doing proper validation on the server side 
and everything, you could somewhat diminish the risk of someone building 
their own form and just posting.  If you were to check the referring site 
which made the post then you could be pretty sure someone didn't make their 
own form.  Although this too is insecure, since all you need is a Firefox 
extension, firebug or grease monkey which let you execute JavaScript could 
let you change the page however you want while it's live, the refer would be 
proper, etc.  What I'm really saying is there is NO secure way to validate 
client side, none, absolutely none.


Check that the date coming in is a valid date then create a date object with 
it, that way even if they somehow do slip past your date validation then the 
object just won't be created correctly.


There's lots to validate.

- Dan

""Nathan Nobbe"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On 11/2/07, Stut <[EMAIL PROTECTED]> wrote:


Dan Shirah wrote:
> That is correct, the due_date field should only accept a valid date
format,
> such as MM/DD/.  To bypass the need for a validation check for this
> field I simply set the text field to disabled and supplied the user 
> with

a
> javascript popup calendar that upon selection populates the date in the
> format I want. :)

Client-side limits are not an effective defense against dangerous
inputs. Server-side validation is a must regardless of any client-side
checking that goes on.



this is an excellent point; consider the scenario where someone posts
directly
to your page,  bypasing the client side checks.  this is a trival 
technique;
inspect the form attributes; determine the submission url and the 
submission
method.  look at the name attributes of inputs on the page; and then build 
a

simple
form that posts those inputs to the same url with the same method.

-nathan



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



php-general@lists.php.net

2007-11-30 Thread Dan
Unfortunatly javascript can't access the filesystem so it can't get 
filenames.  The closest way you could do something like this would be to use 
Java (not javascript, totally different).  It's a permissions thing, just 
the way JS and everything else is designed.


- Dan

""Andrei Verovski (aka MacGuru)"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Hi !

Anyone knows PHP/AJAX library which allows to get full path of file 
dropped

into web browser's window area?

It is required for document archiving system in order to avoid multiple 
(or to

be more precise, almost endless) usage of "open file" dialogs from the
browser.

Library should be compatible with Firefox (Lin, Win, Mac), IE and Safary.


Thanks in advance for any suggestion(s).

Andrei 


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



[PHP] Re: how do i get a printout of original multipart post data

2007-11-30 Thread Dan
""Olav Mørkrid"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

hello


how can i get a raw and untouched printout of a multipart/form-data
POST? i need this to analyze what certain user agents do wrong when
uploading files.

what happens is that php just fails to put files into $_FILES, and
gives no way of seeing the original posting and exactly what is wrong
with it.

according to the manual, neither "always_populate_raw_post_data" nor
 work for multipart/form-data.


Go get Ethereal http://www.ethereal.com/ start the program, set which 
network card you want to use (you probably only have one), start capture. 
You'll now see all the packets going down the wire.  Go ahead and do the 
post and you'll be able to see the post data.


- Dan 


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



[PHP] Re: running cmd via php

2007-12-11 Thread Dan
First off I must ask, why do you need to run windows commands when you don't 
even know how to use a PHP function.  First thing taht came to my mind was 
some kind thought, woah, I'm gona learn to hack I'm gona be a leet haxor. 
In the case I'm wrong, sorry, and also you might want to know that exec 
doesn't always work some hosts have it turned off for obvious security 
reasons, also there's other alternatives other than exec such as shell_exec 
I think that's the name, etc although that's for Linux which can do a lot of 
the stuff that Windows can also.


- Dan

""adam_99"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Hello!
I'm trying a lot to find how I can run the cmd (command line of windows) 
and send to the cmd commands?
Thanks. 


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



[PHP] Re: running cmd via php

2007-12-11 Thread Dan
First off I must ask, why do you need to run windows commands when you don't 
even know how to use a PHP function.  First thing taht came to my mind was 
some kind thought, woah, I'm gona learn to hack I'm gona be a leet haxor. 
In the case I'm wrong, sorry, and also you might want to know that exec 
doesn't always work some hosts have it turned off for obvious security 
reasons, also there's other alternatives other than exec such as shell_exec 
I think that's the name, etc although that's for Linux which can do a lot of 
the stuff that Windows can also.


- Dan

""adam_99"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Hello!
I'm trying a lot to find how I can run the cmd (command line of windows) 
and send to the cmd commands?
Thanks. 


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



Re: [PHP] Using require instead of redirect architecture

2007-12-19 Thread Dan
""Robert Erbaron"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
1.  p1.php would post to itself.  Do data validation.  After data 
validation

upon error, include p1.php again with included error messages
upon success, redirect to p3.php with congrats.


Yeah, I could do this, but it uses a redirect, and like you said, it's 
gnarly.



2.  p1.php would post to p2. perform data validation.
upon error, save data into session variable, redirect back to 
p1.php,

display error messages inline
upon success, redirect to p3.php, display congrats


I've already got this working, per thread of a couple days ago. But it
uses a redirect.

I personally like the second option.  It is cleaner.  Each page/script 
has a single purpose in life.

 It just makes better sense to my small little mind.


I agree as well. But I'm trying to get away from multiple trips to the
server for simple page calls, per some pundits on the list. :) So I'm
trying to learn a different architecture, and I'm not getting it yet.

--
RE, Chicago


Well, I would tend to agree with Jim, the second suggestion he had is the 
way I've seen this problem done the most.  It works, it's simple and this 
way you have one less PHP file, just enter your data and congratulations. 
The load to the server shouldn't be any different if you did it the way you 
suggested.  Oh, well just my opinion.


- Dan 


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



[PHP] Re: Best way to allow users to post youtube video links ?

2007-12-20 Thread Dan
"Don Don" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
I want to allow people to be able to post links to videos on youtube.  I've 
implemented it in a certain way by allowing them to copy the  tag 
into a textarea and then submit the form.  I pick up the form data, 
validate and display on the site.


Is there any better way to do this or php plugins out there ?

Cheers

Don.



The way I've seen this done is people just ask for the youtube id, which is 
the string at the end of the url like a94cw29rv or whatever.  Then you know 
the rest of the url anyway and you don't have to do any other validation or 
filtering besides only letting alphanumeric through.


- Dan 


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



[PHP] Re: Unix date

2007-12-28 Thread Dan
The problem is indeed time zones, daylight savings time, etc.  Unless your 
two servers are in the same place you can't really make the times the same 
without making them wrong in one place.  The best thing I can think of to do 
is specify a timezone, and daylight savings time value, that way you will 
know what to expect.


You can use the function gmstrtime 
http://us.php.net/manual/en/function.gmstrftime.php to go from time(assumed 
GMT) -> unix


Then when you want to get the time of day use gmdate(), it works like date() 
but gives you the time in GMT, which is what you stored it in so you never 
have to worry about the local time options.


- Dan

"tedd" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Hi gang:

Using:

$unix_in = 1255845600;

echo(date("M d, Y h:i:s a",$unix_in));

On one sever, produces: Oct 18, 2009 02:00:00 am

But on another sever, produces: Oct 18, 2009 12:00:00 am

This difference appears to be a combination of "time-zone" and 
"daylight-savings" considerations. In other words, the function date() 
looks at the server's time (whatever that is set for, right or wrong) and 
uses that for the calculation.


So, what's the best method in keeping things consistent across servers? Is 
there one?


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com 


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



Re: [PHP] Unix date (even more bazaar)

2007-12-28 Thread Dan
"tedd" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Hi gang:

This really bazaar

Here's the code and demo:

http://webbytedd.com/c/unix-time1/index.php

If I cut/paste the following string "as-is" into the "Input Date" portion 
of the form:


10-18-2009 00:00:00

It works and returns a UNIX timestamp of 1255885200

However, if I cut/paste the following string "as-is" into the "Input Date" 
portion of the form:


10-18-2009 00:00:00

It doesn't work and returns a UNIX timestamp of "".

Am I going mad? What the hell is the difference between these two stings?

Arr  I knew this day would come.

tedd


Hi Tedd, next time you could just reply to your origional thread, you can 
change the subject without making  new thread, it's just harder for other 
people to follow.  Anyway, check out my response about storing and reading 
using GMT, it might help you.


- Dan 


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



[PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-28 Thread Dan
""Albert Wiersch"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]


I noticed my script at http://onlinewebcheck.com was sometimes (fairly 
often) failing to open some URLs that users have entered. fopen() returns 
false very quickly, but when tried again with the same URL, sometimes it 
works. What would cause this behavior? Why does fopen() occasionally fail 
to open valid http addresses but works at other times?


--
Albert Wiersch


You really need to filter your input more, have a list of what is acceptable 
not what is unacceptable.  That being, make it a requirement that the url 
input has a TDL(.com, .net, .org, etc.) or is a valid IP(ping it), only 
allow alphanumerics for the name, etc.  When you don't validate your site 
can get hacked, I know it's not really insecure but it's just an example of 
input you may not expect, if you try to validate http://localhost it goes 
ahead and validates your server's html.


- Dan 


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



[PHP] Re: automatic caller

2008-01-02 Thread Dan
""blackwater dev"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
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!


A simple google search for "automated calling" returns a lot of results, 
although most are services which you have to pay to use and they dont' seem 
like you can just call them with text but must have a pre-recorded message. 
Off the top of my head probably the simplest thing would be to just use the 
Skype API and use them for calls.  Since this is just a prototype then there 
probably won't be many calls made on it and it should not be very expensive. 
You would have to combine the skype API though with some kind of text to 
speech software.


- Dan 


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



[PHP] Re: How to secure Flash Video?

2008-01-04 Thread Dan
"tedd" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Hi gang:

Here's the problem.

I have a client who has Flash Videos and wishes to rent these Videos out 
for a certain time period. (No, it's not porn -- shame on you).


I have written the code and have NO problems with registering the user, 
having the user pay, and managing user's time to allow viewing the video. 
That's all been solved.


However, once the user is provided with a url where the Flash Video 
resides, then the user can view the video remotely by just creating a page 
that references that url -- that's easy to do.


Now, how can I stop that from happening?

I have some ideas, but would like to hear what greater minds have to say. 
:-)


Thanks in advance for all replies.

tedd



Tedd, I think your biggest problem is going to be that most browsers cache 
the things they run across, this would include embedded flash videos, 
although it may take a little work 
(http://www.walkernews.net/2007/06/03/where-is-firefox-internet-files-cache-folder/) 
the users could grab the file form their cache.  Second even if you use PHP 
to map to a file eg. somephpfile.PHP?file=dl29coj2jodod which would respond 
by serving a specific file, all you have to do is use Firefox's HTTP Live 
Headers extension which will see the response come back with the actual 
filename since you have to connect to it eventually.


You can fix the caching problem by following one of these suggestions 
http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14743
And as far as the evading the live headers finding the actual file name and 
just directly downloading it I'm not really sure how you would stop that. 
You could have a PHP file open the .swf and read all of it's contents then 
write out the headers and all the data, that way the user would really only 
be talking to the PHP file.


Oh, and there's one more big problem.  What's to stop people from just 
taking the url (mapped or not) once logged in and just going to that 
directly and doing a save as?


Really there's a ton of interesting ways a user could grab the flash movies, 
but maybe rather than just having a .flv player and .flv files which can be 
stolen off your site you might want to build authentication into the flash 
movie itself.  You could do something like serve the customer a unique 
cookie every time they request to watch a movie, then serve them the movie 
and have it check for the cookie.


Although even with all that in place you can still just get a flash 
decompiler and decompile the protected .swf player/video and grab the .flv 
content out of it.


Jesh, this is really a lot harder than I thought.  Oh well, guess there's 
never absolute security.


- Dan 


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



Re: [PHP] image* Functions' Memory Usage

2008-01-04 Thread Dan
"Casey" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On Jan 4, 2008, at 9:54 AM, "Daniel Brown" <[EMAIL PROTECTED]> wrote:


On Jan 4, 2008 12:46 PM, Casey <[EMAIL PROTECTED]> wrote:

Greetings, list.

I have a web application that generates PNG images that are thousands
of pixels high by thousands of pixels wide (using imagepng, etc.).

The problem is this takes way too much memory, and the rest of the
site becomes too slow.

I'm working on something to cache the images, but some suggestions in
the meantime would be great.

Maybe ImageMagick is faster? Flash?Any suggestions? Thank you very 
much.


   It depends on what you are trying to do with the images.  Are you
randomly-generating data to create patterns, or are you (*gasp*)
converting small images into [very pixelized] larger ones?

--
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.


I'm laying many different other (smaller) images over each other at 
various positions. (I know HTML/CSS and SVG could do this with less 
trouble, but that would give away my secrets by just viewing the  source.)


-Casey


Have you considered obscuficated javascript?  It's not very hard to have JS 
add a few images and rotate/move them where ever you want.  Plus there's not 
too many people that could make much sense from clear plain JS anyway. 
Flash is also a good bet.


- Dan 


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



[PHP] Re: How to take video embed codes and change all their widths/heights?

2008-01-17 Thread Dan
"Rob Gould" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Can anytime give me some insights on how to write a PHP script that  could 
accept any of the below strings below and edit the strings to  change 
their width and height settings dynamically?


For instance, if I want all embedded videos to have a width of 320,  and a 
height of 240, using PHP's string manipulation commands, what's  the best 
way to "hone in" on width="425" and change it to  width="320"?  (In all 
cases in each string)




stringtoedit='value="http://www.youtube.com/v/B1O2jcfOylU&rel=1";>name="wmode" value="transparent">src="http://www.youtube.com/v/B1O2jcfOylU&rel=1 " 
type="application/x-shockwave-flash" wmode="transparent" width="425" 
height="355">';


stringtoedit='value="http://www2.funnyordie.com/public/flash/fodplayer.swf " />name="flashvars" value="key=5468" />value="true" />allowfullscreen="true" quality="high" 
src="http://www2.funnyordie.com/public/flash/fodplayer.swf " 
type="application/x-shockwave-flash">href="http://www.funnyordie.com/videos/5468";>Cars on href="http://www.funnyordie.com ">FunnyOrDie.com';


If you only have those two types that you need to imbed then it might be 
easier to make a function EmbedYoutubeCode( 'B1O2jcfOylU' ) since the only 
thing that changes is the ID number near the end of the url, your function 
could just spit out


function EmbedYoutubeCode( MovieID: String): String;
{
'object width="425" height="355">value="http://www.youtube.com/v/' + MovieID + '&rel=1">name="wmode" value="transparent">src="http://www.youtube.com/v/' + MovieID + '&rel=1" 
type="application/x-shockwave-flash" wmode="transparent" width="425" 
height="355">';

}

Basiclly you just give it the ID, and it would spit back out the embed code, 
it also makes for safer code since you coudl also check to make sure that 
there was no urls or other junk so it's harder to get hacked.


Oh, and sorry about half of that function being written in Pascal, I've been 
working with it all morning.


- Dan 


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



Re: [PHP] changing the ini from a file

2008-01-17 Thread Dan
""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On Jan 16, 2008 12:02 PM, Jim Lucas <[EMAIL PROTECTED]> wrote:


Jim Lucas wrote:
> Wolf wrote:
>> I'm using .htaccess to do
>> php_value auto_prepend_file "auth.php"
>>
>> The problem is that there are very specific files that I want to be
>> able to NOT run that in.  I guess I could just move them to a
>> directory and use .htaccess to perform a php_value auto_prepend_file 
>> ""

>>
>> But I was hoping to not have to make a separate folder for that.
>> Anyone encoutered being able to change/disable the  setting on the fly
>> in a specific file?
>>
>> Thanks!
>>
>> Wolf
>>
>
> Just had an interesting way of solving this problem come to mind.
>
> I would like others to way in on this.
>
> You can do this completely from within apache.
>
> For the pages that you want to have auth.php included with, give them
> and extension of .phtml or something else...
>
> Then, configure apache to allow php to process those like this
>
> AddType application/x-httpd-php .php
> AddType application/x-httpd-php .phtml
>
> then in apache, could be in httpd.conf or .htaccess have something like
> this.
>
>
> 
> php_value auto_prepend_file "auth.php"
> 
>
> When finished, restart apache and you should be good to go.
>
> I would try something like this.  Should work, others might have better
> ideas.
>
Now that I am looking at this a second time.  Couldn't all this apache
stuff be done in the .htaccess file?

Just place all the following in a .htaccess file, then change the
extension on the file(s) that you want to have work this way.  I don't
think you need to touch the httpd.conf file at all.


AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml


 php_value auto_prepend_file "auth.php"



   Then all of the links or includes would have to be updated to
handle the .phtml extension change, too.  Good idea, but it sounds to
be like what he's asking unfortunately just isn't possible without
some form of major overhaul.

--




Well, at least it will be usefull next time someone does a project in which 
they want to auto-add a header, or some authorization code. 


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



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

2008-01-21 Thread Dan
""blackwater dev"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
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!



Couldn't you just use PHP to rewrite the 200k row text file from just text, 
to actual insert commands?  Once you have that, most mysql interfaces have 
an import ability where you can give it a file which is a list of commands 
(insert, update, etc.) and it will run them itself.  That should be much 
faster.


- Dan 


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



Re: [PHP] Resetting drop-downlists in input-fields for texts

2008-01-21 Thread Dan
""David Giragosian"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On 1/21/08, Tor Vidvei <[EMAIL PROTECTED]> wrote:


I'm developing a traning page for basic math.  The answers are entered by
the user in simple text input fields and the same page is returned (after
having been processed by php) to the user with indications of correctness
or error on each answer.  If the AutoComplete feature is turned on a
droplist with previous entries are displayed in the answer fields, even 
if
new exercises are generated.  This is quite distracting.  Is there any 
way

I can block this feature from my php-code, even if it is turned on in the
users browser?

Tor

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



I think this HTML is IE specific,


...


Not sure if you can do it on a tag by tag basis or not, nor what versions 
it

might be limited by.

David



This is only if you are using IE's autocomplete, I believe google and a ton 
of third party toolbars have auto complete/ form auto fill in features.


- Dan 


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



[PHP] Re: open a secondary window/tab in the browser from php

2008-02-18 Thread Dan
"julian" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]



Hi,

I have an application that along  filling in some forms, it produces a pdf 
file, as confirmation of all entered data.


I want to send this pdf file to a different window/tab of the browser, so 
it is displayed and can latter be printed.


In the mean time, the original window contains a confirmation message, to 
continue with the work flow.


I would like to do this without use of JavaScript

Any combination of headers ??

Any hints appreciated.

JCG


Later on, give the user a link that says Open as PDF. 


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



[PHP] Re: Fwrite Function

2008-02-18 Thread Dan
If that's really your code then your script is going to get abused in no 
time.
It's important to sanatize any user input before just writing it to a file. 


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



[PHP] PHP To an EXE Executable for Win32 ( Is it possible)

2008-02-21 Thread Dan
I know that there's apparently some way to compile PHP to make it run 
faster.  But has anyone come up with a system to turn PHP scripts into an 
.exe?  What I mean is you would run the exe and see exactly the same thing 
as if you were viewing the script through a webbrowser, but without having 
to install php.


What is the name of this?

- Dan 


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



[PHP] Re: Newbie ' If Statement' Question

2008-03-19 Thread Dan
heredoc is probably the best way to go.  There's no way you can mess up your 
quotes, and you don't have to worry about escaping.  Altough I wonder what 
would happen if you put ?> in a heredoc, would it stop processing the php, 
thinking that it was the end of the php file, or would it just treat it as a 
string still?


- Dan

"Al" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Here's how I'd do it.

$row= $emp_row->getRecordId();//Or, you can put this inside the heredoc 
with {}


//heredoc
$str= <<





txt;

if (!empty($emp_row->getField('testfield')) print $str;
else print "Non Print";
?>


[EMAIL PROTECTED] wrote:

Hello Folks,

I would like to be able to wrap a 'form' inside a php 'if statement' - 
so

that the form will appear if the 'if condition' is met.

-  most likely I cannot have a - now I get the error - Parse error: syntax error, unexpected T_STRING 
in...


Q:  What is the best way to accomplish this goal?


---

getField('testfield') !="") {
print "





";}else {print "Non Print";} ?>
--
Thanks - RevDave
Cool7 @ hosting4days . com
[db-lists]




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



[PHP] MCrypt not decrypting simple text

2008-03-20 Thread Dan
I'm using MCrypt and I have two very simple functions.  All I'm doing is 
giving the function some text and a password, it encrypts the text and saves 
it as a text file on the server.  Then I at some later time run another php 
file which decrypts using the decrypt function given the text and the SAME 
password as the first time and all I get is garbage.  What am I doing wrong? 
What do I need to change so that I can get this to work the way I described?


function aes_128_encrypt($text,$password) {

  $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
   $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);

   $text .= chr(3).chr(3).chr(3);

   return bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $password, $text, 
MCRYPT_MODE_ECB, $iv));


} // End of function

and

function aes_128_decrypt($encrypted_text,$password) {

   $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
   $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);

   return mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $password, pack("H*", 
$encrypted_text), MCRYPT_MODE_ECB, $iv);


} // End of function


- Dan 



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



[PHP] Re: MCrypt not decrypting simple text

2008-03-21 Thread Dan
Ok, looks like I'm not getting much intrest here, can anyone recomend which 
newsgroup I should post this under?  Is there a crypto group or anything of 
the like?:


- Dan

""Dan"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
I'm using MCrypt and I have two very simple functions.  All I'm doing is 
giving the function some text and a password, it encrypts the text and 
saves it as a text file on the server.  Then I at some later time run 
another php file which decrypts using the decrypt function given the text 
and the SAME password as the first time and all I get is garbage.  What am 
I doing wrong? What do I need to change so that I can get this to work the 
way I described?


function aes_128_encrypt($text,$password) {

  $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
   $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);

   $text .= chr(3).chr(3).chr(3);

   return bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $password, 
$text, MCRYPT_MODE_ECB, $iv));


} // End of function

and

function aes_128_decrypt($encrypted_text,$password) {

   $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
   $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);

   return mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $password, pack("H*", 
$encrypted_text), MCRYPT_MODE_ECB, $iv);


} // End of function


- Dan 



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



[PHP] Re: Stored Procedure Question

2008-03-24 Thread Dan
I'm not sure that it can be done.  I've never heard of anyone doing it 
before.  Why don't you just call the PHP script from your C++ program after 
you call the stored proc?


- Dan

<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

I am very aware most of you do not use a stored procedure in mysql.

However with my latest C++ programming I have created a few that make life 
a dream.


The issue I am having. When I call the stored procedure I would like the 
end of the procedure to call or invoke a php script.


I have read many MySQL Stored Procedure documents, nothing as of yet that 
describes what the best practic syntax or structure of a php script call.





"Reality is a delusion brought on by alcohol deficiency $1000"
"Fixing the GUI between the chair and the keyboard Priceless" 



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



Re: [PHP] Requested PHP apps / sites

2008-04-10 Thread Dan
That would be a pretty interesting app to make.  If you actually followed 
Osborn's Brainstorming technique then you should be able to develop a pretty 
cool real-time think tank where developers work in a sort of chat room but 
with a place to post common code, with markup, share a virtual whiteboard, 
etc.


Could be cool.

- Dan



   Oh, what you're looking for is a think tank.  I'd been trying to
find people in my area to get together and do the same thing.  No such
luck around here, but you may have luck in your local area.  Working
offline with people, when you can bounce ideas off of one-another
while doing something else, gets the creative juices flowing more,
because you're not focused on saying, "okay, we need to come up with
an idea."

--

Ask me about:
Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
and shared hosting starting @ $2.50/mo.
Unmanaged, managed, and fully-managed! 



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



[PHP] Re: Choosing PHP or ? for building an automatic photo web.

2008-06-08 Thread Dan
To answer your question peter, yes.  This is exactly the type of thing that 
PHP will work for.


Password protection is a very common feature, you can implement it either 
using PHP, or with htaccess, I recomend the ladder just because there's a 
standard simple way to do it (assuming your host lets you, most do).


You don't really have to create a new tab each time you upload a new set of 
photos, PHP will build the tabs on the fly as you access the page.  You 
might benifit from reading a simple php intro, because it sounds like you 
want to create the html using php, rather than just go to mygallery.php or 
something, and have php build the thing on the fly.


- Dan 



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



[PHP] Calling an executable for processing some data sent from PHP

2007-06-15 Thread Dan
Ok, so I have a PHP script, and I also have a program written in Pascal, 
it's compiled in the native executable for whatever OS the server is 
running.


I want to have the user input info and then send that info to the Pascal 
program to call a function and send the info as parameters.


Is there any sort of server side call I can do to do this?  Or is my only 
option making some sort of connection such as SOAP between PHP and the 
Program? 


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



Re: [PHP] Calling an executable for processing some data sent from PHP

2007-06-15 Thread Dan
Will that script also work on Apache in Windows?  OS X?  Just checking 
because the backend and front end both need to be able to be installed on 
any OS.


Also I looked at exec(), system(), and passthru(); they all let you execute 
a executable file but I don't see any way of passing parameters in any of 
those functions, can you do that?


- Daniel

""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On 6/15/07, Dan <[EMAIL PROTECTED]> wrote:

Ok, so I have a PHP script, and I also have a program written in Pascal,
it's compiled in the native executable for whatever OS the server is
running.

I want to have the user input info and then send that info to the Pascal
program to call a function and send the info as parameters.

Is there any sort of server side call I can do to do this?  Or is my only
option making some sort of connection such as SOAP between PHP and the
Program?

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




   RTFM for exec(), system(), passthru(), et cetera.




--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107 


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



Re: [PHP] Calling an executable for processing some data sent from PHP

2007-06-15 Thread Dan
Wow, thanks for the code and the fast response! :)  Although maybe I should 
clarify my probem a bit more, I'm trying to run a program, but I want it to 
stay open so that I can call functions later.


When the user "opens" a file, it's uploaded to a folder where PHP can access 
it, then PHP would call the Pascal program which would parse the file, and 
create a new object for that data, which later functions would access and do 
computation on.  Like a user woud click Compute Subsets and that would 
somehow trigger the function Compute_Subsets on that object.  Any way I 
could do something like this?


My ugly way to do it would be to do an exec() to call an executable to parse 
the file and make an object of it then run the function that I needed to 
every time a function was called.  The code base for this would be horrible 
to maintain and incredibly slow.


Is there some way I could keep the program open and give it further 
arguments?
""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On 6/15/07, Dan <[EMAIL PROTECTED]> wrote:

Will that script also work on Apache in Windows?  OS X?  Just checking
because the backend and front end both need to be able to be installed on
any OS.

Also I looked at exec(), system(), and passthru(); they all let you 
execute

a executable file but I don't see any way of passing parameters in any of
those functions, can you do that?

- Daniel

""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On 6/15/07, Dan <[EMAIL PROTECTED]> wrote:
>> Ok, so I have a PHP script, and I also have a program written in 
>> Pascal,

>> it's compiled in the native executable for whatever OS the server is
>> running.
>>
>> I want to have the user input info and then send that info to the 
>> Pascal

>> program to call a function and send the info as parameters.
>>
>> Is there any sort of server side call I can do to do this?  Or is my 
>> only

>> option making some sort of connection such as SOAP between PHP and the
>> Program?
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>RTFM for exec(), system(), passthru(), et cetera.
>
> exec('pascal-file '.$_POST['user_command'],$ret);
>$ret == 1 ? 'Error detected' ? '';
> ?>
>
>
> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107

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




   Yeah, the first parameter of each function, where you call the
executable directly, just has to include the parameters you want to
pass to the binary.

   For example, if you wanted to do the following:
   netstat -pnt
   ls -al|grep -i php
   mv file1.php backups/file2.php

   You would (respectively) simply do the following:
   exec('netstat -pnt',$ret);
   exec('ls -al|grep -i php',$ret);
   exec('mv file1.php backups/file2.php',$ret);

   Then just eval $ret to see if it was successful (0) or not (1).

   If you wanted to allow a user to specify parameters, it would be
done like so:

[PHP]
   L> File: form.php
   exec('/path/to/pascal-binary 
'.escapeshellarg($_POST['parameters']),$ret);

   $ret == 0 ? "Success!" : "Failure!";
   exit;
}
?>

   Parameters: 
   


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107 


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



[PHP] Calling Pascal code/functions from PHP

2007-06-15 Thread Dan
I know for some languages there is a way to call code from another language. 
For example you can call C funcitons from Pascal, etc.  Is there any way I 
can call Pascal functions/code from PHP? 


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



Re: [PHP] Calling an executable for processing some data sent from PHP

2007-06-15 Thread Dan
Thanks for your help.  Since it's a Delphi program and Delphi has the 
ability to build ISAPI applications I'm going to try and see if I can't turn 
my app into an ISAPI and run that since it has all the functionality I need 
and it'll run fast.  But if that doesn't work out I'll try the solutions 
suggested.  Yes daemonizing it would probably work too.


- Daniel


""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On 6/15/07, Dan <[EMAIL PROTECTED]> wrote:
Wow, thanks for the code and the fast response! :)  Although maybe I 
should
clarify my probem a bit more, I'm trying to run a program, but I want it 
to

stay open so that I can call functions later.

When the user "opens" a file, it's uploaded to a folder where PHP can 
access
it, then PHP would call the Pascal program which would parse the file, 
and
create a new object for that data, which later functions would access and 
do

computation on.  Like a user woud click Compute Subsets and that would
somehow trigger the function Compute_Subsets on that object.  Any way I
could do something like this?

My ugly way to do it would be to do an exec() to call an executable to 
parse

the file and make an object of it then run the function that I needed to
every time a function was called.  The code base for this would be 
horrible

to maintain and incredibly slow.

Is there some way I could keep the program open and give it further
arguments?
""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On 6/15/07, Dan <[EMAIL PROTECTED]> wrote:
>> Will that script also work on Apache in Windows?  OS X?  Just checking
>> because the backend and front end both need to be able to be installed 
>> on

>> any OS.
>>
>> Also I looked at exec(), system(), and passthru(); they all let you
>> execute
>> a executable file but I don't see any way of passing parameters in any 
>> of

>> those functions, can you do that?
>>
>> - Daniel
>>
>> ""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>> > On 6/15/07, Dan <[EMAIL PROTECTED]> wrote:
>> >> Ok, so I have a PHP script, and I also have a program written in
>> >> Pascal,
>> >> it's compiled in the native executable for whatever OS the server 
>> >> is

>> >> running.
>> >>
>> >> I want to have the user input info and then send that info to the
>> >> Pascal
>> >> program to call a function and send the info as parameters.
>> >>
>> >> Is there any sort of server side call I can do to do this?  Or is 
>> >> my

>> >> only
>> >> option making some sort of connection such as SOAP between PHP and 
>> >> the

>> >> Program?
>> >>
>> >> --
>> >> PHP General Mailing List (http://www.php.net/)
>> >> To unsubscribe, visit: http://www.php.net/unsub.php
>> >>
>> >>
>> >
>> >RTFM for exec(), system(), passthru(), et cetera.
>> >
>> > > >exec('pascal-file '.$_POST['user_command'],$ret);
>> >$ret == 1 ? 'Error detected' ? '';
>> > ?>
>> >
>> >
>> > --
>> > Daniel P. Brown
>> > [office] (570-) 587-7080 Ext. 272
>> > [mobile] (570-) 766-8107
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>Yeah, the first parameter of each function, where you call the
> executable directly, just has to include the parameters you want to
> pass to the binary.
>
>For example, if you wanted to do the following:
>netstat -pnt
>ls -al|grep -i php
>mv file1.php backups/file2.php
>
>You would (respectively) simply do the following:
>exec('netstat -pnt',$ret);
>exec('ls -al|grep -i php',$ret);
>exec('mv file1.php backups/file2.php',$ret);
>
>Then just eval $ret to see if it was successful (0) or not (1).
>
>If you wanted to allow a user to specify parameters, it would be
> done like so:
>
> [PHP]
>L> File: form.php
>  if($_POST['parameters']) {
>exec('/path/to/pascal-binary
> '.escapeshellarg($_POST['parameters']),$ret);
>$ret == 0 ? "Success!" : "Failure!";
>exit;
> }
> ?>
> 
>Parameters: 
>
> 
>
> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107

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




   If you can run the executable as a server, you could daemonize it
&1',$ret); ?>

    and then connect to it using sockets but I'm not
completely certain that I'm understanding your needs properly.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107 


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



Re: [PHP] Calling Pascal code/functions from PHP

2007-06-15 Thread Dan
Right now the program isn't a dll it's a desktop application written in 
Delphi, but when I take the visual components out it will be Pascal, so I 
could compile it ot a dll.  I want to emulate the same functionality the 
desktop application had, thus when the user uploads a file, the Pascal call 
would parse then create an object of the data, that I could later access 
when the user specifies a computation to do on the data.  So it sort of 
needs to run in the background be always on, etc.  I need to be able to call 
individual functions, get repsonses, etc.


""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On 6/15/07, Tijnema <[EMAIL PROTECTED]> wrote:

On 6/15/07, Dan <[EMAIL PROTECTED]> wrote:
> I know for some languages there is a way to call code from another 
> language.
> For example you can call C funcitons from Pascal, etc.  Is there any 
> way I

> can call Pascal functions/code from PHP?
>

Compile the pascal code as an executable, and call it with 
exec/system/...

Or, I don't know if it's possible, you might be able to compile the
pascal code as an extension, but that's hard stuff :P

Tijnema

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




   Are you compiling the Pascal binary as a shared object or dynamic
link library, or is it a function within an executable that you're
trying to create a hook to?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107 



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



[PHP] Re: Extract specific div element from page

2007-06-15 Thread Dan
Or you could just use Javascript combined with PHP, just use javascript it's 
something like this document.getElementById('tagId').innerHtml that will 
give you the html(contents) of the  tag you specify.  Then just do 
something like document.form.value = 
document.getElementById('tagId').innerHtml.  Basicly you're setting a hidden 
form element to have the value of the div, then when you submit the page, 
you have the content as $_POST['formYouSetTo'].  You could have the JS 
execute on the submit button's onclick.


It should be relatively easy if you look up the exact syntax of the 
javascript.


- Daniel

""Anthony Hiscox"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Hey folks,

I need to pull the contents inside of a specific div out of a page, and
write it to a separate file. In this instance I am taking everything 
inside

of  tags from a wordpress blog, this will give me
only the content and not the menus, or other stuff. I need to do this
because the final document will be converted for viewing on a palm pilot.

Is anyone aware of a simple solution to this problem, short of parsing the
entire page and starting when I hit that div opening tag, and stopping 
when

I hit the closing tag? One problem I can see with this method is that I
would have to count divs inside of that div, otherwise I would end too 
early

on.

Any advice would be greatly appreciated.

Peace and Love,
distatica.

--
-
Anthony Hiscox

Video Watch Group
Public Site Currently Under Development
Group Members Site Fully Operational
-



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



Re: [PHP] Creating 'Previous - Next Buttons' Logic - Novice Question

2007-06-15 Thread Dan


""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

On 6/15/07, revDAVE <[EMAIL PROTECTED]> wrote:
Novice Question: I would like to create a set of pages that could use 
some
kind of logic to have "previous - next buttons "so that when the button 
was
clicked it would automatically go to the next page - or the previous 
page.


I know very little about PHP ...  however, I am hoping that there is some
kind of preset " open source" php code that I might be able to use.

I can envision something like this:

- An 'include page' that might store an array of the list of pages such 
as:



start array...

pos1 = page1.htm
pos2 = page17.htm
pos3 = page5.htm
etc.

stop array...

- then  a variable could be set for the current page such as:


thispage = 2  - Place on the array equals position 2 (page17.htm)


then the next button would  add 1 to the current place on the array- 
(pos3)



-  and the previous button would be minus 1 place on the array - (pos1)

... that type of thing

Q:  Is there any "open source" code template that I can check out like 
this?





--
Thanks - RevDave
[EMAIL PROTECTED]
[db-lists]

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




There are several ways to do this, but here's one way:

<< Previous\n";
}

if($i != (count($page) - 1)) {
   echo "Next >>\n";
}

include('page'.$i.'.htm');
?>

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107



Totally would work for his purposes but let's clean it up a bit for a 
beginner.


$page = array('page1.htm','page17.htm','page5.htm'); // array of the pages 
you have


if(isset($_GET['page_num'])) // a current page number has been set in the 
url

{
$i = $_GET['page_num'];  // set variable i to the current page number
   if($i  != (count($i)-1))  // if the current page number isnt the last 
entry in the array display next

   echo "Next >>\n";
   if($i != 0)  // if the current page isn't the first page display 
previous

   echo "<< Previous\n";
}
include('page'.$i.'.htm');  // show the current page you're at
?>

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



  1   2   3   4   5   6   7   8   9   10   >