Re: [PHP] while question

2008-11-17 Thread Micah Gersten
Jay Blanchard wrote:
> [snip]
> ...foreach...
> [/snip]
>
> You could also use a for loop if you wanted to count;
>
> for($i = 0; $i < count($array); $i++){
>echo $i . "\n";
> }
>
>
>   

This is not good because you are calling count every loop iteration.

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




-- 
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-18 Thread Micah Gersten
Ashley Sheridan wrote:
> On Tue, 2008-11-18 at 23:51 +, Richard Heyes wrote:
>   
>>> Yeah, but it will mean that there will still be about 3 different
>>> rendering versions of IE out there by the time it comes out; 7, 8 and 9
>>> (I'm fairly sure 6 will have gone to that good ol' web in the sky by
>>> that time)
>>>   
>> Sure, but depending on how closely it follows WebKit, could make
>> testing on IE9, Safari and Chrome a breeze.
>>
>> -- 
>> Richard Heyes
> Don't forget Konqueror in that list ;) It's not exactly the same engine
> after Apple forked it from KHTML, but it's quite close, and both
> Konqueror and Safari are said to be working a little more closely than
> before to share the work done to the rendering engines since the fork.
>
> I'm waiting for the day when Firefox starts using Google's V8 scripting
> engine!
>
>
> Ash
>   

I'd rather all the engines follow the W3C standards so that you just
have to make sure your web page is compliant.

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



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



Re: [PHP] array/iteration issue!!

2008-11-27 Thread Micah Gersten
Robert Cummings wrote:
> On Thu, 2008-11-27 at 19:36 -0800, bruce wrote:
>   
>> hey robert!!
>>
>> thanks. and yeah, you're right, it's not the best.. so tell me, given that
>> i'm ripping through this on the fly, and i can have the structure in any way
>> i choose. this is just to simulate/populate some test tbls.. what's a better
>> way to create an array structure to have a collegename, followed by some
>> deptnames, followed by some classnames for the depts...
>>
>> perhaps something like this??
>>
>> $a = array
>> (
>> "college" => "foo",
>> array
>> (
>> "dept"  => "physics",
>> "class" => array
>> (
>> "class1" => "sss",
>> "class2" => "sffgg"
>> )
>> ),
>> array
>> (
>> "dept"  => "english",
>> "class" => array
>> (
>> "class1" => "sss",
>> "class2" => "sffgg"
>> )
>> )
>> );
>> 
>
> Not quite. The following is probably what you want:
>
> 
> $colleges = array
> (
> array
> (
> 'name'  => 'Blah Blah University',
> 'depts' => array
> (
> array
> (
> 'name'=> 'physics',
> 'classes' => array
> (
> 'sss',
> 'sffgg',
> ),
> ),
> array
> (
> 'name'=> 'english',
> 'classes' => array
> (
> 'sss',
> 'sffgg',
> ),
> ),
> ),
> ),
> array
> (
> 'name'  => 'Glah Gleh University',
> 'depts' => array
> (
> array
> (
> 'name'=> 'physics',
> 'classes' => array
> (
> 'sss',
> 'sffgg',
> ),
> ),
> array
> (
> 'name'=> 'english',
> 'classes' => array
> (
> 'sss',
> 'sffgg',
> ),
> ),
> ),
> ),
> );
>
> foreach( $colleges as $college )
> {
> $collegeName = $college['name'];
> foreach( $college['depts'] as $dept )
> {
> $deptName = $dept['name'];
> foreach( $dept['classes'] as $className )
> {
> echo "$collegeName, $deptName, $className\n";
> }
> }
> }
>
> ?>
>
> Cheers,
> Rob.
>   
This is actually a much smaller data structure.

$colleges = array
(
'Blah Blah University' =>
array
(
'physics' => array
(
'sss',
'sffgg',
),
'english' => array
(
'sss',
'sffgg',
)
),
'Glah Gleh University' =>
array
(
'physics' => array
(
'sss',
'sffgg',
),
'english' => array
(
'sss',
'sffgg',
),
)
 );


foreach( $colleges as $collegeName => $depts )
{
 foreach( $depts as $deptName => $classes)
{
foreach( $classes as $className )
{
echo "$collegeName, $deptName, $className\n";
}
}
}


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





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



Re: [PHP] question about corrupt db?

2008-12-01 Thread Micah Gersten
Terion Miller wrote:
> could a corrupt db make php pages stop functioning?
> My pages no longer go anywhere, I went back found the original scripts and
> still it didn't fix the problem (thought I had messed the code up) so it has
> to be something external of the code its doing this locally on my box and on
> the live server.
>
> thanks
> terion
>
>   
Have you checked the PHP error logs?

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



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



Re: [PHP] Objects and Arrays Conversion

2008-12-02 Thread Micah Gersten
VamVan wrote:
> Hello All,
>
> I was stuck with this issue. So just felt the need to reach out to other
> strugglers.
> May be people might enjoy this:
>
> Here is the code for object to array and array to object conversion:
>
> function object_2_array($data)
> {
> if(is_array($data) || is_object($data))
> {
> $result = array();
> foreach ($data as $key => $value)
> {
> $result[$key] = object_2_array($value);
> }
> return $result;
> }
> return $data;
> }
>
> function array_2_object($array) {
>  $object = new stdClass();
>  if (is_array($array) && count($array) > 0) {
> foreach ($array as $name=>$value) {
>$name = strtolower(trim($name));
>if (!empty($name)) {
>   $object->$name = $value;
>}
> }
>  }
>  return $object;
> }
>
> have fun !
>
> Thanks
>
>   
This page at the bottom describes your array_2_object function as a
simple typecast:
http://us2.php.net/manual/en/language.types.object.php
$object = (object) $array;

As for the object to array, the same thing applies:
http://us2.php.net/manual/en/language.types.array.php

$array = (array) $object;

Not sure if these are PHP 5 only or not.

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



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



Re: [PHP] A MySQL Question

2008-12-08 Thread Micah Gersten
Robert Cummings wrote:
> On Tue, 2008-12-09 at 00:16 +, Nathan Rixham wrote:
>   
>> Ashley Sheridan wrote:
>> 
>>> On Mon, 2008-12-08 at 23:23 +, [EMAIL PROTECTED] wrote:
>>>   
>>>> Presumable, the EXISTS sub-query can be optimized sometimes to just stop 
>>>> processing the sub-query and kick things back out to the outer query.
>>>>
>>>>
>>>>
>>>> IN has to process them all and find them all.
>>>>
>>>>
>>>>
>>>> 
>>> Don't forget the special case use as well:
>>>
>>> IF NOT EXISTS `universe` THEN bigbang()
>>>
>>>
>>> Ash
>>> www.ashleysheridan.co.uk
>>>
>>>   
>> any chance of writing the implementation of that bigbang() function?
>> 
>
> If nothing exists and a universe is created via a big bang... does it
> make a sound? Can we realistically call it a big bang if it doesn't make
> a sound? Couldn't we call it the big light show? But then again... if
> nothing exists and a universe is created via a big light show... does it
> matter? Can it be perceived? Is this just a proverbial pandrödinger's
> box? You can't implement the bigbang() function if you don't exist.
>
> Cheers,
> Rob.
>   
The function doesn't say who's doing the creating, it just checks for
the existence of the universe.

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



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



Re: [PHP] A MySQL Question

2008-12-08 Thread Micah Gersten
Robert Cummings wrote:
> On Mon, 2008-12-08 at 19:46 -0600, Micah Gersten wrote:
>   
>> Robert Cummings wrote:
>> 
>>> On Tue, 2008-12-09 at 00:16 +, Nathan Rixham wrote:
>>>   
>>>   
>>>> Ashley Sheridan wrote:
>>>> 
>>>> 
>>>>> On Mon, 2008-12-08 at 23:23 +, [EMAIL PROTECTED] wrote:
>>>>>   
>>>>>   
>>>>>> Presumable, the EXISTS sub-query can be optimized sometimes to just stop 
>>>>>> processing the sub-query and kick things back out to the outer query.
>>>>>>
>>>>>>
>>>>>>
>>>>>> IN has to process them all and find them all.
>>>>>>
>>>>>>
>>>>>>
>>>>>> 
>>>>>> 
>>>>> Don't forget the special case use as well:
>>>>>
>>>>> IF NOT EXISTS `universe` THEN bigbang()
>>>>>
>>>>>
>>>>> Ash
>>>>> www.ashleysheridan.co.uk
>>>>>
>>>>>   
>>>>>   
>>>> any chance of writing the implementation of that bigbang() function?
>>>> 
>>>> 
>>> If nothing exists and a universe is created via a big bang... does it
>>> make a sound? Can we realistically call it a big bang if it doesn't make
>>> a sound? Couldn't we call it the big light show? But then again... if
>>> nothing exists and a universe is created via a big light show... does it
>>> matter? Can it be perceived? Is this just a proverbial pandrödinger's
>>> box? You can't implement the bigbang() function if you don't exist.
>>>
>>> Cheers,
>>> Rob.
>>>   
>>>   
>> The function doesn't say who's doing the creating, it just checks for
>> the existence of the universe.
>> 
>
> How do you know? Are you... God?
>
> ;)
>
> Cheers,
> Rob.
>   

Sorry, term foul-up.  I meant the statement doesn't say who's doing the
creating, it just checks for existence of the universe.

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





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



Re: [PHP] A MySQL Question

2008-12-08 Thread Micah Gersten
German Geek wrote:
> On Tue, Dec 9, 2008 at 2:46 PM, Micah Gersten <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Robert Cummings wrote:
> > On Tue, 2008-12-09 at 00:16 +, Nathan Rixham wrote:
> >
> >> Ashley Sheridan wrote:
> >>
> >>> On Mon, 2008-12-08 at 23:23 +, [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]> wrote:
> >>>
> >>>> Presumable, the EXISTS sub-query can be optimized sometimes
> to just stop processing the sub-query and kick things back out to
> the outer query.
> >>>>
> >>>>
> >>>>
> >>>> IN has to process them all and find them all.
> >>>>
> >>>>
> >>>>
> >>>>
> >>> Don't forget the special case use as well:
> >>>
> >>> IF NOT EXISTS `universe` THEN bigbang()
> >>>
> >>>
> >>> Ash
> >>> www.ashleysheridan.co.uk <http://www.ashleysheridan.co.uk>
> >>>
> >>>
> >> any chance of writing the implementation of that bigbang()
> function?
> >>
> >
> > If nothing exists and a universe is created via a big bang...
> does it
> > make a sound? Can we realistically call it a big bang if it
> doesn't make
> > a sound? Couldn't we call it the big light show? But then
> again... if
> > nothing exists and a universe is created via a big light show...
> does it
> > matter? Can it be perceived? Is this just a proverbial
> pandrödinger's
> > box? You can't implement the bigbang() function if you don't exist.
> >
> > Cheers,
> > Rob.
> >
> The function doesn't say who's doing the creating, it just checks for
> the existence of the universe.
>
> Lol, I agree, the function bigbang() doesn't need to be implemented
> (or it could be empty if it needs to be there for this line to work),
> because by definition, the universe must exist, if this statement is
> to exist.
Who says this statement is run in this universe?  Who says it's not for
a simulator?
>
> Guys, I think this is taking it a bit far...

You new here? ;)

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



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



Re: [PHP] Dates and Mysql

2008-12-10 Thread Micah Gersten

VamVan wrote:
> Hello Gang,
>
> I have a Mysql table which has timestamp for the date the record was
> created.
>
> I was wondering how is it possible for me to query the table to retrieve all
> the records that are one week less than the time stamp?
>
> Thanks,
> V
>
>   
I'm assuming you meant get records one week less than the current system
timestamp.

date('Y-m-d G:i:s', strtotime('1 week ago'));

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




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



Re: [PHP] Re: Foreign Keys Question

2008-12-11 Thread Micah Gersten
Colin Guthrie wrote:
> The ON DELETE CASCADE option is key here... "DELETE FROM students
> where student_id=1" will remove all traces of that student from the
> db... all the course they've attended, all the instructors who have
> taught them etc. keeps things nice and tidy without having to put the
> structure in your code all over the place.
>
> Col
>
Why would you want to delete the instructors when deleting the student?

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



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



Re: [PHP] Good PHP book?

2008-12-15 Thread Micah Gersten
O'reillys Learning PHP 5:
http://oreilly.com/catalog/9780596005603/index.html

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



jeffery harris wrote:
> Hi guys/gals. I'm a first time user. Does anyone know of a good php book? 
>
>
>
>   

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



Re: [PHP] runtime access to static variable

2008-12-16 Thread Micah Gersten
Jack Bates wrote:
> How do I access a static variable when I do not know the name of the
> class until runtime?
>
> I have the following example PHP:
>
> ket% cat test.php 
> 
> class Test
> {
>   public static
> $STEPS = array(
>   'foo',
>   'bar');
> }
>
> $className = 'Test';
>
> var_dump($className::$STEPS);
> ket% 
>
> Unfortunately when I run it I get:
>
> ket% php test.php 
>
> Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
> in /home/jablko/trash/test.php on line 13
> ket% 
>
> I can call a static function using call_user_func(array($className,
> 'functionName')), and I can access a class constant using
> constant($className.'::CONSTANT_NAME'). How do I access a static
> variable?
>
>
>   

Check this out:
http://us2.php.net/manual/en/language.oop5.static.php

It actually won't work until 5.3.0 when they add late static binding.

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




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



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



Re: [PHP] Phpmyadmin password

2008-12-16 Thread Micah Gersten
It flance wrote:
> Hi,
>
> I lost phpmyadmin password. Is there anyway to recover it?
>
> Thank you
>
>   

PHPMyAdmin uses MySQL's internal authentication.  Log into your MySQL
server and reset your password.

http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

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



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



Re: [PHP] system() Question

2008-12-28 Thread Micah Gersten
Nathan Nobbe wrote:
> good point dan, and just to add further clarification, thats b/c the
> function specifies $return_var is passed by reference in the formal
> parameter.  when you include the & along w/ an actual parameter (during
> function invocation) thats referred to as call-time-pass-by-reference in
> php, and its typically frowned upon.  in fact, i think its being removed
> from a future version of php.
>
> -nathan
>
>   
You don't call system using the ampersand.  The reference is declared in
the function definition.  There's no reason for this to be frowned
upon.   What you are referring to is the old PHP4 style of explicit
pass-by-reference in function usage which is frowned upon.

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


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



Re: [PHP] PHP telnet server

2008-12-31 Thread Micah Gersten
Luke Slater wrote:
> Hi everyone,
>
> I'm trying to rewrite an old MUD in PHP; the reasons for this are that
> the original is written in C and most files in the codebase run over
> 2000 lines with at least 20 of them, which makes it very hard to
> change anything.
>
> Plus, the web interface is also written in C, and needless to say
> that's just nasty!
>
> So I was looking at sockets in PHP, and thinking about the semantics
> of it all.
>
> I was looking at this article:
>
> http://devzone.zend.com/article/1086-Writing-Socket-Servers-in-PHP
>
> And thought 'wow this looks like it might be pretty easy actually!'
>
> But then I reached the first hurdle point:
>
> '
> /* Accept incoming requests and handle them as child processes */
> $client = socket_accept($sock);
> '
>
> Surely the point of a MUD is that the requests are shared?
>
> I also looked up telnet servers in PHP on google quite extensively,
> and there seems to be no real information out there? I would imagine
> that I'm looking for the wrong thing, however.
>
> In short I'm looking for the basic idea on how a MUD server would be
> implemented in PHP.
>
> Thanks in advance for anything,
>
> Luke Slater
>
How about AJAX and sessions instead of having TCP sockets?
http://xajaxproject.org/

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





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



Re: [PHP] =.='' what wrong ? just simple code, however error.

2008-12-31 Thread Micah Gersten
http://us3.php.net/manual/en/function.number-format.php

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



LKSunny wrote:
> i need accuracy, how to ?
>
> Thank You.
>
> "Per Jessen"  
> ¼¶¼g©ó¶l¥ó·s»D:gjg4fk$58...@saturn.local.net...
> LKSunny wrote:
>
>   
>> > $credithold = 100;
>> for($i=1;$i<=1000;$i++){
>> $credithold -= 0.1;
>> echo "$credithold";
>> }
>> //i don't know why, when run this code, on 91.3 after expect is 91.2,
>> however..91.2001
>> //who can help me ? and tell me why ?
>> 
>
> It's a floating point rounding error.  If you don't need the accuracy,
> just round it to what you need.
>
>
> /Per Jessen, Zurich
>
>
>
>   

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



Re: [PHP] IE Problem Detecting Post Variables

2008-12-31 Thread Micah Gersten

L. Herbert wrote:
> The problem is that the variable is passed in one instance with FF and
> not with IE.  Thus my quandary.
>
> Here's the form html:
>
> 
> 
> Flip It!
>  src="images/switch-button-grey.gif" title="Default Theme" id="style1"
> value="default" />
>  src="himages/switch-button-default.gif" title="Alternate Theme"
> id="style2" value="alternate" />
> 
> 
>
> Any thoughts?
>
How is this being submitted?

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


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



Re: [PHP] system() Question

2008-12-31 Thread Micah Gersten
Nathan Nobbe wrote:
>
>
> On Sun, Dec 28, 2008 at 8:40 PM, Micah Gersten  <mailto:mi...@onshore.com>> wrote:
>
> Nathan Nobbe wrote:
> > good point dan, and just to add further clarification, thats b/c the
> > function specifies $return_var is passed by reference in the formal
> > parameter.  when you include the & along w/ an actual parameter
> (during
> > function invocation) thats referred to as
> call-time-pass-by-reference in
> > php, and its typically frowned upon.  in fact, i think its being
> removed
> > from a future version of php.
> >
> > -nathan
> >
> >
> You don't call system using the ampersand.  The reference is
> declared in
> the function definition.  There's no reason for this to be frowned
> upon.
>
>
> well i dont think they deprecated it for shits-&-giggles.
>
> http://us.php.net/manual/en/language.references.pass.php
>
> its disabled by default in php.ini; wonder why.. ;)
>  
>
>   What you are referring to is the old PHP4 style of explicit
> pass-by-reference in function usage which is frowned upon.
>
>
> no im referring to call-time-pass by reference, which works just as
> well in php5; as long as you enable it in php.ini (or one of the other
> various ways).
>
> and also, for clarification, marking parameters as pass-by-reference
> works during method definition in php4 as well, of course.
>
> -nathan
>
I think I was confused here about your response.  After re-reading a few
times, I see that you were enhancing Dan's response by explaining what
call-time pass by reference is, not saying that the function is used
that way.
My apologies.

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



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



Re: [PHP] Question about version control.. sorta..

2008-12-31 Thread Micah Gersten
Richard Heyes wrote:
>> The other issue is that I run Windows.  So if there's something nice and
>> WinGUI, that'd be nice.   Please no "you should be running linux"
>> 
>
> You should be running linux. Muhaha.
>
>   
>> responses.  I don't have anything against Linux or Mac, they're great
>> systems.  But I have my reasons for running Windows.
>> 
>
> There's definitely a Gui for CVS. TurtleCVS IIRC. Presumably there's
> one for SVN.
>
>   
TortoiseCVS and TortoiseSVN on Windows

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



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



Re: [PHP] IE Problem Detecting Post Variables

2009-01-02 Thread Micah Gersten
You might want to consider the button element which allows you to
display images, but doesn't send back coordinates.  Instead it sends a
preset value.
http://www.w3.org/TR/html401/interact/forms.html#h-17.5

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



L. Herbert wrote:
> I find the html/php option simpler and more "accessible".  I've got it
> working now.  I only needed to use unique input names and test for the
> posted variable according to w3c standards.
>
> Here is the relevant w3c definition:
>
> "When a pointing device is used to click on the image, the form is
> submitted and the click coordinates passed to the server. The x value
> is measured in pixels from the left of the image, and the y value in
> pixels from the top of the image. The submitted data includes
> name.x=x-value and name.y=y-value where "name" is the value of the
> name attribute, and x-value and y-value are the x and y coordinate
> values, respectively."
>
> PHP modifies the posted variable name to name_x, name_y to comply with
> PHP's variable naming convention requirements.
>
> Thanks to those all responded for pointing me in the right direction.
>
> On Jan 1, 2009, at 11:25 AM, Phpster wrote:
>
>> What about using the onclick to set a js variable to be sent to the
>> server? That should be more cross server compliant.
>>
>> Bastien
>>
>> Sent from my iPod
>>
>> On Dec 31, 2008, at 8:37 PM, "L. Herbert" 
>> wrote:
>>
>>> Bastien,
>>>
>>> Thanks for your response.  The curious thing is that the value is
>>> passed when using FF, but not passed when using IE.
>>>
>>> Here is the relevant form html:
>>>
>>>   
>>>   
>>>   Flip It!
>>>   >> src="images/switch-button-grey.gif" title="Default Theme"
>>> id="style1" value="default" />
>>>   >> src="himages/switch-button-default.gif" title="Alternate Theme"
>>> id="style2" value="alternate" />
>>>   
>>>   
>>>
>>> The action attribute is left blank so the form posts to the current
>>> page.  The theme switcher script is at the top of each page and
>>> intercepts the posted variables.
>>>
>>> Any thoughts?
>>>
>>>
>>> On Dec 31, 2008, at 11:02 AM, Phpster wrote:
>>>
>>>> Try checking to see if the value was passed with var_dump($_REQUEST)
>>>>
>>>> Also try (!empty($_REQUEST['style']))
>>>>
>>>>
>>>> Bastien
>>>>
>>>> Sent from my iPod
>>>>
>>>> On Dec 31, 2008, at 10:24 AM, "L. Herbert"
>>>>  wrote:
>>>>
>>>>> Hello all,
>>>>>
>>>>> Anyone have insight to share on the following issue:
>>>>>
>>>>> I have a simple theme switcher script that functions as expected
>>>>> in FF, Safari, etc. but does not work in IE 6 or 7.  It appears
>>>>> that the posted form variables are not detected in IE.   I am
>>>>> using the following check within the script:
>>>>>
>>>>> if(isset($_REQUEST['style'])) {
>>>>>
>>>>> $style = $_REQUEST['style'];
>>>>> }
>>>>>
>>>>> Thanks in advance for your assistance.
>>>>>
>>>>> -- 
>>>>> PHP General Mailing List (http://www.php.net/)
>>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>>
>>>>
>>>> -- 
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>
>
>

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



Re: [PHP] IE Problem Detecting Post Variables

2009-01-03 Thread Micah Gersten
Ashley Sheridan wrote:
> On Fri, 2009-01-02 at 18:06 -0500, Andrew Ballard wrote:
>   
>> On Fri, Jan 2, 2009 at 1:15 PM, Micah Gersten  wrote:
>> 
>>> You might want to consider the button element which allows you to
>>> display images, but doesn't send back coordinates.  Instead it sends a
>>> preset value.
>>> http://www.w3.org/TR/html401/interact/forms.html#h-17.5
>>>
>>> Thank you,
>>> Micah Gersten
>>>   
>> If you mean an INPUT element with the type="button", then yes.
>> (Although it will no longer be a submit button, so you'll have to
>> capture the click and perform the submit using Javascript which leads
>> back to accessibility issues, etc.)
>>
>> If you mean a BUTTON element of the type="submit", then not exactly.
>> It *will* send a preset value for sure, but that preset value will
>> differ depending on the browser. I've found that while FF will send
>> the value you set in the value="..." attribute, IE will send the
>> actual text of the button. Thus,
>>
>> My Button Text
>>
>> will send 'test=blue' in FF, but 'test=My+Button+Text' in IE. I'm
>> assuming this is because for  buttons, the text
>> content of the button IS the value in the value="..." attribute.
>>
>> Whatever the reason, that was a fun lesson to track down the first
>> time I had people tell me a page I wrote didn't work in IE.
>>
>> Andrew
>>
>> 
> Lets all march forward and renounce IE as a useful piece of software!
>
>
> Ash
> www.ashleysheridan.co.uk
>   

Agreed.  According to the spec, the FF action is correct.  I just heard
IE's user share dropped below 70%.  One day we will hopefully be able to
say goodbye to it.

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





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



Re: [PHP] Re: A beginner´s question

2009-01-04 Thread Micah Gersten
Nathan Rixham wrote:
> Eduardo wrote:
>> Hi, I am Eduardo, a new PHP programmer and an old Cobol veteran.
>> I know that
>> $tastes=$_POST["tastes"]; moves the content of "tastes" from
>> 
>> to
>> $tastes
>>
>>
>> How do I move the content of $tastes to X of
>> echo "\n";
>> ?
>>
>> Thanks, Eduardo
>>
>
> echo "\n";
>
> echo "this is how you echo a " . $variable . " in a string";
>

While that is true, that's probably not what the OP wants.
He's probably looking for:
echo "$tastes\n";

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




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



Re: [PHP] Re: A beginner´s question

2009-01-04 Thread Micah Gersten
Micah Gersten wrote:
> Nathan Rixham wrote:
>   
>> Eduardo wrote:
>> 
>>> Hi, I am Eduardo, a new PHP programmer and an old Cobol veteran.
>>> I know that
>>> $tastes=$_POST["tastes"]; moves the content of "tastes" from
>>> 
>>> to
>>> $tastes
>>>
>>>
>>> How do I move the content of $tastes to X of
>>> echo "\n";
>>> ?
>>>
>>> Thanks, Eduardo
>>>
>>>   
>> echo "\n";
>>
>> echo "this is how you echo a " . $variable . " in a string";
>>
>> 
>
> While that is true, that's probably not what the OP wants.
> He's probably looking for:
> echo " name="tastes">$tastes\n";
>
> Thank you,
> Micah Gersten
>
>   
As Vicente pointed out, there was a problem with what I posted, so
here's the fixed version:

echo '',$tastes,"\n";

Explanation:
Single quotes save from backslashing the quotes.
Commas save the concatenation overhead.
Quotes around the last block since it uses \n which needs doublw quotes to 
output.


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


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



Re: [PHP] A beginner´s question

2009-01-04 Thread Micah Gersten
Vicente wrote:
>> 
>> 
>
> eps, sorry.. Micah Gersten is right. You will need the echo among
> them.
>
>   
>
>
>   

Yep, but you caught the quotes mix-up. :)

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



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



Re: [PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot

2009-01-05 Thread Micah Gersten
Frank Stanovcak wrote:
> It's been a while since I've programed (VB was on version 4) I was wondering 
> if any one could tell me what the diff is between char, varchar, and text in 
> mysql.
> I know this isn't a mysql news group, but since I am using php for the 
> interaction it seemed like the place to ask.  Thanks in advance, and have a 
> great day!
>
> Frank 
>
>
>
>   
As nice as the guys on the list are, this will be most accurate:
http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html

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


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



Re: [PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot

2009-01-05 Thread Micah Gersten
Ross McKay wrote:
> First, start here:
>
> http://dev.mysql.com/doc/refman/5.1/en/string-types.html
>
> Stuart wrote:
>
>   
>>> varchar: only the space required for the content of the field is
>>> allocated per row but these fields are limited to 255 chars (IIRC) in
>>> length.
>>>   
>
> In MySQL, varchar can hold "up to" 65,535 characters, but the actual
> maximum size is limited by the maximum row length (65,535 bytes) and the
> character set (e.g. utf8 uses between one and three bytes per
> character).
>
> Maybe you're thinking of char, which is limited to 255 characters.
>   

You're referencing the 5.1 manual.  In the 5.0 manual it says that
VARCHAR was extended to 65535 in 5.0.3, so you're statement is not
entirely correct, nor was Stuart's.  That's why I linked him to the 5.0
manual page on data types.

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



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



Re: [PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot

2009-01-06 Thread Micah Gersten
Nathan Rixham wrote:
> Richard Heyes wrote:
>>>> Also I could be missing
>>>> something, but I can't see the advantage in VARCHAR since space is not
>>>> really a concern these days.
>>> char is fixed length and padded. If you don't fill up the space, the
>>> db does it for you (even though it seems it's internal only).
>>>
>>> http://dev.mysql.com/doc/refman/5.0/en/char.html
>>>
>>> When CHAR values are stored, they are right-padded with spaces to the
>>> specified length. When CHAR values are retrieved, trailing spaces are
>>> removed.
>>
>> So where's the advantage of VARCHAR ?
>>
>
> storage size richard, as if you use char(100) then a string(4) will
> still use the space of string(100); whereas with varchar(100) it's
> only take up it's real space of string(4).
>
> it' may seem like a small amount of space but when you have 8
> char(255) columns in a table with 10 million rows you'd noticed the
> difference considerably.

Actually string(4) in a varchar(100) will take up 5 bytes, but that's
still better than 100.

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



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



Re: [PHP] (auto) session expire

2009-01-06 Thread Micah Gersten
Shiplu wrote:
> This is a very common issue. I searched and found many sites talking
> about this. but no good solution.
> Well the problem is I want to set my session will expire after 10
> minutes of inactivity. Just like an banking site.
> When user is inactive for 10 minutes the session will expire. In fact
> the browser will delete the cookie.
> The browser will delete the cookie because it was told by the server.
> I used these lines
>
> session_cache_expire(APP_SESSION_TIMEOUT);
> session_set_cookie_params(APP_SESSION_TIMEOUT*60);
> ini_set("session.gc_maxlifetime", APP_SESSION_TIMEOUT * 60);
> session_start();
>
> It runs at the very beginning of my application. APP_SESSION_TIMEOUT
> has value 10 which is in minutes.
>
> The problem is it works good in FF3. But not in IE.
>
> Any Idea how to resolve it? or any standard way to fix it?
>
>   
Why are you setting the session max lifetime on the server to 60 * your
timeout?  Set it to your timeout and the server will get rid of the session.

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



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



Re: [PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot

2009-01-07 Thread Micah Gersten
Richard Heyes wrote:
>>> it' may seem like a small amount of space but when you have 8
>>> char(255) columns in a table with 10 million rows you'd noticed the
>>> difference considerably.
>>>   
>
> It is a small amount of space. Perhaps it was necessary in the days
> when 1Gb Hdds were a luxury, but those days are long gone. In the
> example you gave you're still only wasting approx 1 GB. Hardly a lot
> these days when you consider you buy a consumer 500Gb Hdd for £50.
>
>   
You also have to remember that server drives are more expensive as they
are of higher quality than consumer disks.  They require a lot more MTBF
than your normal hard drive at your local computer store.  Also, if you
waste 1GB in 1 column, imagine how much wasted space there is in the
whole DB.

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




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



Re: [PHP] Re: Unique Object Instance ID..?

2009-01-10 Thread Micah Gersten
Can you use something like APC to cache the instance variable so that
it's persistent across different sessions?

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



Nathan Rixham wrote:
> Colin Guthrie wrote:
>> 'Twas brillig, and Nathan Rixham at 10/01/09 23:31 did gyre and gimble:
>>> all I need is a completely unique id for each object instance that
>>> can never be repeated at any time, even in a multiserver environment
>>> (and without using any kind of incremented value from a db table or
>>> third party app)
>>>
>>> thoughts, ideas, recommendations?
>>
>> While it's not guaranteed to be unique the general technique used in
>> these situations is to use a UUID. The chances of a clash are slim
>> (2x10^38 ish combinations).
>>
>> You can generate a uuid via mysql "SELECT UUID()" or via the PHP Pecl
>> extension php-uuid.
>>
>> The other way of doing it would be to insert a row into a database
>> row with an auto-increment field and use the value of that
>> auto-incrment field as your identifier (SELECT LAST_INSERT_ID() in
>> mysql or via the db layers API).
>>
>> HTHs
>>
>> Col
>>
>>
>
> cheers for the input; uuid it has to be I guess; don't want it reliant
> on any third party software or db so pecl is out, as is mysql - looks
> like I'm going to have to (and probably enjoy) making a uuid function
> to generate type 4 random uuids.
>
> only other thought is to combine all the instance variables, hash the
> combination of them and save that together with a timestamp..
>
> considering
>

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



Re: [PHP] switch vs elseif

2009-01-13 Thread Micah Gersten
Jochem Maas wrote:
> switch (true) {
>   case ($x === $y):
>   // something
>   break;
>
>   case ($a != $b):
>   // something
>   break;
>
>   case (myFunc()):
>   // something
>   break;
>
>   case ($my->getChild()->hasEatenBeans()):
>   // something
>   break;
> }
>
> evil ... but it works.
>
>
>   
>   
This is a misuse of the switch statement.  Switch is meant to compare
values to a single variable as stated on the manual page:
http://us2.php.net/switch

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


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



Re: [PHP] Security question

2009-01-15 Thread Micah Gersten
Frank Stanovcak wrote:
> "VamVan"  wrote in message 
> news:12eb8b030901141421u6741b943q396bc784136b7...@mail.gmail.com...
>   
>> On Wed, Jan 14, 2009 at 2:22 PM, Frank Stanovcak
>> wrote:
>>
>> 
>>> This is mostly to make sure I understand how sessions are handled
>>> correctly.
>>> As far as sessions are concerned the variable data is stored on the 
>>> server
>>> (be it in memory or temp files), and never transmitted accross the net
>>> unless output to the page?  So this means I should be able to store the
>>> username and password for a program in session vars for quick 
>>> validations,
>>> and if I force rentry of the password for sensitive areas (every time) 
>>> even
>>> if someone mannages to spoof the sesid all they will have access to is 
>>> non
>>> sensitive areas?  This also assumes I, at least, quick validate at the
>>> start
>>> of every page immideately after starting the session.
>>>
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>   
>> Password should never be stored anywhere in clear text. You can store md5
>> version in session or database. As long as password is encrypted ure fine
>> and safe.
>>
>> Thanks,
>> V
>>
>> 
>
> Thanks V
> So if I store the hash in the db, and in the session var then I should be 
> resonably safe provided I salt the hash prior to storing it? 
>
>
>
>   
Yes, but don't use md5.  There are lookups available to help someone
crack it.   Try sha1:
http://us3.php.net/sha1

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




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



Re: [PHP] Parsing HTML href-Attribute

2009-01-18 Thread Micah Gersten
Depending on the goal, using the base tag in the head section might help:
http://www.w3.org/TR/REC-html40/struct/links.html#h-12.4

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



Edmund Hertle wrote:
> Hey,
> I want to "parse" a href-attribute in a given String to check if there is a
> relative link and then adding an absolute path.
> Example:
> $string  = ' href="/foo/bar.php" >';
>
> I tried using regular expressions but my knowledge of RegEx is very limited.
> Things to consider:
> - $string could be quite long but my concern are only those href attributes
> (so working with explode() would be not very handy)
> - Should also work if href= is not using quotes or using single quotes
> - link could already be an absolute path, so just searching for href= and
> then inserting absolute path could mess up the link
>
> Any ideas? Or can someone create a RegEx to use?
>
> Thanks
>
>   

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



Re: [PHP] Re: 64bit vs. 32bit

2009-01-19 Thread Micah Gersten
Ross McKay wrote:
> You'll also use a little more RAM due to pointer and integer sizes.
> However, Linux will be able to address more RAM on a >3GB system.
>   
Linux can already address all the RAM on a 32 bit system with PAE.  The
advantage of 64 bit with regards to RAM is that a single process can
address more than 2.5 - 2.7 GB of RAM.


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



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



Re: [PHP] Dirty Button

2009-01-25 Thread Micah Gersten
tedd wrote:
> At 7:02 PM + 1/25/09, Ashley Sheridan wrote:
>> Tedd, what about having it reset if you then go back and select the
>> original option without submitting, i.e. you originally selected and
>> submitted on A, then selected B, then selected A again?
>
> That's a good idea.
>
> Now I just have to figure out how to make it all-encompassing enough
> to handle one, or more, selection-control and compare current values
> with the values that were previously selected.
>
> Oh, the holes we dig for ourselves.  :-)
>
> Cheers,
>
> tedd
>
What about an onChange javascript function that checks all the boxes
that need input.  Call it whenever any of the inputs change and in the
onSubmit for the form, check it again.

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




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



Re: [PHP] New PHP User with a simple question

2009-01-25 Thread Micah Gersten
Paul M Foster wrote:
> 
> In case this has yet to be answered to your satisfaction...
>
> Your page will *have* to reload when the user presses the button, but
> the majority of content can look the same, except for the content you
> want to change.
> 
>   

This is absolutely not true.   You can make the button call a PHP script
with AJAX and just update the textbox.
Check out:
http://xajaxproject.org

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


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



Re: [PHP] New PHP User with a simple question

2009-01-26 Thread Micah Gersten
Paul M Foster wrote:
> On Mon, Jan 26, 2009 at 12:03:20AM -0600, Micah Gersten wrote:
>
>   
>> Paul M Foster wrote:
>> 
>>> 
>>> In case this has yet to be answered to your satisfaction...
>>>
>>> Your page will *have* to reload when the user presses the button, but
>>> the majority of content can look the same, except for the content you
>>> want to change.
>>> 
>>>
>>>   
>> This is absolutely not true.   You can make the button call a PHP script
>> with AJAX and just update the textbox.
>> Check out:
>> http://xajaxproject.org
>>
>> 
>
> Please show me how *without Javascript* and *only with PHP* you can
> change the content on a page interactively as the user described
> *without* reloading the whole page. Xajax contains Javascript, which is
> how it manages this feat.
>
> For Pete's sake people, this is a *new* PHP user who wanted a *simple*
> solution to a relatively simple webpage problem. He's not looking for a
> Javascript solution, or a framework solution, or an OOP solution. He's
> not necessarily looking for a bulletproof, high security solution. He's
> a *new* PHP user. He just wants to figure out how to do this simple
> thing. Give him a *simple* answer. If you have to give him provisos
> about security, OOP, or Javascript afterward, fine.
>
> Paul
>
>   

I'm not saying that he should use it.  I'm saying that *YOUR *claim was
false.  You should watch what you say.  You said you *HAVE* to reload
which is not true.  I said nothing about without JavaScript.  I agree
that he shouldn't necessarily use that.  That's why I snipped his stuff
out and just quoted you.

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






Re: [PHP] New PHP User with a simple question

2009-01-26 Thread Micah Gersten
Paul M Foster wrote:
> On Mon, Jan 26, 2009 at 12:53:55PM -0600, Micah Gersten wrote:
>
>   
>> Paul M Foster wrote:
>> 
>
> 
>
>   
>>> Please show me how *without Javascript* and *only with PHP* you can
>>> change the content on a page interactively as the user described
>>> *without* reloading the whole page. Xajax contains Javascript, which is
>>> how it manages this feat.
>>>
>>> For Pete's sake people, this is a *new* PHP user who wanted a *simple*
>>> solution to a relatively simple webpage problem. He's not looking for a
>>> Javascript solution, or a framework solution, or an OOP solution. He's
>>> not necessarily looking for a bulletproof, high security solution. He's
>>> a *new* PHP user. He just wants to figure out how to do this simple
>>> thing. Give him a *simple* answer. If you have to give him provisos
>>> about security, OOP, or Javascript afterward, fine.
>>>
>>> Paul
>>>
>>>
>>>   
>> I'm not saying that he should use it.  I'm saying that *YOUR *claim was
>> false.  You should watch what you say.  You said you *HAVE* to reload
>> which is not true.  I said nothing about without JavaScript.  I agree
>> that he shouldn't necessarily use that.  That's why I snipped his stuff
>> out and just quoted you.
>> 
>
> Since he asked the question on a *PHP* list, I assumed he wanted a *PHP*
> solution, not a Javascript one. I also assumed that the OP was not a
> Javascript programmer, since as a Javascript programmer, the solution
> should have been obvious in Javascript. Ergo, my statements were in the
> context of a *PHP* solution to his question.
>
> Moreover, his question indicated that he didn't understand some basic
> fundamentals of the PHP execution model. Throwing a framework or
> Javascript solution at him would have been like putting a 14 year old
> behind the wheel of a Ferrari.
>
> But fair warning to all list members and future newbies who post here:
> If you ask for a solution on *this* list, and you give indications that
> you're not familiar with how PHP works with HTTP and HTML, then I will
> give you a PHP-based solution, and avoid Javascript, Java, C, Perl,
> Python, Ruby, Ruby on Rails, .NET, C++, C#, ECMAScript, Algol, PL/1,
> assembler, APL, Fortran, COBOL, frameworks and other assorted odds and
> ends which *might* do what you want, but aren't what you asked for.
>
> (Of course, I might give you a LISP/Scheme solution, though. ;-)
>
>
> Paul
>   
It's fine if you want to give a pure PHP solution, but please don't make
false statements when doing so.  Keep in mind that there are archives
and someone reading them might think something is impossible when it in
reality is very simple.

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




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



[PHP] MicroSlow Software (was: Re: Hidden costs of PHP arrays?)

2009-01-29 Thread Micah Gersten
Clancy wrote:
> One could reasonably hope that the same could be said for every part of the 
> programming
> chain, but it is one of the ironies of modern computing that computers get 
> faster and
> faster, memory gets cheaper and cheaper, programming appears to get simpler 
> and simpler,
> yet the programs get slower and slower. I have a fairly modern (maybe 2yo) 
> computer, and
> use XP professional 5.1. Not long ago I switched to Office 2007 12.0, and 
> when I did so I
> was appalled to discover that if I had a document loaded into Word, and hit 
> Ctrl A, I
> could watch the highlighting scroll down the screen!
>
> As a former assembly language programmer I have some idea of the vast amount 
> of thumb
> twiddling which is going on behind-the-scenes when I make some apparently 
> simple request
> like the one to get my phone number. Undoubtedly most of this occurs in the 
> murky depths
> of the operating system, but if there were any simple way to avoid adding to 
> it
> unnecessarily it would be nice to know about it.
>
>   
I would venture to say that it's Microsoft Software that is slower with
every release.  PHP, Apache, MySQL, and Linux always improve their newer
builds for speed whenever possible.

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





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



Re: RES: [PHP] Mutiple SQL request

2009-02-04 Thread Micah Gersten
Jim Lucas wrote:
> 
> I would add a second column to that admin_lastping KEY
>
> KEY `admin_lastping` (`admin_lastping`, `admin_id`)
>
> Since you are using both columns in your where clause, they both need to be 
> specified /in the same/ index for and index to be used.
>
> Otherwise, some random index might be used.  But you will get the best 
> performance if both are listed in the same index.
>
>   
This is definitely not true in MySQL 5 and I'm sure other RDBMS
systems.  MySQL 5 can use more than 1 index per table now.  Also, if
you're using the InnoDB engine, the Primary Key is stored in the
secondary index, so specifying it explicitly is unnecessary.

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


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



Re: [PHP] CLI not obeying php.ini

2009-02-05 Thread Micah Gersten
Philip Thompson wrote:
> In my php.ini, I have
>
> error_reporting = E_ALL & ~E_NOTICE
>
> When I run a script from the command line, I get a lot of notices
> even when I said I don't want them. Also, in my script, I specified
> error_reporting(E_ERROR) in attempts to explicitly tell it what I
> want. It doesn't work either.
>
> Why am I still getting notices?! BTW, I don't receive notices via a
> web browser, just CLI.
>
> I double-checked to see what INI file was loaded and it's the one I
> expected to see:
>
> [pthomp...@pthompson scripts]$ php --ini
> Configuration File (php.ini) Path: /etc
> Loaded Configuration File: /etc/php.ini
>
> Thoughts on what's happening would be awesome! Thanks in advance.
>
> ~Philip
>

Run this to find out which ini file is being parsed:
php -i | grep ini

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



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



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




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



Re: [PHP] php validate user password

2009-02-09 Thread Micah Gersten
onlist this time...

tedd wrote:

> > 
> >
> > I think the MD5() hash is a pretty good way and if the weakness is the
> > user's lack of uniqueness in determining their passwords, then we can
> > focus on that problem instead of looking to another hash. And besides,
> > the solution presented was to create a salt and use that -- that's
> > just another step in the algorithm process not much different than
> > what I propose.
> >
> > Cheers,
> >
> > tedd
> >
>   

The MD5 hash IS the problem.  The problem isn't the uniqueness of the
passwords, but rather the uniqueness of the hash. The solution is to use
another hash that does not have the same collision issues.

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




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



Re: [PHP] Having Trouble With Session Variable in Query Statement

2009-02-23 Thread Micah Gersten
Paul M Foster wrote:
> On Mon, Feb 23, 2009 at 12:34:58PM -0800, revDAVE wrote:
>
>   
>> Hi folks,
>>
>> I'm trying to make an update query with a session variable...
>>
>> It creates this error:
>>
>> Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
>> T_STRING or T_VARIABLE or T_NUM_STRING in ...
>>
>> Q: the session var shows ok on the page :
>> ID 
>> - so how do I fix the error?
>>
>> ==
>>
>> > if(!session_id()) session_start();
>> $amt = 18;
>> $id1 = 8;
>> $_SESSION['thisid']=8;
>> $id2 = $_SESSION['thisid'] ;
>>
>>
>>   //these 3 work
>> $updateSQL ="UPDATE `mytable` SET thetotal=$amt WHERE id=8";
>> $updateSQL ="UPDATE `mytable` SET thetotal=$amt WHERE id=$id1";
>> $updateSQL ="UPDATE `mytable` SET thetotal=$amt WHERE id=$id2"; // uses
>> $_SESSION['thisid']
>>
>> //but this does not..
>> $updateSQL ="UPDATE `mytable` SET thetotal=$amt WHERE
>> id=$_SESSION['thisid']";
>> 
>
> Don't single quote values inside array brackets when the whole
> expression is in double quotes. You've got:
>
> "... $_SESSION['thisid']";
>
> Do this instead:
>
> "... $_SESSION[thisid]";
>
> Paul
>   

Better off doing this so you don't get into the habit of not using
quotes around array params:

"... {$_SESSION['thisid']}";

See this:
http://us2.php.net/manual/en/language.types.string.php#language.types.string.parsing

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





Re: [PHP] syntax

2009-02-24 Thread Micah Gersten
Martin Zvarík wrote:
> Chris napsal(a):
>> Terion Miller wrote:
>>> Need syntax help when it comes to using a timestamp.
>>> What I'm trying to say in my query WHERE clause is to select records
>>> if the
>>> timestamp on the record is in the past 7 days from NOW()
>>>
>>> $query .= " WHERE stamp < NOW()-7 ";  I have no clue here on this 
>>>
>>> the lay language is  WHERE stamp is within the past 7 days how
>>> to php
>>> that? lol
>>
>> Has nothing at all to do with php.
>>
>> http://dev.mysql.com/doc/refman/5.0/en/datetime.html
>> http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
>>
>
> $query .= " WHERE stamp < ".(time()-7*3600*24);
>
Using something like that is disastrous for DST and Leap Seconds...

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


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



[PHP] Re: Database Abstraction Class

2009-03-08 Thread Micah Gersten
Michael A. Peters wrote:

> Anywhoo, that being said, does anyone have a suggestion for a good
> database abstraction class?
> 
> Preferably one that already has decent support for several open source
> databases?

Try Doctrine:
http://www.doctrine-project.org/

>From the website:
What is Doctrine?
Doctrine is an object relational mapper (ORM) for PHP 5.2.3+ that sits
on top of a powerful database abstraction layer (DBAL). One of its key
features is the option to write database queries in a proprietary object
oriented SQL dialect called Doctrine Query Language (DQL), inspired by
Hibernates HQL. This provides developers with a powerful alternative to
SQL that maintains flexibility without requiring unnecessary code
duplication.

-- 
Micah

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



[PHP] Re: Database Abstraction Class

2009-03-08 Thread Micah Gersten
Shawn McKenzie wrote:
> Micah Gersten wrote:
>> Michael A. Peters wrote:
>>
>>> Anywhoo, that being said, does anyone have a suggestion for a good
>>> database abstraction class?
>>>
>>> Preferably one that already has decent support for several open source
>>> databases?
>> Try Doctrine:
>> http://www.doctrine-project.org/
>>
>> From the website:
>> What is Doctrine?
>> Doctrine is an object relational mapper (ORM) for PHP 5.2.3+ that sits
>> on top of a powerful database abstraction layer (DBAL). One of its key
>> features is the option to write database queries in a proprietary object
>> oriented SQL dialect called Doctrine Query Language (DQL), inspired by
>> Hibernates HQL. This provides developers with a powerful alternative to
>> SQL that maintains flexibility without requiring unnecessary code
>> duplication.
>>
> 
> Wow, a proprietary language that I get to learn on top of the two that
> do the job and that I already know!  Bonus!
> 
> Not trying to be an ass, I haven't used doctrine, but they need some
> marketing help.  My point is that the ability to write queries in a
> "proprietary dialect" is not really a "feature".
> 

I think the point is, that you can use a DB engine neutral query
language which improves portability.

-- 
Micah

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



[PHP] Re: PHP Frameworks

2009-03-08 Thread Micah Gersten
HallMarc Websites wrote:
> First time caller; long time listener..
> 
>  
> 
> I have been looking at various PHP MVC frameworks; Limb3, Symphony, Mojavi,
> Navigator, WACT, etc. 
> 
> I'm looking for any input anyone might have regarding which framework seems
> to be the most promising?
> 
>  
> 
> Thanks,
> 
> Marc
> 
> 

I'm currently using Zend PHP Framework + Doctrine ORM.  Symfony has a
little better integration with Doctrine.  I chose the Zend PHP Framework
because of the rapid release schedule and large feature set.

You might want to check the archives as this discussion has come up before.

-- 
Micah

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



Re: [PHP] Re: PHP Frameworks

2009-03-08 Thread Micah Gersten
Chetan Rane wrote:
> HI 
> 
> I also was looking for various frameworks and came across a very nice
> framework, which is feature rich as well as very fast
> 
> You can see more details at http://www.yiiframework.com/
> 
> Chetan Dattaram Rane | Software Engineer | Persistent Systems
> chetan_r...@persistent.co.in  | Cell: +91 94033 66714 | Tel: +91 (0832) 30
> 79014
> Innovation in software product design, development and delivery-
> www.persistentsys.com
> 
> 
> 
> -Original Message-
> From: Micah Gersten [mailto:news.php@micahscomputing.com] 
> Sent: Monday, March 09, 2009 9:52 AM
> To: php-general@lists.php.net
> Subject: [PHP] Re: PHP Frameworks
> 
> HallMarc Websites wrote:
>> First time caller; long time listener..
>>
>>  
>>
>> I have been looking at various PHP MVC frameworks; Limb3, Symphony,
> Mojavi,
>> Navigator, WACT, etc. 
>>
>> I'm looking for any input anyone might have regarding which framework
> seems
>> to be the most promising?
>>
>>  
>>
>> Thanks,
>>
>> Marc
>>
>>
> 
> I'm currently using Zend PHP Framework + Doctrine ORM.  Symfony has a
> little better integration with Doctrine.  I chose the Zend PHP Framework
> because of the rapid release schedule and large feature set.
> 
> You might want to check the archives as this discussion has come up before.
> 

Please keep on list by hitting reply-all.  Someone else already
mentioned yii framework.
-- 
Micah

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



[PHP] Replies to list - Was (Re: [PHP] PHP 5.2.9 - 5.2.9-1 and curl)

2009-03-12 Thread Micah Gersten
Jochem Maas wrote:

> 
> we use Reply-All because hitting Reply doesn't reply to the list but
> to the OP ... and discussions should generally stay on the list.

This is true unless you're reading the list as a newsgroup.  :)
-- 
Micah

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



[PHP] Re: 2 forms, same page, 1st is file upload - works in IE, 'dies' in non-IE browsers

2009-03-13 Thread Micah Gersten
scubak1w1 wrote:
> Hello,
> 
> Banging my head against this one...
> 
> Briefly:
>  - I have two forms on the same page
>  - both forms are: action="" 
> method="post"
>  - both forms gave unique ids
>  - both forms have a hidden file of the type  name="_add_new_module_details" value="1" /> which is checked directly below 
> the form with an "if(array_key_exists('_add_new_module_details', $_POST)) 
> { ...}" method
>  - first form is a file upload
>  - 2nd form is a details submit
>  - submit button on 2nd form is only 'turned on' (via AJAX) once the user 
> has uploaded file file
>  - 2nd form validated fields contents, via an onsubmit
>  - after 2nd form successuly submitted, head off back to another page
> 
> In Internet Destroyer, the page works just fine (i.e., both forms fire as 
> expected)
> 
> In the non-IE browsers I have tried (Firefox, Chrome, Opera), the first form 
> uploads the file properly, the 2nd form's submit is 'turned on' by AJAX - 
> BUT the submit button on the 2nd form doesn't seem to do anything - i.e., 
> the onsubmit is not being triggered, etc, etc
> 
> help!   
> 
> Thanks in advance:
> GREG
> 
> 
> 

Have you checked the Javascript error console in Firefox?

-- 
Micah

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



[PHP] Re: Anyone know of a project like Redmine written in PHP?

2009-03-17 Thread Micah Gersten
mike wrote:
> http://www.redmine.org/
> 
> Looks pretty useful; I want one in PHP though.
> 
> Anyone?

Mantis Bug Tracker has some of the features you are looking for:
http://www.mantisbt.org/

-- 
Micah

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



Re: [PHP] Re: Anyone know of a project like Redmine written in PHP?

2009-03-18 Thread Micah Gersten
mike wrote:
> On Wed, Mar 18, 2009 at 8:30 AM, Jan G.B.  wrote:
>> Mantis is a pain in the a*** (for non technical persons).
> 
> +1
> 
> had some annoying bugs, too.
> 
> it's only really a bug tracker last i checked anyhow.
> 
> trac or redmine is more what would be beneficial.

OP asked for PHP.  Trac is python and Redmine is Ruby.  They've added
twitter support, VCS support, and wiki support lately and are working on
the major 1.2 upgrade now.

-- 
Micah

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



Re: [PHP] Re: Anyone know of a project like Redmine written in PHP?

2009-03-18 Thread Micah Gersten
mike wrote:
> On Wed, Mar 18, 2009 at 1:22 PM, Micah Gersten
> 
> 
>> OP asked for PHP.  Trac is python and Redmine is Ruby.  They've added
>> twitter support, VCS support, and wiki support lately and are working on
>> the major 1.2 upgrade now.
> 
> i am the OP :) i know. i was just adding trac as another example.

Sorry, didn't notice it was you, but you did ask for PHP and Trac isn't.

-- 
Micah

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



[PHP] Re: $_GET verses $_POST

2009-04-12 Thread Micah Gersten
Ron Piggott wrote:
> How do I know when to use $_GET verses $_POST?
> 
> Is there a pre defined variable that does both?
> 
> Ron
> 

One of the things usually left out of this discussion is the actual
intended use for each of these.  I submit the following 2 reference links:
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.1
http://www.w3.org/2001/tag/doc/whenToUseGet.html

-- 
Micah

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



Re: [PHP] MySQL, MD5 and SHA1

2009-04-21 Thread Micah Gersten
Andrew Ballard wrote:
> On Tue, Apr 21, 2009 at 8:34 AM, Grega Leskovsek  wrote:
>> provided I want to store hash of a password in MySQL ... Using MySQL,
>> the whole check can be achieved with a SQL query, since the MD5
>> function is provided as part of the database query language ...
>> Can I use also SHA1 or must I use MD5?
>>
>> Thanks in advance,
>>
>> --
>> When the sun rises I receive and when it sets I forgive ->
>> http://users.skavt.net/~gleskovs/
>> All the Love, Grega Leskov'sek
>>
> 
> I would encode the value in PHP and pass the hash to MySQL rather than
> passing the password in open text as part of the query and letting
> MySQL calculate the hash. That way the sensitive data has already been
> hashed and you don't have to worry about whether the communication
> between PHP and MySQL travels over an unencrypted network connection
> -- now or in the future.
> 
> Andrew

In addition, you don't want the password showing up in a general query
log for the server.

-- 
Micah

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



Re: [PHP] Randomly missing a function

2008-07-17 Thread Micah Gersten
Try returning a value from CreateUser and checking it before sending the
E-Mail.

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



Miles Thompson wrote:
> An online signup script is randomly missing part of the task. These scripts
> are involved:
> sub_signup.php
>include/cc_proc.php - does the CC (credit card) processing
>include/user_maint.php - inserts the new subscriber into the database
>
> When the CC processing finishes, with the success flag, user_maint.php is
> included, and a few lines later the createUser($params) function therein is
> called to create the user. Every mysql_ function in user_maint.php is
> backstopped with a die() if it fails. But sometimes it appears that the call
> to this script, or the createUser() function just isn't made.
>
> What seems to happen, randomly, is that the script "charges on" so to speak,
> sending an advisory email to the office manager that there is a new
> subscriber, and calling sub_signup_thanks.php, which displays a completion
> message, etc.
>
> In all of these cases the credit card processing has succeeded. Sometimes
> people have tried to sign up two or three times, the card processes, but no
> addition is made to the database. It's driving us nuts! Any thoughts?
>
> Regards - Miles
>
> Infrastructure: Apache 2.2, PHP 5.x, MySQL 5
>
> Code:
> switch ($ret) {
> case CC_SUCCESS:
> require 'include/user_maint.php';
> $cctype = cc_getCardType($cc);
> if ($cctype == 'Visa') $cctype = 'VISA';
> elseif ($cctype == 'MasterCard') $cctype = 'M-C';
> //Shouldn't happen in case CC_SUCCESS, but better safe than sorry
> else die('We don\'t support this credit card');
>
> $params = array(
> 'firstname'   => $first,
> // various fields
> 'postal_code' => $postal_code,
> 'pay_method'  => $cctype
> );
> // createUser is a function in user_maint
> createUser($params);
> // sendEmail is func in user_maint, advises office manager
> sendEmail('New subscriber!!!', "Already paid $amount by credit
> card", $fields);
> require 'sub_signup_thanks.php';//Grabs authCode from $result
> return;
>
> } //other situations dealt with, and properly closed
>
>   

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



Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??

2008-07-17 Thread Micah Gersten
What can help is if one app only has access to it's own DB.  Also, for
mysql, there is the mysql_real_escape_string function for a reason.
Also, for the web app, you can usually disable Administrative functions
and grant a minimal set of permissions.

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



Robert Cummings wrote:
> On Thu, 2008-07-17 at 12:32 -0400, Andrew Ballard wrote:
>   
>> On Thu, Jul 17, 2008 at 12:02 PM, Stut <[EMAIL PROTECTED]> wrote:
>> 
>>> On 17 Jul 2008, at 15:31, David Giragosian wrote:
>>>
>>>   
>>>> On 7/17/08, Stut <[EMAIL PROTECTED]> wrote:
>>>> 
>>>>> On 17 Jul 2008, at 14:10, tedd wrote:
>>>>>
>>>>>   
>>>>>> At 10:28 PM +0100 7/16/08, Stut wrote:
>>>>>>
>>>>>> 
>>>>>>> Oh, and you'd be working for me so bear that in mind ;)
>>>>>>>
>>>>>>> -Stut
>>>>>>>
>>>>>>>   
>>>>>> It's no wonder why you haven't found anyone.  :-)
>>>>>>
>>>>>> 
>>>>> Thanks for that tedd.
>>>>>
>>>>> Seriously though, I'm wondering if my expectations are too high... I
>>>>> expect
>>>>> them to know that addslashes is not adequate protection against SQL
>>>>> injection. I even had one tell me "SQL injection? I can't remember but
>>>>> I'm
>>>>> sure I've used it before". And I won't even go into the guy who asserted
>>>>> that he's always worked with DB administrators who've dealt with security
>>>>> issues so he'd never needed to learn about it.
>>>>>
>>>>> Am I expecting too much?!?
>>>>>
>>>>> -Stut
>>>>>   
>>>> Surely you're being rhetorical, Stut, but no, you're not expecting too
>>>> much.
>>>> However the guy(s) who worked in a larger organization likely did have a
>>>> very clear delineation of roles and responsibilities, as I am experiencing
>>>> in a new position, and therefore may not be current on best practices in
>>>> areas outside of their role. When my group leader instituted the current
>>>> policy regarding job functions, a number of the open source guys decided
>>>> their unused skills were eroding and/or they were not being exposed to new
>>>> learning, and they left the company.
>>>> 
>>> There's no way I would ever hire anyone who says "security was somebody
>>> else's responsibility". I don't care what their previous managers have said,
>>> that's never a valid statement in my book. When you then add the fact that
>>> no DB admin no matter how good they are can implement adequate security to
>>> prevent SQL injection you get a developer who doesn't care about security
>>> issues much less know anything about them.
>>>
>>> -Stut
>>>
>>>   
>> A DBA can go pretty far to prevent SQL injection by setting
>> appropriate rights on the accounts that applications will use to
>> interact with the database: denying direct access to tables, allowing
>> access to only the necessary stored procedures, thereby forcing
>> developers to design products using only those procedures for all data
>> access. Of course, a lot of developers would complain under this level
>> of security, and I suspect a lot of frameworks that are out there
>> would be much less "useful" to lazy programmers.
>> 
>
> So are you suggesting a web app make multiple different user account
> connections to the SQL server depending on whether it wants to SELECT,
> INSERT, DELETE, ETC.? I means that's a fair proposition... just seems a
> tad heavy duty. Once again though... there's a programmer responsibility
> here to implement the application with such a scenario in mind. most
> applications need access to SEELCT, INSERT, and DELETE. In such a case,
> a single account with restricted access permissions that allow all three
> isn't going to do anything for the application if a programmer let's an
> SQL injection through.
>
> Cheers,
> Rob.
>   

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



Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??

2008-07-17 Thread Micah Gersten
For anyone interested, here's a nice book to get anyone started on PHP
Security:
http://oreilly.com/catalog/9780596006563/index.html

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



Stut wrote:
> On 17 Jul 2008, at 21:56, Robert Cummings wrote:
>> On Thu, 2008-07-17 at 15:46 -0500, Micah Gersten wrote:
>>> What can help is if one app only has access to it's own DB.  Also, for
>>> mysql, there is the mysql_real_escape_string function for a reason.
>>
>> Well I agree with that of course... but the post by Stut indicated the
>> interviewee thought he could punt all DB security to the DBA. Obviously
>> it's important that the app developer use appropriate programming
>> techniques to achieve security in conjunction with the DBA.
>
> My main point was that security is the responsibility of everyone on
> the team whether it's explicitly part of their job spec or not. A
> candidate who doesn't see that without prompting will not be getting
> any further in my interview process.
>
> -Stut
>

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



[PHP] Anyone use Zend framework

2008-07-18 Thread Micah Gersten
Does anyone use the Zend Framework?  Is it fast?


-- 


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


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



Re: [PHP] Counting Occurrences within an If statement

2008-07-20 Thread Micah Gersten
If it's a simple x < y, you might want to consider putting your if
statement in the SQL query so you don't return so many rows.  To make a
counter, just set a variable like:
$counter = 0;

if ($x <$y)
{
print $row;
$counter++
}

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



Mark Bomgardner wrote:
> I have been working on the something for the last day and can't figure it
> out.
>
>  
>
> I am pulling 7500 rows from a MySQL database, but I only want to display a
> certain numbers of rows based up an if statement.  I want to count the rows
> within the if statement.
>
>  
>
> mysql query result
>
>  
>
> if(x < y){
>
> display a row in a table
>
> }else{
>
> Don't display anything
>
> }
>
>  
>
> Every time a row is displayed, I want to add one to a counter
>
>  
>
> markb
>
>
>   

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



Re: [PHP] Pasword Protecting several pages

2008-07-20 Thread Micah Gersten
Set a session variable after the login has been confirmed and check for
it at the beginning of every page.  If it's not set, then redirect to login.

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



R.C. wrote:
> I'm still trying to get this scenario worked out and don't seem to be able
> to get it done.
>
> Here's what I'm trying to do:
> User logs into a login page and inputs email address and password.  User
> accessess password protected page, which contains a few links.  User clicks
> on one of the links, opens page, looks at content and then clicks back to
> main page.
>
> User is now asked to input password again what do I have to do to make
> sure all related links/pages on the main.php page are accessible with that
> same password the user input the first time?  Also.. how can I password
> protect ALL the linked pages on the main.php site with the same password but
> user only has to log in once!!
>
> No database, but just sessions?  I looked at those and also Tedd was kind
> enough to send something but for some reason I can't get it to go.
>
> Can someone forward some good instructions on how to accomplish this task?
> I would greatly appreciate it. Still learning this program as you can tell.
>
> Best
> Ref
>
>
>
>
>
>   

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



Re: [PHP] Pasword Protecting several pages

2008-07-20 Thread Micah Gersten
checkLogin.php



info.php



login.php



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



R.C. wrote:
> Thank you Micah,
>
> Could you give me some code on that?
>
> Ref
>
> "Micah Gersten" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>   
>> Set a session variable after the login has been confirmed and check for
>> it at the beginning of every page.  If it's not set, then redirect to
>> 
> login.
>   
>> Thank you,
>> Micah Gersten
>> onShore Networks
>> Internal Developer
>> http://www.onshore.com
>>
>>
>>
>> R.C. wrote:
>> 
>>> I'm still trying to get this scenario worked out and don't seem to be
>>>   
> able
>   
>>> to get it done.
>>>
>>> Here's what I'm trying to do:
>>> User logs into a login page and inputs email address and password.  User
>>> accessess password protected page, which contains a few links.  User
>>>   
> clicks
>   
>>> on one of the links, opens page, looks at content and then clicks back
>>>   
> to
>   
>>> main page.
>>>
>>> User is now asked to input password again what do I have to do to
>>>   
> make
>   
>>> sure all related links/pages on the main.php page are accessible with
>>>   
> that
>   
>>> same password the user input the first time?  Also.. how can I password
>>> protect ALL the linked pages on the main.php site with the same password
>>>   
> but
>   
>>> user only has to log in once!!
>>>
>>> No database, but just sessions?  I looked at those and also Tedd was
>>>   
> kind
>   
>>> enough to send something but for some reason I can't get it to go.
>>>
>>> Can someone forward some good instructions on how to accomplish this
>>>   
> task?
>   
>>> I would greatly appreciate it. Still learning this program as you can
>>>   
> tell.
>   
>>> Best
>>> Ref
>>>
>>>
>>>
>>>
>>>
>>>
>>>   
>
>
>
>   

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



Re: [PHP] session ok? [SOLVED]

2008-07-21 Thread Micah Gersten
When you use a header redirect, you start with a new page.  Everything
you did until then is gone.  When you call session_start on the new
page, it resumes the same session, not creates a new one.

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



tedd wrote:
> Hi gang:
>
> I found the problem I was having with sessions and want to share it
> with you -- it surprised me.
>
> To refresh -- I was having a problem with destroying a session. I went
> through all the steps shown in the manual and dozens of recommended
> ways of doing it I found on the net.
>
> However, I found that while I was actually destroying the session I
> wanted, another session was being created in a very unexpected way.
>
> Now, the manual says:
>
> "session_start() creates a session or resumes the current one based on
> the current session id that's being passed via a request, such as GET,
> POST, or a cookie."
>
> From that one assumes that if you place a session_start at the
> beginning of each page, then the first time it's encountered, a
> session will be created and with every encounter thereafter the
> established session will be used.
>
> That's the way it works PROVIDED that you do not use the following in
> your code:
>
> header('Location: http://www.yourdomain.com/whatever/index.php');
>
> If you use that statement, then a new session will be created AND you
> will find that you'll have two sessions working concurrently. That
> creates several problems -- one of them being while you may destroy
> the first session, the second will be still remain.
>
> Now, how many people knew this?
>
> Am I the only one who didn't?
>
> Cheers,
>
> tedd

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



Re: [PHP] Re: a question...

2008-07-23 Thread Micah Gersten
I just want to point out that public IPs are no longer given out as
Class A, B, and C networks, but based on CIDR.  You can use rwhois to
figure out who has use of a certain subnet and what the range of it is.

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



Daniel Brown wrote:
> On Wed, Jul 23, 2008 at 12:10 PM,  <[EMAIL PROTECTED]> wrote:
>   
>> Yes, sorry. I have a database that records ip of attacks on a customer
>> server, what I like to do get a count so that I can see what subnet is
>> doing the major of the attacks.
>>
>> select ip from ipslimit 10;
>> +-+---+
>> | ip  | count(ip) |
>> +-+---+
>> | 83.117.196.206  | 1 |
>> | 85.17.109.28| 1 |
>> | 125.138.96.19   | 1 |
>> | 89.110.148.253  | 1 |
>> | 192.168.105.10  | 1 |
>> | 200.170.124.72  | 1 |
>> | 201.116.98.214  | 1 |
>> | 202.168.255.226 | 1 |
>> | 203.89.243.158  | 1 |
>> | 210.245.207.217 | 1 |
>> +-+---+
>> 10 rows in set (0.00 sec)
>> 
>
> Okay, this would have to be done in code, and isn't a MySQL issue.
>  Presuming you're using PHP, I'm going to also copy this message to
> the PHP General mailing list, Payne, so that others can benefit from
> it in the archives as well.  If you're not already subscribed and
> would like to follow along with the thread, please send a blank
> message to [EMAIL PROTECTED]
>
> To get the Class C on that, here's a simple function you can use:
>
>  function get_subnet($ip) {
> return substr($ip,0,strrpos($ip,'.'));
> }
> ?>
>
> As a quick illustration of how it works, here's an example script
> (to use MySQL, just replace the $ips array with your  mysql_fetch_array($result); ?> or similar line):
>
>  $ips = 
> array('192.168.0.0','10.0.0.1','127.0.0.1','216.37.159.240','99.99.99.99','127.0.0.2','192.168.1.1','10.0.0.0','192.168.0.1','192.168.0.150');
>
> function get_subnet($ip) {
> return substr($ip,0,strrpos($ip,'.'));
> }
>
> foreach($ips as $ip) {
> echo $ip."'s Class C is ".get_subnet($ip)."\n";
> }
> ?>
>
>
>   

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



Re: [PHP] Multi-array - What am I missing?

2008-07-23 Thread Micah Gersten
Don't put the array definitions in quotes:
Should be either:

foreach($myCalTime as $calTime => $calArrayTime){
$calArray[$calArrayTime['day']] = array('NULL','linked-day 
'.strtolower($calArrayTime['reason']),$calArrayTime['day']);

}

or

foreach($myCalTime as $calTime => $calArrayTime){
$calArray[] = array($calArrayTime['day'] => array('NULL','linked-day 
'.strtolower($calArrayTime['reason']),$calArrayTime['day']));


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



Chris Ditty wrote:
> Can anyone point me in the right direction?  I know I am missing something
> simple, but I can't place my hands on it.
>
> $myCalTime = act_getCalendarDays($config, $myMonth, $myYear);
>
> foreach($myCalTime as $calTime => $calArrayTime){
> $calArray[] = $calArrayTime['day']."=>array('NULL','linked-day
> ".strtolower($calArrayTime['reason'])."','".$calArrayTime['day']."'),";
> }
>
> act_getCalendarDays returns this
> Array
> (
> [day] => Array
> (
> [0] => 05
> [1] => 06
> [2] => 26
> [3] => 27
> )
>
> [reason] => Array
> (
> [0] => Vacation
> [1] => Vacation
> [2] => Vacation
> [3] => Vacation
> )
>
> )
>
>
> What am I missing to get this
> =>array('NULL=','linked-day ',''),
>
> to look like this
> 05=>array(NULL,'linked-day vacation','05'),
>
>   

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



Re: [PHP] Multi-array - What am I missing?

2008-07-23 Thread Micah Gersten
I'm still confused.  What do you mean by same line?

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



Chris Ditty wrote:
> The array($calArrayTime. is actually another string.  I am mainly trying 
> to get the values for ['day']['0'], ['reason']['0'] etc all on the same line.
>
> Sorry for not being clearer.
>
>   
>>>> Micah Gersten <[EMAIL PROTECTED]> 7/23/2008 2:50 PM >>>
>>>> 
> Don't put the array definitions in quotes:
> Should be either:
>
> foreach($myCalTime as $calTime => $calArrayTime){
> $calArray[$calArrayTime['day']] = array('NULL','linked-day 
> '.strtolower($calArrayTime['reason']),$calArrayTime['day']);
>
> }
>
> or
>
> foreach($myCalTime as $calTime => $calArrayTime){
> $calArray[] = array($calArrayTime['day'] => array('NULL','linked-day 
> '.strtolower($calArrayTime['reason']),$calArrayTime['day']));
>
>
> Thank you,
> Micah Gersten
> onShore Networks
> Internal Developer
> http://www.onshore.com 
>
>
>
> Chris Ditty wrote:
>   
>> Can anyone point me in the right direction?  I know I am missing something
>> simple, but I can't place my hands on it.
>>
>> $myCalTime = act_getCalendarDays($config, $myMonth, $myYear);
>>
>> foreach($myCalTime as $calTime => $calArrayTime){
>> $calArray[] = $calArrayTime['day']."=>array('NULL','linked-day
>> ".strtolower($calArrayTime['reason'])."','".$calArrayTime['day']."'),";
>> }
>>
>> act_getCalendarDays returns this
>> Array
>> (
>> [day] => Array
>> (
>> [0] => 05
>> [1] => 06
>> [2] => 26
>> [3] => 27
>> )
>>
>> [reason] => Array
>> (
>> [0] => Vacation
>> [1] => Vacation
>> [2] => Vacation
>> [3] => Vacation
>> )
>>
>> )
>>
>>
>> What am I missing to get this
>> =>array('NULL=','linked-day ',''),
>>
>> to look like this
>> 05=>array(NULL,'linked-day vacation','05'),
>>
>>   
>> 
>
>   

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



Re: [PHP] Multi-array - What am I missing?

2008-07-23 Thread Micah Gersten
Nice catch, I missed that.

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



Jason Norwood-Young wrote:
> On Wed, 2008-07-23 at 13:52 -0500, Chris Ditty wrote:
>   
>> Can anyone point me in the right direction?  I know I am missing something
>> simple, but I can't place my hands on it.
>>
>> $myCalTime = act_getCalendarDays($config, $myMonth, $myYear);
>>
>> foreach($myCalTime as $calTime => $calArrayTime){
>> $calArray[] = $calArrayTime['day']."=>array('NULL','linked-day
>> ".strtolower($calArrayTime['reason'])."','".$calArrayTime['day']."'),";
>> }
>>
>> act_getCalendarDays returns this
>> Array
>> (
>> [day] => Array
>> (
>> [0] => 05
>> [1] => 06
>> [2] => 26
>> [3] => 27
>> )
>>
>> [reason] => Array
>> (
>> [0] => Vacation
>> [1] => Vacation
>> [2] => Vacation
>> [3] => Vacation
>> )
>>
>> )
>>
>>
>> What am I missing to get this
>> =>array('NULL=','linked-day ',''),
>>
>> to look like this
>> 05=>array(NULL,'linked-day vacation','05'),
>> 
>
> Your myCalTime isn't an array of arrays of arrays, like you're
> suggesting in the foreach.
>
> $calArray=array();
> for($x=0;$x$calArray[]=$myCalTime["day"][$x]."=>array('NULL','linked-day
> ".strtolower($myCalTime['reason'][$x])."','".$myCalTime['day'][$x]."'),";
> }
>
>
>   

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



Re: [PHP] Questions about finding ranges

2008-07-23 Thread Micah Gersten
Here's the info on the "weirdness" of between:
http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_between

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



VamVan wrote:
> Hey,
>
> For ranges you can also use "Between" in the mysql queries.
>
> SELECT * FROM table WHERE Type= "Attainable" AND Min LIKE $var can be
> written as
>
> Select * from table where between min and max
>
> Just remember that "between" acts a bit wierd with dates or else Jim's
> solution would be perfect for you.
>
> Thanks
>
>
>
> On Wed, Jul 23, 2008 at 7:58 AM, Jim Lucas <[EMAIL PROTECTED]> wrote:
>
>   
>> Aslan wrote:
>>
>> 
>>> Hey there,
>>>
>>> I have a range of records that represent different faults and different
>>> symptoms that I want to pull out of the database, and to find the records
>>> that are the closest within each range.
>>>
>>> I am currently doing it with a barrage of if statements, but I am sure
>>> that this could be done faster and far more elegantly by using SQL
>>>
>>> I have a range of conditions eg
>>> Attainable rates:
>>> 0-500 KB/sec is very poor
>>> 500 - 1000 is marginal
>>> 1000- 3000 KB/sec is good
>>>
>>> So the database may look like:
>>> Type|Min|Max|Value
>>> Attainable|0|500|" This rate is very poor"
>>>
>>> and then SQL could go something like
>>>
>>> SELECT * FROM table WHERE Type= "Attainable" AND Min LIKE $var
>>>
>>>
>>>   
>> You're close, try this
>>
>> SELECT   *
>> FROM table
>> WHEREType = "Attainable"
>>  ANDMin <= $var
>>  ANDMax >= $var
>>
>>
>> as long as your min and max do not overlap from row to row, you should only
>> get one result.  Make sure in your data that you have no overlap.
>>
>> Row 1 =0 -  499
>> Row 2 =  500 -  999
>> Row 3 = 1000 - 1499
>>
>>
>> 
>>> But that wouldn't work quite right I don't think.
>>>
>>> But where it can get a bit more hairy is that I want to have a whole range
>>> of variables that are input from an entry table, and then it just finds the
>>> the vars that are the closest to what is searching for all the vars. The
>>> closest code I have seen doing something similar is where there it is
>>> finding if an IP is in a certain range.
>>>
>>> Does that make sense? feel free to email me if you need more explanation.
>>>
>>> It is kind of like a multi variable search engine, that is finding the
>>> root cause of the symptoms that are the very best fit given the
>>> multi-variables...
>>>
>>> Thanks heaps for any assistance,
>>> Aslan.
>>>
>>>
>>>
>>>   
>> --
>> Jim Lucas
>>
>>   "Some men are born to greatness, some achieve greatness,
>>   and some have greatness thrust upon them."
>>
>> Twelfth Night, Act II, Scene V
>>by William Shakespeare
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>> 
>
>   


Re: [PHP] Help with an error...

2008-07-24 Thread Micah Gersten
You cannot have commands in the middle of a string.  Try building a
string first, or use output buffering and then capture the buffer and
use that as the string for the mail function.

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



[EMAIL PROTECTED] wrote:
> Hi,
>
> I am  currently working on a php script that will be called by cron. But I
> have an error that keeps coming up.
>
> Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on
>
> What I am trying to do is a simple php script to send me a report
> everynight. Any clues as to why? Also does anyone know of a site with mail
> srcipts that are ran on the cli?
>
> -
>  $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
>
> //This is a simple email to give me the status from yesterday.
> //This connect the script to the db
> require_once('mysql_connect.inc');
>
> $query = "Select ip, date, time, CONCAT(city, ', ',country) as location
> from ips where country !=' ' and date = current_date() order by
> date,time,country asc;";
> $result = mysql_query($query)
>
> $mailsend = mail("[EMAIL PROTECTED]","The IP's that Attacked
> $hostname", "The following are ip's that have try to attack your
> system.\r\n\r\
>
>
> if ($result) { //if that ran ok, display the record
> echo " Country  # of
> Attacks
> ";
>
> //fetch and print the records
>
> while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
> echo "$row[0] align=\'right\'>$row[1]";
> }
>
> echo '';
>
> mysql_free_result ($result); //free up the resources
>
> } else {  //if did not run ok
>
> echo 'This could not be display due to a system error.
> We apologize
> fore any incovenience.'. mysql_error() . '';
>
> }
>
> ","From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]");
> print("$mailsend");
> ?>
>
>
>
>
>   

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



Re: [PHP] Help with an error...

2008-07-24 Thread Micah Gersten
He had code blocks in the middle of a string.  That's what I was
referring to.

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



Ted Wood wrote:
>
> Micah,
>
> Please provide an example of what your response was referring to in
> the original message.
>
> And it is possible to have commands in the middle of a string by using
> concatenation.
>
>$str = "My name is ".strtoupper($name).'", but you can call me
> Sam.";
>
>
> ~Ted
>
>
>
> On 24-Jul-08, at 10:40 AM, Micah Gersten wrote:
>
>> You cannot have commands in the middle of a string.  Try building a
>> string first, or use output buffering and then capture the buffer and
>> use that as the string for the mail function.
>>
>> Thank you,
>> Micah Gersten
>> onShore Networks
>> Internal Developer
>> http://www.onshore.com
>>
>>
>>
>> [EMAIL PROTECTED] wrote:
>>> Hi,
>>>
>>> I am  currently working on a php script that will be called by cron.
>>> But I
>>> have an error that keeps coming up.
>>>
>>> Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on
>>>
>>> What I am trying to do is a simple php script to send me a report
>>> everynight. Any clues as to why? Also does anyone know of a site
>>> with mail
>>> srcipts that are ran on the cli?
>>>
>>> -
>>> >> $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
>>>
>>> //This is a simple email to give me the status from yesterday.
>>> //This connect the script to the db
>>> require_once('mysql_connect.inc');
>>>
>>> $query = "Select ip, date, time, CONCAT(city, ', ',country) as location
>>> from ips where country !=' ' and date = current_date() order by
>>> date,time,country asc;";
>>> $result = mysql_query($query)
>>>
>>>$mailsend = mail("[EMAIL PROTECTED]","The IP's that Attacked
>>> $hostname", "The following are ip's that have try to attack your
>>> system.\r\n\r\
>>>
>>>
>>>if ($result) { //if that ran ok, display the record
>>>echo " Country 
>>> # of
>>> Attacks
>>> ";
>>>
>>>//fetch and print the records
>>>
>>>while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
>>>echo "$row[0]>> align=\'right\'>$row[1]";
>>>}
>>>
>>>echo '';
>>>
>>>mysql_free_result ($result); //free up the resources
>>>
>>>} else {  //if did not run ok
>>>
>>>echo 'This could not be display due to a system
>>> error.
>>> We apologize
>>> fore any incovenience.'. mysql_error() . '';
>>>
>>>}
>>>
>>> ","From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]");
>>> print("$mailsend");
>>> ?>
>>>
>>>
>>>
>>>
>>>
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>

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



Re: [PHP] Help with an error...

2008-07-24 Thread Micah Gersten
It seems like you're still calling functions inside the string.  Instead
of concatenating, try the output buffering like was mentioned before. 
Also, if you want HTML tags in your PHP code, you need to end and start
the PHP tags again, or print them as output in quotes.

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



Payne wrote:
> Jim Lucas wrote:
>> So, to summarize everything said, with my own added notes.
>>
>> [EMAIL PROTECTED] wrote:
>>> Hi,
>>>
>>> I am  currently working on a php script that will be called by cron.
>>> But I
>>> have an error that keeps coming up.
>>>
>>> Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on
>>>
>>> What I am trying to do is a simple php script to send me a report
>>> everynight. Any clues as to why? Also does anyone know of a site
>>> with mail
>>> srcipts that are ran on the cli?
>>>
>>> -
>>> >
>>
>> The following wont work if you use this from the CLI.  There is not
>> remote addr.
>>> $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
>>>
>>> //This is a simple email to give me the status from yesterday.
>>> //This connect the script to the db
>>> require_once('mysql_connect.inc');
>>>
>>
>> Loose the semi-colon at the end of your SELECT statements.  The mysql
>> extension for PHP will add it on its own.
>>
>>> $query = "Select ip, date, time, CONCAT(city, ', ',country) as location
>>> from ips where country !=' ' and date = current_date() order by
>>> date,time,country asc;";
>>
>> You missed a semi-colon at the end of this line
>>> $result = mysql_query($query)
>>>
>>> $mailsend = mail("[EMAIL PROTECTED]","The IP's that Attacked
>>> $hostname", "The following are ip's that have try to attack your
>>> system.\r\n\r\
>>>
>>>
>>
>> You can't do this within a function call.  Like someone else said,
>> you need to run the if/else and while portion before you mail call. 
>> Capture that data and then add it to the mail call.
>>
>>> if ($result) { //if that ran ok, display the record
>>> echo " Country
>>>  # of
>>> Attacks
>>> ";
>>>
>>> //fetch and print the records
>>>
>>> while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
>>> echo "$row[0]>> align=\'right\'>$row[1]";
>>> }
>>>
>>> echo '';
>>>
>>> mysql_free_result ($result); //free up the resources
>>>
>>> } else {  //if did not run ok
>>>
>>> echo 'This could not be display due to a system
>>> error.
>>> We apologize
>>> fore any incovenience.'. mysql_error() . '';
>>>
>>> }
>>>
>>> ","From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]");
>>> print("$mailsend");
>>> ?>
>>>
>>>
>>>
>>>
>>
>> So here is the code re factored.
>>
>> >
>> # Setup your variables for later use.
>> $recipient = '[EMAIL PROTECTED]';
>> $subject   = 'The IP\'s that Attacked';
>> $add_headers[] = 'From: [EMAIL PROTECTED]';
>> $add_headers[] = 'Reply To: [EMAIL PROTECTED]';
>> $separator = "\r\n";
>>
>> //This is a simple email to give me the status from yesterday.
>> //This connect the script to the db
>> require_once('mysql_connect.inc');
>>
>> $query = "
>> SELECT   ip,
>>  date,
>>  time,
>>  CONCAT(city, ', ',country) as location
>> FROM ips
>> WHEREcountry != ''
>>   ANDdate = current_date()
>> ORDER BY date, time, country asc
>> ";
>>
>> $result = mysql_query($query);
>>
>> ob_start();
>> echo <<> The following are ip's that have try to attack your system.
>>
>> TXT;
>>
>> //if that ran ok, display the record
>> if ($result) {
>>   echo <<>
>> Country# of Attacks
>> TABLE;
>>
>>   //fetch and print the recor

Re: [PHP] Regular Expression help need

2008-07-25 Thread Micah Gersten
Are you trying to make it xml compatible or XHTML compatible?  '&' is
not valid HTML or XHTML as it has special meaning. If you want it to
adhere to the standard and display correctly, you must use '&'

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



Shelley wrote:
> Hi Richard,
>
> Not exactly actually.
>
> What I mean is:
> Before: hi Richard>, & good morning<
> After:   hi Richard>, & good morning<
>
> I hope it's clear now.
>
> On Fri, Jul 25, 2008 at 7:53 PM, Richard Heyes <[EMAIL PROTECTED]>
> wrote:
>
>   
>>> How can I make a string with & (NOT &, >, < or "), <, >
>>>   
>> xml
>> 
>>> compatible?
>>> What is the expression to use?
>>>   
>> Not entirely sure what you're after (try posting some before and after
>> snippets), but by the sounds of it you don't need a regular expression
>> - strtr() will work for you. Or str_replace().
>>
>> --
>> Richard Heyes
>> http://www.phpguru.org
>>
>> 
>
>
>
>   

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



Re: [PHP] Help with an error...

2008-07-25 Thread Micah Gersten

Philip Thompson wrote:
> On Jul 24, 2008, at 12:40 PM, Micah Gersten wrote:
>
>> You cannot have commands in the middle of a string.
>
> Technically you can.
>
>  $str = "Hi, my name is " . $this->getName();
This is correct, but is not in the middle of the string.
> // or
> $str = "Hi, my name is $this->getName()";
> echo $str;
> ?>
>
> ~Philip
>
>

This does not work.

>> Try building a
>> string first, or use output buffering and then capture the buffer and
>> use that as the string for the mail function.
>>
>> Thank you,
>> Micah Gersten
>> onShore Networks
>> Internal Developer
>> http://www.onshore.com
>>
>>
>>
>> [EMAIL PROTECTED] wrote:
>>> Hi,
>>>
>>> I am  currently working on a php script that will be called by cron.
>>> But I
>>> have an error that keeps coming up.
>>>
>>> Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on
>>>
>>> What I am trying to do is a simple php script to send me a report
>>> everynight. Any clues as to why? Also does anyone know of a site
>>> with mail
>>> srcipts that are ran on the cli?
>>>
>>> -
>>> >> $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
>>>
>>> //This is a simple email to give me the status from yesterday.
>>> //This connect the script to the db
>>> require_once('mysql_connect.inc');
>>>
>>> $query = "Select ip, date, time, CONCAT(city, ', ',country) as location
>>> from ips where country !=' ' and date = current_date() order by
>>> date,time,country asc;";
>>> $result = mysql_query($query)
>>>
>>>$mailsend = mail("[EMAIL PROTECTED]","The IP's that Attacked
>>> $hostname", "The following are ip's that have try to attack your
>>> system.\r\n\r\
>>>
>>>
>>>if ($result) { //if that ran ok, display the record
>>>echo " Country 
>>> # of
>>> Attacks
>>> ";
>>>
>>>//fetch and print the records
>>>
>>>while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
>>>echo "$row[0]>> align=\'right\'>$row[1]";
>>>}
>>>
>>>echo '';
>>>
>>>mysql_free_result ($result); //free up the resources
>>>
>>>} else {  //if did not run ok
>>>
>>>echo 'This could not be display due to a system
>>> error.
>>> We apologize
>>> fore any incovenience.'. mysql_error() . '';
>>>
>>>}
>>>
>>> ","From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]");
>>> print("$mailsend");
>>> ?>
>

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



Re: [PHP] Regular Expression help need

2008-07-26 Thread Micah Gersten
Are you talking about looking at blogs in a mobile phone browser or
actually downloading the blog into another format?

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



Shelley wrote:
> Ok, let me tell you what i want to achieve.
> I want to transfer users' blog onto mobile phone, so I should convert
> characters such as >, <, & (but not &, or >, or <, etc) into
> xml compatible ones, >, < &.
>
> Maybe there is some problem in my expression?
>
> Waiting for your response...
>
> On Sat, Jul 26, 2008 at 3:30 AM, Micah Gersten <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Are you trying to make it xml compatible or XHTML compatible?  '&' is
> not valid HTML or XHTML as it has special meaning. If you want it to
> adhere to the standard and display correctly, you must use '&'
>
> Thank you,
> Micah Gersten
> onShore Networks
> Internal Developer
> http://www.onshore.com
>
>
>
> Shelley wrote:
> > Hi Richard,
> >
> > Not exactly actually.
> >
> > What I mean is:
> > Before: hi Richard>, & good morning<
> > After:   hi Richard>, & good
> morning<
> >
> > I hope it's clear now.
> >
> > On Fri, Jul 25, 2008 at 7:53 PM, Richard Heyes
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> > wrote:
> >
> >
> >>> How can I make a string with & (NOT &, >, < or
> "), <, >
> >>>
> >> xml
> >>
> >>> compatible?
> >>> What is the expression to use?
> >>>
> >> Not entirely sure what you're after (try posting some before
> and after
> >> snippets), but by the sounds of it you don't need a regular
> expression
> >> - strtr() will work for you. Or str_replace().
> >>
> >> --
> >> Richard Heyes
> >> http://www.phpguru.org
> >>
> >>
> >
> >
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> -- 
> With best regards,
> Shelley Shyan
> http://phparch.cn

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



Re: [PHP] It may be OT. phpmyadmin not opening.

2008-07-26 Thread Micah Gersten
I thought wampp was deprecated.  Try xampp:
http://www.apachefriends.org/en/index.html

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



mukesh yadav wrote:
> hi ,
>   sorry for posting here.I really dont know where to post I asked in the
> mysql IRC they said it doesn't belongs to them.
>
> here is my question. I have installed Wampp and i'm not able to open
> phpmyadmin from networked pc.
> Though i can open the pages. but not phpmyadmin.
>
>
> thank you sorry again.
>
>   

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



Re: [PHP] Start/Stop Service from program php

2008-07-26 Thread Micah Gersten
Generally, apache runs as www-data.  What was the output of the command?

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


I need write a script execute some command, but try start or stop service
like named, network this don't work

I edit visudo and add the next lines

User_Alias MYGROUP = apache, xyz


[EMAIL PROTECTED] wrote:
> Hi
>
> I try execute unsucesfull the next code from web page
>
>  $cmd1 = shell_exec ("sudo /sbin/service named stop");
> echo "$cmd1";
> ?>
>
> I need write a script execute some command, but try start or stop service
> like named, network this don't work
>
> I edit visudo and add the next lines
>
> User_Alias MYGROUP = apache, xyz
> Cmnd_Alias MYCOMMAND = /sbin/service
> %MYGROUP ALL = MYCOMMAND
> %MYGROUP ALL=(ALL) NOPASSWD: ALL
>
> But don't work.
>
> Suggest? Thanks ...
>
>   

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



Re: [PHP] foreach question

2008-07-29 Thread Micah Gersten
You cannot do this:
$row[] = $result;   

You need to loop around this:
$row = mysql_fetch_assoc($result);

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



Jason Pruim wrote:
> Hey Everyone...
>
> So I am attempting to pull 2 random records from a MySQL database, so
> I wrote a function which I'll paste below. I had it mostly working
> with a while() statement, but I wanted to try a foreach to see if I
> could get the formatting a little bit better.
>
> Basically... What it does is grab 2 records at random from the
> database, and display the images. What I want is something that looks
> like this:  VS 
>
> right now though... I'm at a lose to figure out why it's not returning
> any records but not throwing any errors... Any ideas what I'm missing?
>
>  //function for pulling random pictures from the database
>
>
> function random($random){
> 
> $randomQuery = "SELECT * FROM `current` ORDER BY Rand() LIMIT 2";
>
> $result = mysql_query($randomQuery);
> $row[] = $result;   
>
>
> foreach($row as $key => $value) {
> $random[$key] = $value;
>
> }
>
> return $random;
>
> }//End of function
>
>
> ?>
>
> Any ideas?
>
>
>

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



Re: [PHP] limiting the amount of emails sent at a time in a batch send

2008-07-29 Thread Micah Gersten
Here's a PEAR package that handles this:
http://pear.php.net/package/Mail_Queue/

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



Richard Kurth wrote:
> I want to limit these script two send 100 email and then pause for a
> few seconds and then send another 100 emails and repeat this tell it
> has sent all the emails that are dated for today. This script is runs
> by cron so it is running in the background.
>
> How would I do this and is it the best way to do it. I am using swift
> mailer to send the mail.
>
> I think I would use limit 100 in the query but how would I tell it to
> get the next 100.
>
> $today = date("Y-m-d");
> # Cache the Contact that will recive campain messages today
> $query = "SELECT emailmessages. * , contacts.* FROM emailmessages,
> contacts WHERE emailmessages.contact_id = contacts.id  AND
> emailmessages.nextmessagedate = '$today' AND contacts.emailstatus =
> 'Active'";  $DB_Contact_Result = mysql_query($query);
> if (!$DB_Contact_Result) {
>die('Invalid query: ' . mysql_error());
> }
> while ($this_row = mysql_fetch_array ($DB_Contact_Result)){
>
> $CustomerID=$this_row["id"];
>
> //get the message for the contact
> $query1 = "SELECT * FROM emailcampaign where member_id =
> '$this_row[members_id]' AND campaign_id = '$this_row[emailcampaign]'
> AND day = '$this_row[email_number]'";
>
> $DB_Mail_Result =  mysql_query($query1);
> if (!$DB_Mail_Result) {
>die('Invalid query: ' . mysql_error());
> }
> $Mail_row = mysql_fetch_array($DB_Mail_Result);
> //get member stuff
> $query2 = "SELECT * FROM member where members_id =
> '$this_row[members_id]'";
>
> $DB_Member_Result =  mysql_query($query2);
>  if (!$DB_Member_Result) {
>die('Invalid query: ' . mysql_error());
> }
>
> $subject=stripslashes($Mail_row['subject']);
>
> $message=stripslashes($Mail_row['textmessage']);
>
> $hmessage=stripslashes($Mail_row['htmlmessage']);
>
> $swiftPlain = $message;
> $MailFrom1=$this_row['emailaddress'];
> $MailFromName1=$this_row['firstname'];
>
> $full_name=stripslashes($this_row['firstname']) ." " .
> stripslashes($this_row['lastname']);
> //Create the message
> $message = new Swift_Message($subject);
> $message->attach(new Swift_Message_Part($swiftPlain));
> $message->attach(new Swift_Message_Part($swiftHtml, "text/html"));
> $message->setReturnPath($MailAddReplyTo);
> $message->setReplyTo($MailFrom1,$MailFromName1);
> //Now check if Swift actually sends it
> $swift->send($message,
> $this_row['emailaddress'],$MailFrom1,$MailFromName1);
>
> #After we send the email we need to update the database to send the
> next message
> # get the next message number
> $nextday=getnextday(stripslashes($this_row['emailcampaign']),stripslashes($this_row['members_id']),stripslashes($this_row['email_number']));
>
> # get the new dates
> $newdate=getnewdate(stripslashes($this_row['emailstarted']),$nextday);
> #update the emailmessages
> //unsubscribecode
> updateemailmessages($unpass,$nextday,$newdate,stripslashes($this_row['em_id']),stripslashes($this_row['email_number']));
>
>
>
>
> }//end of mail loop
>
>

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



Re: [PHP] Why PHP4?

2008-07-30 Thread Micah Gersten
Sometimes deprecation is necessary is a language feature is created out
of necessity but is superseded by a superior language form.
A great example is the HTML FONT tag.  Font tags slow down downloads and
renderings, and were deprecated in favor of CSS style sheets which offer
much more control and a smaller footprint.

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



Hélio Rocha wrote:
> Sorry to disagree,
>
> But I think that with PHP4 a lot of people start thinking that they could be
> programmers (maybe they can, developers it's another story). When php5 came
> they didn't know how do deal with the deprecated methods and worst, some
> hosters didn't know how to virtualize a f1ck1n' server with Apache+PHP5. A
> lot of mistakes were made when php5 came out but how can a language grow up
> when they DEPRECATE the syntax? we're not talking about removing the last
> ';'...
> Maybe I'm in a "GET LOST PHP" phase but I think that someone is killing it,
> and the ones who are stuck in 4 are not helping.
>
> When U write code, U must not be worried 'bout the next upgrade of your
> server!
>
>
> Best regards!
>
> On Wed, Jul 30, 2008 at 3:31 AM, VamVan <[EMAIL PROTECTED]> wrote:
>
>   
>> Its because PHP got really famous with version 4.0 and many people actually
>> converted their CGI or other websites in to PHP 4 websites because it was
>> easy and cheap. But 5.0 brought too many changes like serious OOPS and
>> register global concepts for security, which is useful but made transition
>> difficult. I feel thats why PHP 4 is still supported.
>>
>> Its not only the language that has changed, but also people had to upgrade
>> their skill set and there was some learning curve involved.
>>
>> Unfortunately everyone fell in the trap of register globals which was not
>> dealt until php 4.3.1 as a security concept. Pear and Pecl were there but
>> everyone was pretty much writing all the code (reinventing the wheel) from
>> scratch. This brings in huge code base to change.
>>
>> I liked PHP because intitially it was a procedural langauge and it
>> resembled
>> C. But now with OOPS you can build powerful websites which is good.
>>
>> There are many other  cases but I feel strongly this is what makes them
>> still support PHP 4.
>>
>> Thanks
>>
>> 
>
>   

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



Re: [PHP] Why PHP4?

2008-07-30 Thread Micah Gersten
Sometimes speed improvements require removing things.  If you end up
backwards supporting everything you end up with a big monster engine
that is incredibly slow.

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



Hélio Rocha wrote:
> Brainfuck rox! LOL :)
>
> Sure you must see the changelog and other things but take a look:
> I can do more and better things with the next generation of the language in
> which i wrote my app, but i don't think that it's fair that my app doens't
> compile (if it was a compiled language) or stops executing just because i
> get an upgrade.
>
> On Wed, Jul 30, 2008 at 10:56 AM, Richard Heyes <[EMAIL PROTECTED]>wrote:
>
>   
>>> Sorry to disagree,
>>>   
>> That's nothing to apologise for.
>>
>> 
>>> But I think that with PHP4 a lot of people start thinking that they could
>>>   
>> be
>> 
>>> programmers (maybe they can, developers it's another story). When php5
>>>   
>> came
>> 
>>> they didn't know how do deal with the deprecated methods and worst, some
>>> hosters didn't know how to virtualize a f1ck1n' server with Apache+PHP5.
>>>   
>> A
>> 
>>> lot of mistakes were made when php5 came out but how can a language grow
>>>   
>> up
>> 
>>> when they DEPRECATE the syntax? we're not talking about removing the last
>>>   
>> That's not the problem of the PHP developers. Learning is not a case
>> of spend a few years doing it and you're set - it's a life long thing.
>>
>> 
>>> Maybe I'm in a "GET LOST PHP" phase but I think that someone is killing
>>>   
>> it,
>> 
>>> and the ones who are stuck in 4 are not helping.
>>>   
>> There are alternatives - have you heard of Brainfuck?
>>
>> 
>>> When U write code, U must not be worried 'bout the next upgrade of your
>>> server!
>>>   
>> Of course you should. Writing code with every eventuality in mind is
>> simply ludicrous. And you really should expect things to change when
>> major versions are changed - that's why release notes exist.
>>
>> --
>> Richard Heyes
>> http://www.phpguru.org
>>
>> 
>
>   

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



Re: [PHP] Creating new site

2008-07-30 Thread Micah Gersten
Depending on the size of the site, you might want to consider a PHP
framework to start with.  There's usually no point in reinventing the
wheel.  Someone mentioned CakePHP which utilizes MVC.  I'm looking into
porting my stuff to the Zend Framework which makes MVC optional, but has
a lot of functionality make available.

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



Raido wrote:
> Hi,
>
> There are many sites explaining how to build new site etc but I'd like
> to hear what You suggest. (about how to plan whole thing and how to
> write separate parts which can be put together later)
>
> I have build many small sites for myself(site to organise class
> assembly which is like yearly convention..it has user administration
> etc) but they all are anything else than OOP. But now, I need to help
> with creating one bigger site which should be OOP. That site should
> include user management(each user has it's own profile), each user can
> post job and other adds in different categories. (there will be many
> categories for example 'work,cars,training,apartments'.)
> And users profile should show ads posted by himself.
> Logic itself is simple:
> 1) unregistered user:
> a) I go to site, I see categories (work offers, apartment offers,
> training offers, etc)
> b) I click on category I'm interested in
> c) I see ad that I'm interested in
> d) I click on it
> c) I see detailed information about it(which company posted it etc)
> d) at bottom page I see form where I can contact with ad author
> 2) registered user
> a) I go to site
> b) I log in, my profile page opens
> c) there I can see ads posted by me..also I can see how many times
> ad is viewed etc
> d) i click on link 'Post new ad'
> e) there i choose category and probably Ajax helps to load
> specific fields(for example if I choose 'Cars' as category, then
> fields like  'year,transmission,color, etc' will appear.
>
> That is short summary what that site should do. It seems quite big for
> me so I'd be happy to hear any guidelines from people who have built
> big sites.
>
> Creating forms, posting data, user login etc, these things are not
> problem... problem is: how to build the whole thing aimed to OOP and
> use with Smarty to keep things organized.
>
> I'm not sure but I have idea about what things I should do first:
>
> 1) think and write down any function that needs to be done(for example
> different validations, functions for showing/posting form etc)
> 2) plan and create database?
> 3) create database class which handles database connection
> But what next? Or am I starting all wrong?
>
> Big thanks in advance,
>
>
> Raido
>
>
>

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



Re: [PHP] accessing variables within objects

2008-07-30 Thread Micah Gersten
You might want to check the scope of the properties.  If you want to
access them outside of the class, make sure they are declared public.

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



Marten Lehmann wrote:
> Hello,
>
> I'm using some php-classes which worked fine with php-5.0.4. Now I
> tried to upgrade to php-5.2.6, but the classes give a lot of errors.
> If I set
>
> error_reporting(E_ALL);
>
> I see messages like
>
> Notice: Undefined property: FastTemplate::$main in
> /whereever/inc.template.php on line 293
>
> Notice: Undefined property: current_session::$cust_id in
> /whereever/inc.init.php on line 117
>
> In inc.template.php there are a lot of calls like $this->$key. In
> inc.init.php there are calls like $session->cust_id.
>
> What has changed in php-5.2.x so that these calls don't work any more?
> What is the new, required form to use objects in a similar manner
> (unfortunately I have no ressources to code these classes from
> scratch)? Thanks.
>
> Kind regards
> Marten
>

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



Re: [PHP] Using $_GET for POST

2008-07-30 Thread Micah Gersten
This page can help you understand them better:
http://us2.php.net/manual/en/language.variables.superglobals.php

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



Edward Diener wrote:
> In handling an HTTP POST request I came across some PHP code, which I
> need to modify for my own purposes, which has code like this:
>
> if ( ! (isset($_GET['x']) && $_GET['x'] == 20) )
>{   
>// Do something by returning an error
>}
>
> Can this ever be correct when the form looks like:
>
> 
> 
> 
>
> ?
>
> Is the $_GET possibly being used to check for an 'x' parameter
> being passed in the query part of the URL ?
>
> I am fairly new to PHP so I am trying to understand how $_GET differs
> from $_POST. Thanks !
>

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



Re: [PHP] upload file problem

2008-07-31 Thread Micah Gersten
Maybe check the return value of the function:
http://us3.php.net/manual/en/function.move-uploaded-file.php

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



Jignesh Thummar wrote:
> I'm trying to upload the file. It's showing me successfully uploaded.
> But it's not able to move from temp directory to my defined directory
>
> my code:
>
> if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
>move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
>echo "File ". $_FILES['myfile']['name'] ." uploaded successfully.\n";
> } else {
>  echo "File uploading error";
> }
>
> Thanks in advance.
>
> -Jignesh
>
>   

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



Re: [PHP] accessing variables within objects

2008-07-31 Thread Micah Gersten
Here's the PHP doc page.
Let us know if you have more questions:
http://us3.php.net/manual/en/language.oop5.overloading.php

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



Philip Thompson wrote:
> On Jul 30, 2008, at 1:29 PM, Jim Lucas wrote:
>
>> Marten Lehmann wrote:
>>> Hello,
>>> I'm using some php-classes which worked fine with php-5.0.4. Now I
>>> tried to upgrade to php-5.2.6, but the classes give a lot of errors.
>>> If I set
>>> error_reporting(E_ALL);
>>> I see messages like
>>> Notice: Undefined property: FastTemplate::$main in
>>> /whereever/inc.template.php on line 293
>>> Notice: Undefined property: current_session::$cust_id in
>>> /whereever/inc.init.php on line 117
>>> In inc.template.php there are a lot of calls like $this->$key. In
>>> inc.init.php there are calls like $session->cust_id.
>>
>> to fix these errors, you would need to modify the code so it does
>> something like this.
>>
>> where it calls $this->$key you need to check and make sure that $key
>> exists before you trying call for it.
>>
>> So something like this would work.
>>
>> if ( isset( $this->$key ) ) {
>> $this->$key;
>> } else {
>> $this->$key = null;
>> }
>>
>> You didn't show any context in which you are using the above code. So
>> I don't know what will actually work in your situation.  Show a
>> little more code that includes the method in which $this->$key is
>> called.
>>
>> You will want to look at using the Overloading feature of PHP5. 
>> Check out this page for overloading examples
>>
>> http://us2.php.net/manual/en/language.oop5.overloading.php
>>
>> Take note of the __get() and __set() methods.  The __get method
>> checks to see if the key exists before it tries working with it.
>
> Ok, I'm trying to understand the point to using these overloading
> methods.
>
>  $obj = new ClassThatUsesOverloading ();
> $obj->hi = 'Hi';
> $obj->bye = 'Bye';
>
> echo $obj->hi, ' ', $obj->bye;
> // Output: Hi Bye
> ?>
>
> You could have done that or you could do the following.
>
>  $obj = new ClassThatDoesntUseOverloading ();
> $obj->setHi('Hello');
> $obj->setBye('Bye Bye!');
>
> echo $obj->hi(), ' ', $obj->bye();
> // Output: Hello Bye Bye!
> ?>
>
> The 2nd way seems more *OOP* than the first - weird to explain. I
> guess what I'm wanting to know is why would you use overloading
> (in PHP)? The only reason I can think of is to avoid having to
> create/use accessors. Please help me understand! But please be nice! =D
>
> Thanks,
> ~Philip
>
>
>>> What has changed in php-5.2.x so that these calls don't work any
>>> more? What is the new, required form to use objects in a similar
>>> manner (unfortunately I have no ressources to code these classes
>>> from scratch)? Thanks.
>>> Kind regards
>>> Marten
>

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



Re: [PHP] accessing variables within objects

2008-07-31 Thread Micah Gersten
Sorry about that, I forgot you got that link already.

Here's an answer for you:
I use overloading to dynamically call a function in another object if
the current object does not have it.  It helps because PHP does not
support multiple inheritance.

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



Philip Thompson wrote:
> On Jul 31, 2008, at 11:48 AM, Micah Gersten wrote:
>
>> Here's the PHP doc page.
>> Let us know if you have more questions:
>> http://us3.php.net/manual/en/language.oop5.overloading.php
>
> Yeah, I got the link the first time and read the page. But I was
> looking for a little bit more explanation...
>
> Thanks anyway,
>
> ~Philip

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



Re: [PHP] Dynamic Select Lists - 1st Selection Effects 2nd!

2008-07-31 Thread Micah Gersten
Maybe you should try this library.  It comes with examples and is fairly
easy to implement.
http://xajaxproject.org/

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



Rahul S. Johari wrote:
>
> In theory your solution sounds extremely feasible & perhaps the
> appropriate procedure. My problem is that I'm not an expert at all in
> AJAX (Or javascript for that matter). The manually-fed examples I
> worked with were freely available sources for such a functional Select
> List, and I tried manipulating them to fit in my php/mySQL code but to
> no avail.
>
> I'll try & work this out, but I doubt I'll be able to.
>
> Thanks.
>
> ---
> Rahul Sitaram Johari
> Founder, Internet Architects Group, Inc.
>
> [Email][EMAIL PROTECTED]
> [Web]http://www.rahulsjohari.com

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



Re: [PHP] Dynamic Select Lists - 1st Selection Effects 2nd!

2008-07-31 Thread Micah Gersten
What I usually do is default to the most common country and show the
associated states.
You can change the states if they change the country.

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



Andrew Ballard wrote:
> On Thu, Jul 31, 2008 at 12:40 PM, Rahul S. Johari
> <[EMAIL PROTECTED]> wrote:
>   
>> Ave,
>>
>> What I have is two Select (Drop-Down) lists (State & County) and I'm
>> populating them from a mySQL table. What I want is when the user selects the
>> State from the State List, the County List should only pull out counties
>> associated with that State.
>> 
> [snip]
>
> This is a usability issue rather than a code issue, but wouldn't you
> want that to be the other way around? (ie, select the country from a
> list and it populates the state list with
> states/provinces/territories/adminstrative disticts/etc. that belong
> to that country?) I know the order is "backward" from how one
> typically writes an address on paper, but otherwise your state list
> will be HUGE and often your country list would only have one value
> after the user selects a state.
>
> Andrew
>
>   

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



Re: [PHP] Dynamic Select Lists - 1st Selection Effects 2nd!

2008-07-31 Thread Micah Gersten
You're right.  Same principles apply though.

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



Boyd, Todd M. wrote:
> *cough*
>
> ...pretty sure he wrote "county", guys. ;)
>
>
> Todd Boyd
> Web Programmer
>   

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



Re: [PHP] HTTP PUT for file uploads

2008-08-01 Thread Micah Gersten
Is this a repetitive thing your clients will do many times?  I recently
created a backup solution using ssh keys and the pecl ssh extension to
automate backups.  Then a cronjob sorts the files on the server.  It's a
lot more secure than allowing PUTs.

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



mike wrote:
> It appears that PHP can support the PUT method using php://stdin and
> appropriately configuring the webserver to accept it.
>
> My company needs a file upload solution that will support large file
> uploads (2GB limit is optional - if we have to tell them less than 2GB
> that's fine) that will keep re-trying the upload until it is done. We
> have slow geo users and then just flat out large files to deal with
> even from fast connections.
>
> There's a variety of Java-based PUT uploaders.
>
> So far, we haven't found any Flash ones (we'd love to NOT use Java) -
> but there is a way to do it apparently, we just can't find anyone
> who's done it yet.
>
> I'm assuming that we should keep the connection open as long as there
> is some activity and maybe timeout after a minute or two... the
> client-side applet should have the logic to continue retrying and
> since it is PUT, the PHP script will accept the data and use fseek()
> on the file to resume at the offset supplied (the client will have to
> give us that info)
>
> See the examples here:
> http://www.radinks.com/upload/examples/ - look at the "Handlers that
> support resume" section.
>
> Anyone have any thoughts? I think I need to tweak PHP settings
> too possibly as well, for max execution time and such. But also any
> uploader ideas would be great.
>
> The reason for using this is FTP/SFTP require logins or some sort of
> "pick up" process or two step process to first upload the file then
> have the user associate it (or a cronjob somehow associate and move
> it) to it's final destination. HTTP isn't the best for file uploads
> but it appears PUT does support resuming, and we just want the
> cleanest possible frontend to it. Java stuff is slow, Flash would be
> better, but it appears Flash only supports basic POST/GET and you have
> to use a third party library (and possibly the latest Flex?) to be
> able to support other HTTP methods. If anyone has any products or
> knows of any projects, open source solutions would be best but money
> is not an object basically so we'd be open to commercial ones as well.
> We want the least amount of work for the end-user, so no thick clients
> and hopefully the most compact [cross-platform] browser applet as
> well. (I am assuming Flash does finally work on Linux)
>
>   

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



Re: [PHP] E-Shop system

2008-08-04 Thread Micah Gersten


Alain Roger wrote:
> Hi,
>
> i'm currently analyzing an e-shop system.
> i understand how to display products and so on, however i still have some
> question marks on the following topics:
>
> 1. what is the best way for showing product image ?
> - to store them in DB or onto filesystem as simple image files ?
> - each product should have 2 images (1 small when user browser the
> catalogue, 1 huge (standard) when user wants to see how product looks like).
> Should be 1 or 2 images ? I mean should i store in DB/filesystem the
> standard file and reduce size for user browsing ?
>   
I usually store the name in the DB and the image on the FS.
> 2. billing interaction
> basically i was thinking to allow users to pay via PayPal, Bank2Bank and by
> credit card.
> - What i do not understand is how can i interact with such third party
> company ?
> - for paypal: how can i redirect user to PayPal and pay to my account and
> how to get back information that he paid (and that i can send the good) ?
> - Bank transfer: how can i control it ?
> - Credit card payment: how can i be sure that when user give me his credit
> card number, my application will secure it enough ? how can i get back
> information that it's true...user paid the good and i can send him the
> product ?
>
> thanks a lot for all your feedback.
>
>   
Paypal can handle itself, Bank Transfers and Credit Cards for you.  They
have nice APIs.

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


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



Re: [PHP] PHP querying mysql db for data limited to the last month

2008-08-04 Thread Micah Gersten
1.  To get last months date, you can use strtotime("1 month ago")
instead of mktime.
2.  I don't see anywhere in the code where you are limiting by date. 
Try using > and <.  Between is tricky on dates.

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



Vinny Gullotta wrote:
> So I have this code I'm working with (pasted below) that queries a
> mysql db table called timetracking. The goal of the page is to search
> the db for all data based on a certain engineer, sorted by product and
> it takes pre-defined values based on actions performed, sums them
> based on product and display's the percentage of time an engineer has
> spent on each product. Everything works great except I need to limit
> the results to the last months data only, but everything I try seems
> to just break it. Can anyone push me in the right direction a little?
> I have tried using BETWEEN in the SELECT statement, some while
> statements and if statements, and all I do is keep breaking it. If
> anyone has any ideas, it would be exceptionally helpful.
>
> Thanks in advance,
> Vinny
>
>
>  $total = 0;
> $today = date('Y-m-d h:i:s');
> $monthago = date("Y-m-d h:i:s", mktime(date("h"), date("i"),
> date("s"), date("m")-1, date("d"),   date("Y")));
> echo "Today = ", $today;
> echo "One Month Ago = ", $monthago, "";
>
> $query = "SELECT *, SUM(timespent) FROM timetracking WHERE engineer =
> '$engineer' GROUP BY product";
> $result = mysql_query($query) or die(mysql_error());
> $result2 = mysql_query($query) or die(mysql_error());
> echo "";
>
>  while($row = mysql_fetch_array($result)){
>   $total = $row['SUM(timespent)'] + $total;
>  }
>  while($row = mysql_fetch_array($result2)){
>   $perc = $row['SUM(timespent)'] * 100 / $total;
>   echo "[ ", $row[product]. " = ".
> number_format($perc,2), "% ]";
>  }
>
> ?>
>
>

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



Re: [PHP] Regular Expression by Exception

2008-08-04 Thread Micah Gersten
I don't know how to use the POSIX classes, but if you use preg_replace:
preg_replace("/[^$params]/", '', $string);

I think this will work.

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



Alberto García Gómez wrote:
> Fellows:
>
> If I use ereg_replace($params, $string) I can replace the char that
> match with $params in the $string.
>
> BUT, how I can replace ALL chars EXCEPT the chars in $params.
>
> Something like !$params, I think
>
>

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



Re: [PHP] An appeal to your better nature

2008-08-05 Thread Micah Gersten
Seems like 1and1 screwed up their Apache installs.  My site shows a
blank page when I go to the domain, but when I go to index.php, it works.

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



Richard Heyes wrote:
> Hi,
>
> Seems my 1and1 server has finally gone kaput taking my website with
> it, and in the tradition of all good IT professionals, I have no
> backups. :( So this is an appeal to you to ask if you have downloaded
> anything from phpguru.org at all, could you please send it to me so I
> can try to rebuild my site.
>
> A big thanks.
>
>   

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



Re: [PHP] An appeal to your better nature

2008-08-05 Thread Micah Gersten
I'm on a shared host, I should have mentioned that.

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



Richard Heyes wrote:
>> Seems like 1and1 screwed up their Apache installs.  My site shows a
>> blank page when I go to the domain, but when I go to index.php, it works.
>> 
>
> Doubt it's that. When I first got the server I reinstalled practically
> everything.
>
>   

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



Re: [PHP] Echo in __GET()

2008-08-05 Thread Micah Gersten
You can write 2 functions to handle this.

Value and OutputValue

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



Tyler C. wrote:
> Is the a way to have an array, or use __get() to provide different
> data if you are echoing a variable, rather than if you are using it in
> a 'if' statement?
>

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



Re: [PHP] Fatal error: Cannot redeclare

2008-08-05 Thread Micah Gersten
What is around this line?

/global/WEB_DAT/documents/fme/institute/get/lehre/course/lib.php:25


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



Kai Kauer wrote:
> Am Dienstag, 5. August 2008 15:46:42 schrieb Daniel Brown:
>   
>> On Tue, Aug 5, 2008 at 9:37 AM, Kai Kauer <[EMAIL PROTECTED]> wrote:
>> 
>>> Hi @all,
>>>
>>> I was just installing the Moodle-Version 1.9.2 at our university. It was
>>> installed without any problems. But during testing and preparing for use
>>> I got this error message:
>>>
>>> Fatal error: Cannot redeclare make_log_url() (previously declared
>>> in /global/WEB_DAT/documents/fme/institute/get/lehre/course/lib.php:25)
>>> in ./lib.php on line 54
>>>   
>> This is usually a result of the same function include script being
>> included twice, and thus, the function being defined a second time.
>> Check ./lib.php on line 54 and see if it's including itself, or if -
>> for whatever reason - there's two entries in that file starting with
>> "function make_log_url(***)".
>>
>>
>>
>> *** Optional parameters may be enclosed within the parentheses.
>>
>> 
>
> This function make the error message
>
>   
>> function make_log_url($module, $url) {
>> switch ($module) {
>> case 'course':
>> case 'file':
>> case 'login':
>> case 'lib':
>> case 'admin':
>> case 'calendar':
>> case 'mnet course':
>> return "/course/$url";
>> break;
>> case 'user':
>> case 'blog':
>> return "/$module/$url";
>> break;
>> case 'upload':
>> return $url;
>> break;
>> case 'library':
>> case '':
>> return '/';
>> break;
>> case 'message':
>> return "/message/$url";
>> break;
>> default:
>> return "/mod/$module/$url";
>> break;
>> }
>> }
>> 
>
> and is in the whole project just called one time in this function:
>
>   
>> function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0,
>> $perpage=100, $url="", $modname="", $modid=0, $modaction="", $groupid=0) {
>>
>> global $CFG;
>>
>> if (!$logs = build_logs_array($course, $user, $date, $order,
>> $page*$perpage, $perpage, $modname, $modid, $modaction, $groupid)) {
>> notify("No logs found!");
>> print_footer($course);
>> exit;
>> }
>>
>> $courses = array();
>>
>> if ($course->id == SITEID) {
>> $courses[0] = '';
>> if ($ccc = get_courses('all', 'c.id ASC', 'c.id,c.shortname')) {
>> foreach ($ccc as $cc) {
>> $courses[$cc->id] = $cc->shortname;
>> }
>> }
>> } else {
>> $courses[$course->id] = $course->shortname;
>> }
>>
>> $totalcount = $logs['totalcount'];
>> $count=0;
>> $ldcache = array();
>> $tt = getdate(time());
>> $today = mktime (0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
>>
>> $strftimedatetime = get_string("strftimedatetime");
>>
>> echo "\n";
>> print_string("displayingrecords", "", $totalcount);
>> echo "\n";
>>
>> print_paging_bar($totalcount, $page, $perpage,
>> "$url&perpage=$perpage&");
>>
>> echo '> summary="">'."\n"; // echo "> cellspacing=\"0\" summary=\"\">\n"; echo "";
>> if ($course->id == SITEID) {
>> echo "> scope=\"col\">".get_string('course')."\n"; }
>> echo "> scope=\"col\">".get_string('time')."\n"; echo "> scope=\"col\">".get_string('ip_address')."\n"; echo "> header\" scope=\"col\">".get_string('fullname')."\

[PHP] Anyone use FileMaker

2008-08-07 Thread Micah Gersten
I'm wondering if anyone here has experience integrating FileMaker with
PHP using either ODBC or JDBC.

-- 


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


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



[PHP] JDBC Wrapper for PHP

2008-08-07 Thread Micah Gersten
Does anyone know of a JDBC API Wrapper that can be called from PHP?

I'm already using this to connect to Java:
http://php-java-bridge.sourceforge.net/doc/

-- 


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


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



Re: [PHP] Why PHP4?

2008-08-07 Thread Micah Gersten
You can't steal it, but you can't do anything with it either, so what's
the point of having it?

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



V S Rawat wrote:
>
> I was surprised to see some very busy and well to do Chartered
> Accountants, Company Secretaries still using those 8086 pcs with
> Wordstar and lotus that were there on mid 80s.
>
> They say these are no more available so data in these pcs and these
> formats are much more safer than that on a latest machine/ software.

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



  1   2   3   >