OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 9 Aug 2006 23:14:43 -0000 Issue 4284

php-general-digest-helplists.php.net
Date: Wed Aug 09 2006 - 18:14:43 CDT


php-general Digest 9 Aug 2006 23:14:43 -0000 Issue 4284

Topics (messages 240366 through 240418):

sessions no longer work
        240366 by: blackwater dev
        240367 by: Jochem Maas
        240372 by: blackwater dev
        240376 by: blackwater dev

returning to the same page after log in
        240368 by: Sjef
        240373 by: Andrei
        240375 by: Sjef

problem with quotes (single and double) in forms
        240369 by: afan.afan.net

Re: question about how php handles post'd and get'd data
        240370 by: tedd

I only want x number of lines of data
        240371 by: Ross
        240374 by: Brad Bonkoski
        240379 by: Jochem Maas
        240380 by: Robert Cummings

Re: Dividing, and keeping, text from the first space
        240377 by: Robert Cummings
        240378 by: Kevin Murphy
        240381 by: Robert Cummings

Create an EUC-JP encoded file just for download, not to be kept on server
        240382 by: Dave M G
        240385 by: Robert Cummings
        240387 by: Ray Hauge

script stopped worling
        240383 by: Ross

Best way to get PHP5
        240384 by: Chris W. Parker
        240386 by: Jonathan Duncan
        240388 by: Ray Hauge
        240389 by: Brad Bonkoski
        240391 by: Jack Gates
        240392 by: Jochem Maas
        240396 by: Chris W. Parker
        240404 by: Chris W. Parker
        240417 by: Colin Guthrie
        240418 by: Jonathan Duncan

create multidimensional array with n depth
        240390 by: Gunter Sammet
        240393 by: Jochem Maas
        240398 by: tg-php.gryffyndevelopment.com
        240409 by: Robert Cummings

Job Posting
        240394 by: Brent Meshier
        240397 by: Jay Blanchard
        240400 by: Jochem Maas
        240401 by: John Nichel
        240411 by: Jay Blanchard
        240412 by: John Nichel

LAMP Developer Needed - Indianapolis
        240395 by: Brent Meshier
        240403 by: John Nichel
        240405 by: Jay Blanchard
        240406 by: Robert Cummings
        240407 by: Robert Cummings
        240408 by: John Nichel
        240410 by: Jay Blanchard

script stopped working 2..
        240399 by: Ross
        240402 by: Jochem Maas

script stopped working- no output from unserialize()
        240413 by: Ross
        240415 by: Jochem Maas
        240416 by: Robert Cummings

Comment form spammer
        240414 by: Micky Hulse

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hello,

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

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

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

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

Thanks!

attached mail follows:


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

try this here:

session_write_close();

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

attached mail follows:


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

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

On 8/9/06, Jochem Maas <jochemiamjochem.com> wrote:
>
> blackwater dev wrote:
> > Hello,
> >
> > I have a site that was coded a while ago. I was just told that the
> admin
> > side no longer works. I looked and the host recently put php 4.4.2 on
> the
> > site. I have tried a few things but nothing seems to work. The problem
> is
> > once you log in the admin page always kicks you back, doesn't see the
> > session vars. What could be wrong? Here is the code:
> >
> > <?php require_once('Connections/db.php'); ?>
> > <? if (isset($_POST["uname"])){
> > $uname=$_POST["uname"];
> > $pword=md5($_POST["pword"]);
> > $SQL="select * from users where admin=1 and pword='$pword' and
> > uname='$uname'";
> > mysql_select_db($database, $wards);
> > $Result1 = mysql_query($SQL, $wards) or die(mysql_error());
> > $affected_rows = mysql_num_rows($Result1);
> > if ($affected_rows>0){
> > session_start();
> > $_SESSION['wardadmin']="yes";
>
> try this here:
>
> session_write_close();
>
> > header("location: admin.php");
> > }
> > else {$bad="Incorrect username and Password";}
> > }
> >
> > I can echo out the session here and see yes, but I have this code in
> > admin.php
> >
> > <?
> > session_start();
> > if ($_SESSION['wardadmin']!="yes") { header("location: login.php");
> > exit;
> > }
> > ?>
> >
> > Thanks!
> >
>
>

attached mail follows:


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

On 8/9/06, Jochem Maas <jochemiamjochem.com> wrote:
>
> blackwater dev wrote:
> > Sorry if you are getting this multiple times, email is acting a bit
> screwy.
> >
> > Nope. still doesn't work. Sessions just aren't saved.
>
> check that the session save path is writable and have a look to
> see if you are getting a new session id each time.
>
> >
> >
> > On 8/9/06, Jochem Maas <jochemiamjochem.com> wrote:
> >>
> >> blackwater dev wrote:
> >> > Hello,
> >> >
> >> > I have a site that was coded a while ago. I was just told that the
> >> admin
> >> > side no longer works. I looked and the host recently put php 4.4.2on
> >> the
> >> > site. I have tried a few things but nothing seems to work. The
> >> problem
> >> is
> >> > once you log in the admin page always kicks you back, doesn't see the
> >> > session vars. What could be wrong? Here is the code:
> >> >
> >> > <?php require_once('Connections/db.php'); ?>
> >> > <? if (isset($_POST["uname"])){
> >> > $uname=$_POST["uname"];
> >> > $pword=md5($_POST["pword"]);
> >> > $SQL="select * from users where admin=1 and pword='$pword' and
> >> > uname='$uname'";
> >> > mysql_select_db($database, $wards);
> >> > $Result1 = mysql_query($SQL, $wards) or die(mysql_error());
> >> > $affected_rows = mysql_num_rows($Result1);
> >> > if ($affected_rows>0){
> >> > session_start();
> >> > $_SESSION['wardadmin']="yes";
> >>
> >> try this here:
> >>
> >> session_write_close();
> >>
> >> > header("location: admin.php");
> >> > }
> >> > else {$bad="Incorrect username and Password";}
> >> > }
> >> >
> >> > I can echo out the session here and see yes, but I have this code in
> >> > admin.php
> >> >
> >> > <?
> >> > session_start();
> >> > if ($_SESSION['wardadmin']!="yes") { header("location: login.php");
> >> > exit;
> >> > }
> >> > ?>
> >> >
> >> > Thanks!
> >> >
> >>
> >>
> >
>
>

attached mail follows:


Hello all!
This is a bit difficult to explain.
On a site I am building I sometimes use the GET method to forward values to
the next page. There are certain pages that you need to be logged in to to
be able to see data. So you arrive at the page, you realize that you are not
logged in, so you type your username/password and hit 'log in'. Then the
page gets severely messed up as the GET data are not forwarded (at least, I
think that's the problem). Any ideas how to solve this?
I tried to send a header("location: ...") with the document_root and
request_uri as the location, but that doesn't do the trick.

attached mail follows:


        When u know the user is not logged in and you have to redirect him to
login page, get all variables that are in $_GET and in $_POST (if u have
data that u send in post also) and form a string with them as a return
context string like:

The code that you have to put in the page where you redirect the user to
login page and where user will land back after login.

$return_context = $PHP_SELF."?";
foreach( $_GET as $key => $val )
   $return_context .= "&".$key."=".$val;
foreach( $_POST as $key => $val )
   $return_context .= "&".$key."=".$val;

header( "Location: login.php?back_page=".urlencode( utf8_encode(
$return_context ) ) );

In login page, after you created the session or whatever you do at login
pagrt you do:

if( empty( $back_page ) )
    $back_page = $_GET["back_page"];

if( !empty( $back_page ) )
        header( "Location: ".utf8_decode( urldecode( $back_page ) ) );
else
        header( "Location: somewhere_else.php" );
exit;

The code is not checked. It's only to have an ideea...

Andy

Sjef wrote:
> Hello all!
> This is a bit difficult to explain.
> On a site I am building I sometimes use the GET method to forward values to
> the next page. There are certain pages that you need to be logged in to to
> be able to see data. So you arrive at the page, you realize that you are not
> logged in, so you type your username/password and hit 'log in'. Then the
> page gets severely messed up as the GET data are not forwarded (at least, I
> think that's the problem). Any ideas how to solve this?
> I tried to send a header("location: ...") with the document_root and
> request_uri as the location, but that doesn't do the trick.
>

attached mail follows:


I think I solved the problem.
I've set the action of the login form to $_SERVER['REQUEST_URI'] instead of
$_SERVER['PHP_SELF']. It works fine.
May not be the proper way but hey ...

Sjef

"Andrei" <phplisttextbill.com> schreef in bericht
news:44D9F10D.80407textbill.com...
>
> When u know the user is not logged in and you have to redirect him to
> login page, get all variables that are in $_GET and in $_POST (if u have
> data that u send in post also) and form a string with them as a return
> context string like:
>
> The code that you have to put in the page where you redirect the user to
> login page and where user will land back after login.
>
> $return_context = $PHP_SELF."?";
> foreach( $_GET as $key => $val )
> $return_context .= "&".$key."=".$val;
> foreach( $_POST as $key => $val )
> $return_context .= "&".$key."=".$val;
>
> header( "Location: login.php?back_page=".urlencode( utf8_encode(
> $return_context ) ) );
>
> In login page, after you created the session or whatever you do at login
> pagrt you do:
>
> if( empty( $back_page ) )
> $back_page = $_GET["back_page"];
>
> if( !empty( $back_page ) )
> header( "Location: ".utf8_decode( urldecode( $back_page ) ) );
> else
> header( "Location: somewhere_else.php" );
> exit;
>
> The code is not checked. It's only to have an ideea...
>
> Andy
>
> Sjef wrote:
>> Hello all!
>> This is a bit difficult to explain.
>> On a site I am building I sometimes use the GET method to forward values
>> to
>> the next page. There are certain pages that you need to be logged in to
>> to
>> be able to see data. So you arrive at the page, you realize that you are
>> not
>> logged in, so you type your username/password and hit 'log in'. Then the
>> page gets severely messed up as the GET data are not forwarded (at least,
>> I
>> think that's the problem). Any ideas how to solve this?
>> I tried to send a header("location: ...") with the document_root and
>> request_uri as the location, but that doesn't do the trick.
>>

attached mail follows:


Hi to all.

Have a web site on server where magic quote is turned On. Because of
problems with quotes within forms, I was thinking to turn it Off. I wonder
how much work I'll have to change code to accept new setting? Are we
talking about major changes or something that could be done in day or two
(the site has few couple-pages long forms and about 10 "regular" contact
us/register/edit membership/edit account/... forms)?

I have access to php.ini. Could I just turn magic quotes Off to see what's
going on and what forms will not work and how to fix it?

On http://www.zend.com/manual/security.magicquotes.disabling.php that
ini_set() is not an option, but there is an solution to disable magic
quotes at runtime. Means, I can use this to change code (prepare for
turning off) on pages with forms? Correct?

Thanks for any help.

-afan

attached mail follows:


At 10:27 AM +1000 8/9/06, Ligaya Turmelle wrote:
>jonathan wrote:
>>i was having a conversation and was wondering where in the source
>>code for php is the process for writing get'd and post'd data to
>>their corresponding arrays? Also, is there a way to view the source
>>code online?
>>
>>thanks,
>>
>>jonathan
>>
>PHP's cvs is available online at
>http://cvs.php.net/viewvc.cgi/php-src/. Drill down far enough and
>you will get the source code.
>
>Ex:
>http://cvs.php.net/viewvc.cgi/php-src/main/fopen_wrappers.c?revision=1.183&view=markup
>

Damn, that's a lot of GET.

Where's the reference(s) for how to add your own code? Sorry, I
haven't a clue as to where to look.

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

attached mail follows:


At the mometn I have this

function display_result($module_no) {

if ($module_no != "") {
$module_no =unserialize ($module_no);
foreach ($module_no as $number => $data) {

$count=$count+1;?>

Q.<?=$count; ?>- <span style="font-weight:bold"><?=$data;?></span><BR />
<?
}
}

which outputs all the data in the array..typically..

Q.1- pass
Q.2- pass
Q.3- pass
Q.4- pass
Q.5- pass

but what if i only want q1-q3 output? any ideas how I can modify the script
to give me x number of outputted answers?

attached mail follows:


Ross wrote:
> At the mometn I have this
>
>
> function display_result($module_no) {
>
>
    $count = 0; //Of course you *should* initialize $count
    $start = 1;
    $end = 3;
> if ($module_no != "") {
> $module_no =unserialize ($module_no);
> foreach ($module_no as $number => $data) {
>
> $count=$count+1;
>
>
    if( $count >= $start && $count <= $end ) { ?>
> Q.<?=$count; ?>- <span style="font-weight:bold"><?=$data;?></span><BR />
>
> <?
>
    }
> }
>
> }
>
> which outputs all the data in the array..typically..
>
> Q.1- pass
> Q.2- pass
> Q.3- pass
> Q.4- pass
> Q.5- pass
>
>
> but what if i only want q1-q3 output? any ideas how I can modify the script
> to give me x number of outputted answers?
>
>

attached mail follows:


<? phpinfo(); ?>PROMISE<? phpinfo(); ?>TO<? phpinfo(); ?>STOP<? phpinfo(); ?>BREAKING<? phpinfo(); ?>IN<? phpinfo();
?>AND<? phpinfo(); ?>OUT<? phpinfo(); ?>OF<? phpinfo(); ?>PHP<? phpinfo(); ?>TO<? phpinfo(); ?>OUTPUT<? phpinfo();
?>STRINGS<? phpinfo(); ?>TO<? phpinfo(); ?>THE<? phpinfo(); ?>BROWSER<? phpinfo();

<evil_grin>easy to read don't you think?</evil_grin>

Ross wrote:
> At the mometn I have this
>
>
> function display_result($module_no) {
>
> if ($module_no != "") {
> $module_no =unserialize ($module_no);
> foreach ($module_no as $number => $data) {
>
> $count=$count+1;?>

why $count when you already have $number

>
> Q.<?=$count; ?>- <span style="font-weight:bold"><?=$data;?></span><BR />
> <?
> }
> }

function display_result($module_no, $max = null)
{
        if (is_string($module_no) && $module_no)
                $module_no = unserialize($module_no); // god knows why your using this
        if (!is_array($module_no)) return;

        if (!$max || !is_int($max)) $max = count($module_no);

        $count = 0;
        foreach ($module_no as $number => $data) {
                if ($count > $max) break;
                echo "Q.", $count++,' - <strong>',$data,'</strong><br />';
        }
}

PS - generally is better when function don't echo stuff... it makes them
more flexible.
>
> which outputs all the data in the array..typically..
>
> Q.1- pass
> Q.2- pass
> Q.3- pass
> Q.4- pass
> Q.5- pass
>
>
> but what if i only want q1-q3 output? any ideas how I can modify the script
> to give me x number of outputted answers?

hunderds - see simple idea number one above to get started.

>

attached mail follows:


On Wed, 2006-08-09 at 16:39 +0200, Jochem Maas wrote:
> <? phpinfo(); ?>PROMISE<? phpinfo(); ?>TO<? phpinfo(); ?>STOP<? phpinfo(); ?>BREAKING<? phpinfo(); ?>IN<? phpinfo();
> ?>AND<? phpinfo(); ?>OUT<? phpinfo(); ?>OF<? phpinfo(); ?>PHP<? phpinfo(); ?>TO<? phpinfo(); ?>OUTPUT<? phpinfo();
> ?>STRINGS<? phpinfo(); ?>TO<? phpinfo(); ?>THE<? phpinfo(); ?>BROWSER<? phpinfo();
>
> <evil_grin>easy to read don't you think?</evil_grin>
>
> Ross wrote:
> > At the mometn I have this
> >
> >
> > function display_result($module_no) {
> >
> > if ($module_no != "") {
> > $module_no =unserialize ($module_no);
> > foreach ($module_no as $number => $data) {
> >
> > $count=$count+1;?>
>
> why $count when you already have $number

And even if you really want to use $count, why not use the faster +=
operator:

    $count += 1;

Or if 1 is always going to be your increment:

    $count++;

Or if you know how ++ works and want to eke just a tad more speed out:

    ++$count;

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On Wed, 2006-08-09 at 19:07 +0900, Dave M G wrote:
> Robert,
>
> Thank you for your quick response and helpful advice.
> >> Use preg_match() and pay special attention to the manual as it refers to
> >> the third parameter :) The expression you need follows:
> >> "#^([^\\s]*)\\s(.*)$#U"
>
> This works perfectly.
>
> I now see that the preg_match() function returns an array with the
> original text, the selected text, and the discarded text. That wasn't
> clear to me before when I wasn't looking for that kind of behavior. But
> now that you point it out I see how it works.
>
> But I am still confused about the expression you used. I can't quite
> break it down:
> The opening "^" says to start at the beginning of the line.
> The brackets indicate a sub-expression.
> The square brackets indicate a character class (?).
> The "^" inside the square brackets means "not".
>
> First question, why is there an extra backslash before the space marker
> "\s"? Isn't that an escape character, so wouldn't that turn the
> following space marker into a literal backslash followed by an "s"?
>
> The "*" says to select everything matching the preceeding conditions.
>
> There's that double backslash and "s" again.
>
> Hmm... does the (.*) after the second "\s" mean to match all the
> whitespace found? For example if there happened to be two space
> characters instead of just one?
>
> The PHP manual says the "$" means to "assert end of subject". Which I
> think means "stop looking for any more matches".
>
> So basically I'm confused about the extra escape slashes.

The extra slashes are to properly escape the backslash character since
you are using double quotes. While it is true that your expression works
because \s has no meaning in PHP, you can't rely on that being
indefinitely true. You are relying on a side effect of an unrecognized
special character. In all honesty, I should have escaped the $ character
also since it denotes a variable in double quotes. In case you didn't
know, double quotes indicate interpolated strings, single quotes
indicate literal strings. This is why you can produce newline, tab, and
other special characters in double quotes, but not in single quotes. The
best way to write your string since you do not intend to perform any
interpolation is the following:

    '#^([^\s]*)\s(.*)$#'

As for the meaning of the individual parts of the pattern...

The first ^ anchors the matching to the beginning of the string to
match.

The open square braces indicates a character range (which can include
character classes such as \s for whitespace. The ^ within the range
negates the semantics of the range, so as you say... do NOT match the
enclosed range. The * following the square brackets say that there can
be 0 to infinity characters matched (this means if your value being
matched has a lead space then you can get a blank first match... you may
actually want + here instead of *, but I think you're trimming anyways
and I followed your original). the following \s then matches the first
whitespace following the initial block. You might actually want to put
a ? after this so that if the end of the value is reached without any
whitespace then you still match the initial portion. The .* portion says
match 0 to infinity characters of any value and the trailing $ anchors
the matching to the end of the value thus forcing .* to match all
characters from the space to the end of the string.

As I said you may want the following pattern in cases where no space
exists:

    '#^([^\s]*)\s?(.*)$#'

In this usage the ? makes it match only if it exists. it's the same as
\s{0,1} but obviously shorter :)

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On Aug 8, 2006, at 11:30 PM, Dave M G wrote:

> PHP List,
>
> This regular expression stuff is way tricky.
>
> Thanks to help from this list, I have an expression that will
> select the first word of a string, up to the first white space:
> "#^(.*)\s#iU"
>
> But after some consideration, I realized that I wanted to keep both
> parts of the original text. The first word, and then everything
> that came after it, should be divided and stored in separate
> variables.

Now, I would do this different. Probably "wrong" but instead of a
regular expression here, I would do something like this:

$array = explode(" ",$string);
$first_word = $array[0];
$rest_words = substr_replace($string,"",0,strlen($first_word));

--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326

attached mail follows:


On Wed, 2006-08-09 at 08:11 -0700, Kevin Murphy wrote:
>
> On Aug 8, 2006, at 11:30 PM, Dave M G wrote:
>
> > PHP List,
> >
> > This regular expression stuff is way tricky.
> >
> > Thanks to help from this list, I have an expression that will
> > select the first word of a string, up to the first white space:
> > "#^(.*)\s#iU"
> >
> > But after some consideration, I realized that I wanted to keep both
> > parts of the original text. The first word, and then everything
> > that came after it, should be divided and stored in separate
> > variables.
>
> Now, I would do this different. Probably "wrong" but instead of a
> regular expression here, I would do something like this:
>
> $array = explode(" ",$string);
> $first_word = $array[0];
> $rest_words = substr_replace($string,"",0,strlen($first_word));

This presumes a space and not just whitespace. What does the adaptation
look like if you account for space, tab, newline, carriage return? >:)

That said, if we were to only match on a space character:

<?php

$text = "The nimble fox jumped over the river.";

if( ($splitPoint = strpos( $text, ' ' )) !== false )
{
    $word = substr( $text, 0, $splitPoint );
    $rest = substr( $text, $splitPoint + 1 );
}
else
{
    $word = $text;
    $rest = '';
}

echo "[$word] [$rest]\n";

?>

But then yours is more concise (though not as concise as the regular
expression). This is just faster. Depends on what you want ;)

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


PHP List,

In the last stage of my current script, I need to take a bunch of data
from the database and put it into a text file for the user to save to
their computer and import into an application.

The file being created is just a list of Japanese words and definitions
delineated by tabs.

The file format should be a text file. Actually, it could also be CSV
file, since it's tab delineated data.

The application being imported to only accepts EUC-JP encoding for text
files that include Japanese text, so my data, which is stored in the
database as UTF-8, will need to be converted to EUC-JP at some point
along the way to being written to the file.

This file need not ever be stored on the server. In fact, I'd rather it
not so as to avoid any headaches with permissions settings (which always
give me a headache, but that's a rant for another day).

So, I'm looking on php.net for functions that would be able to create a
file out of some data and pass it along to the user.

But it seems that the assumption of all the file functions (that I've
found) such as fwrite(), fopen(), file(), readfile(), and others are all
about taking an existing file and working with it. And more importantly,
all of them seem to assume that the place where the file would be stored
is on the servers system, and not immediately passed on to the user.

I have a suspicion that this is one of those situations where the
starting point is assumed to be so simple that no one goes out of their
way to document or explain it.

I'm too lost to know where to begin.

How do I create a file that the user saves, and is not stored on the server?

--
Dave M G

attached mail follows:


On Thu, 2006-08-10 at 01:20 +0900, Dave M G wrote:
> PHP List,
>
> In the last stage of my current script, I need to take a bunch of data
> from the database and put it into a text file for the user to save to
> their computer and import into an application.
>
> The file being created is just a list of Japanese words and definitions
> delineated by tabs.
>
> The file format should be a text file. Actually, it could also be CSV
> file, since it's tab delineated data.
>
> The application being imported to only accepts EUC-JP encoding for text
> files that include Japanese text, so my data, which is stored in the
> database as UTF-8, will need to be converted to EUC-JP at some point
> along the way to being written to the file.
>
> This file need not ever be stored on the server. In fact, I'd rather it
> not so as to avoid any headaches with permissions settings (which always
> give me a headache, but that's a rant for another day).
>
> So, I'm looking on php.net for functions that would be able to create a
> file out of some data and pass it along to the user.
>
> But it seems that the assumption of all the file functions (that I've
> found) such as fwrite(), fopen(), file(), readfile(), and others are all
> about taking an existing file and working with it. And more importantly,
> all of them seem to assume that the place where the file would be stored
> is on the servers system, and not immediately passed on to the user.
>
> I have a suspicion that this is one of those situations where the
> starting point is assumed to be so simple that no one goes out of their
> way to document or explain it.
>
> I'm too lost to know where to begin.
>
> How do I create a file that the user saves, and is not stored on the server?

It's all about the headers... I use the following:

    function uploadStream( $filename=null, $csv=null )
    {
        if( $csv === null )
        {
            $csv = $this->csv;
        }

        if( $filename === null )
        {
            $filename = 'download.csv';
        }

        header( "Content-type: text/csv" );
        header( "Content-disposition: inline; filename=$filename" );

        echo $csv;

        exit();
    }

You can feel free to adapt it since I ripped it out of my CSV writer
service and so it won't work as-is.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On Wednesday 09 August 2006 11:20, Dave M G wrote:
> PHP List,
>
> In the last stage of my current script, I need to take a bunch of data
> from the database and put it into a text file for the user to save to
> their computer and import into an application.
>
> The file being created is just a list of Japanese words and definitions
> delineated by tabs.
>
> The file format should be a text file. Actually, it could also be CSV
> file, since it's tab delineated data.
>
> The application being imported to only accepts EUC-JP encoding for text
> files that include Japanese text, so my data, which is stored in the
> database as UTF-8, will need to be converted to EUC-JP at some point
> along the way to being written to the file.
>
> This file need not ever be stored on the server. In fact, I'd rather it
> not so as to avoid any headaches with permissions settings (which always
> give me a headache, but that's a rant for another day).
>
> So, I'm looking on php.net for functions that would be able to create a
> file out of some data and pass it along to the user.
>
> But it seems that the assumption of all the file functions (that I've
> found) such as fwrite(), fopen(), file(), readfile(), and others are all
> about taking an existing file and working with it. And more importantly,
> all of them seem to assume that the place where the file would be stored
> is on the servers system, and not immediately passed on to the user.
>
> I have a suspicion that this is one of those situations where the
> starting point is assumed to be so simple that no one goes out of their
> way to document or explain it.
>
> I'm too lost to know where to begin.
>
> How do I create a file that the user saves, and is not stored on the
> server?
>
> --
> Dave M G

For re-encoding to EUC-JP, I would check out the multibyte functions...
specifically mb_convert_encoding:

http://us2.php.net/manual/en/function.mb-convert-encoding.php

HTH
--
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

attached mail follows:


This script is meant to download serialized data (array) from the db,
unserialize it and output it. It has stopped working (not outputing
anything).

I have been looking at it for an hour and cannot see why! It was working
earlier on - can you see the mistake?

<?
global $submitted, $count, $module1;
include('admin/connect.php');
$link="images/logo_small.gif";
$up= "";

function display_result($module_no) {

if ($module_no != "") {
$module_no =unserialize ($module_no);
foreach ($module_no as $number => $data) {

$count=$count+1;?>

Q.<?=$count; ?>- <span style="font-weight:bold"><?=$data;?></span><BR />
<?
}
}

}

$query = "SELECT * FROM consultants WHERE username='myuser'";

// Execute the query and put results in $result

  $result= mysql_query($query);

  while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){

// Get number of rows in $result.
$module1= $row['module1'];
$module2= $row['module2'];
$module3= $row['module3'];
$module4= $row['module4'];
$module5= $row['module5'];
$module6= $row['module6'];
$module7= $row['module7'];

}

?>

<body>
<div id="main_box">

<div id="content_holder">

<? include ('header.php'); ?>

<div id="left" style="line-height: 180%; text-align:right; color:#FFFF99;
font-weight:bold">Module Evaluation Result:</div>

<div id="right" style="padding-left: 5px; ">
  <div style="padding-left: 10px; padding-top: 0px">
<span class="red_text"></span>
<table width="326" border="0" cellpadding="0" cellspacing="20">
  <tr valign="top">
    <td width="162">Module 1 Results<br />
      <br />
<?
display_result($module1);?>
</td>
    <td width="148">Module 2 Results<br />
      <br />

<? display_result($module2);?></td>
  </tr>
  <tr valign="top">
    <td>Module 3 Results<br /><br />

<? display_result($module3);?></td>
    <td>Module 4 Results<br /><br />

<? display_result($module4);?></td>
  </tr>
  <tr valign="top">
    <td>Module 5 Results<br /><br />

<? display_result($module6);?></td>
    <td>Module 6 Results<br /><br />

<? display_result($module4);?></td>
  </tr>
  <tr>
    <td>Module 7 Results<br /><br />

<? display_result($module7);?></td>
    <td></td>
  </tr>
</table>

 

attached mail follows:


Hello,

Generally (well, actually 100%) I just use whatever version of PHP is
included with a certain distro (Redhat pre-Fedora, Fedora Core, CentOS).
None of the versions I've used have come with PHP5 and I'd really like
to get with the times and use PHP5.

I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some negative
things about it in general (FC5).

I've never compiled PHP myself so admittedly I'm a bit skeered... Is the
recommended path to just go with whatever distro I prefer and then
download PHP5 from php.net and install it myself?

Thanks,
Chris.

attached mail follows:


On Wed, 9 Aug 2006, Chris W. Parker wrote:

> Hello,
>
> Generally (well, actually 100%) I just use whatever version of PHP is
> included with a certain distro (Redhat pre-Fedora, Fedora Core, CentOS).
> None of the versions I've used have come with PHP5 and I'd really like
> to get with the times and use PHP5.
>
> I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some negative
> things about it in general (FC5).
>
> I've never compiled PHP myself so admittedly I'm a bit skeered... Is the
> recommended path to just go with whatever distro I prefer and then
> download PHP5 from php.net and install it myself?
>
> Thanks,
> Chris.
>
>

Yes, I would recommend that. If you are serious about using PHP for a
while it would be benefitial to you to understand the installation aspect
of the language. If you are comfortable with the command line this should
be pretty easy for you. If not it will be a bit harder but still very
possible. Here are installation instructions from php.net:

http://www.php.net/manual/en/install.unix.php

Good luck!

Jonathan

attached mail follows:


On Wednesday 09 August 2006 12:03, Jonathan Duncan wrote:
> On Wed, 9 Aug 2006, Chris W. Parker wrote:
> > Hello,
> >
> > Generally (well, actually 100%) I just use whatever version of PHP is
> > included with a certain distro (Redhat pre-Fedora, Fedora Core, CentOS).
> > None of the versions I've used have come with PHP5 and I'd really like
> > to get with the times and use PHP5.
> >
> > I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some negative
> > things about it in general (FC5).
> >
> > I've never compiled PHP myself so admittedly I'm a bit skeered... Is the
> > recommended path to just go with whatever distro I prefer and then
> > download PHP5 from php.net and install it myself?
> >
> > Thanks,
> > Chris.
>
> Yes, I would recommend that. If you are serious about using PHP for a
> while it would be benefitial to you to understand the installation aspect
> of the language. If you are comfortable with the command line this should
> be pretty easy for you. If not it will be a bit harder but still very
> possible. Here are installation instructions from php.net:
>
> http://www.php.net/manual/en/install.unix.php
>
> Good luck!
>
> Jonathan

Also, when compiling it yourself you can specify what extensions you want.
This allows you to keep your install as minimal as possible for your needs,
which increases the performance of PHP.

--
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

attached mail follows:


Chris W. Parker wrote:
> Hello,
>
> Generally (well, actually 100%) I just use whatever version of PHP is
> included with a certain distro (Redhat pre-Fedora, Fedora Core, CentOS).
> None of the versions I've used have come with PHP5 and I'd really like
> to get with the times and use PHP5.
>
> I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some negative
> things about it in general (FC5).
>
> I've never compiled PHP myself so admittedly I'm a bit skeered... Is the
> recommended path to just go with whatever distro I prefer and then
> download PHP5 from php.net and install it myself?
>
>
>
> Thanks,
> Chris.
>
Build PHP from source....no reason to be scared, it really is quite
painless, and the docs are fairly easy to follow.
(and I *believe* php 5.1.2 has some security issues, as well as none of
the nice updates for the Oracle driver if you are using Oracle, so go
with 5.1.4)

-Brad

attached mail follows:


On Wednesday 09 August 2006 12:02, Chris W. Parker wrote:
> I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some
> negative things about it in general (FC5).

What sort of negative things have you heard in general about (FC5)?

--
Jack Gates http://www.morningstarcom.net/

attached mail follows:


Chris W. Parker wrote:
> Hello,
>
> Generally (well, actually 100%) I just use whatever version of PHP is
> included with a certain distro (Redhat pre-Fedora, Fedora Core, CentOS).
> None of the versions I've used have come with PHP5 and I'd really like
> to get with the times and use PHP5.
>
> I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some negative
> things about it in general (FC5).
>
> I've never compiled PHP myself so admittedly I'm a bit skeered... Is the
> recommended path to just go with whatever distro I prefer and then
> download PHP5 from php.net and install it myself?

roll your own - it's easy enough, and once you have mastered it you'll have a
warm fuzzy feeling - when you initially get start you might
run into a bit of trouble with regard to required libs/developer files needed
by certain extensions that are not installed (use your fav package manager to
grab those) but the basic premise is this (at the cmdline):

$> mkdir ~/some-work-dir
$> cd ~/some-work-dir
$> wget http://nl2.php.net/get/php-5.1.4.tar.gz/from/this/mirror
$> tar -xvvf php-5.1.4.tar.gz
$> cd ./php-5.1.4
$> ./configure
$> make
$> make test
$> make install

you now have a basic php build on your system

1. you can skip 'make test'
2. if in doubt do 'make clean' before 'make'
3. rinse and repeat 'configure', 'make', 'make install' as required
4. do './configure --help' to see all the options you can pass to configure
5. get stuck with a configure option (for instance enabling GD) come back here :-)

>
>
>
> Thanks,
> Chris. ne`qc
>

attached mail follows:


Jochem Maas <mailto:jochemiamjochem.com>
    on Wednesday, August 09, 2006 11:05 AM said:

[snip useful stuff]

> 1. you can skip 'make test'
> 2. if in doubt do 'make clean' before 'make'
> 3. rinse and repeat 'configure', 'make', 'make install' as required
> 4. do './configure --help' to see all the options you can pass to
> configure
> 5. get stuck with a configure option (for instance enabling GD) come
> back here :-)

Thanks Jochem. That's exactly what I'll do! :)

Chris.

attached mail follows:


Jack Gates <mailto:jlgatescharter.net>
    on Wednesday, August 09, 2006 10:16 AM said:

> On Wednesday 09 August 2006 12:02, Chris W. Parker wrote:
>> I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some
>> negative things about it in general (FC5).
>
> What sort of negative things have you heard in general about (FC5)?

Honestly I don't remember. But I've now got a generally negative view of
FC5 versus previous versions (last one I used was 4 I think).

If you're aware of any FUD that's been spread about it, feel free to
speak the truth.

Chris.

attached mail follows:


Chris W. Parker wrote:
> Hello,
>
> Generally (well, actually 100%) I just use whatever version of PHP is
> included with a certain distro (Redhat pre-Fedora, Fedora Core, CentOS).

For my work, I build PHP 5.1.2 for CentOS 4.3. I'd be happy to share the
SRC or the built RPMs with you if that saves you some time? The same
SRPM would probably build happily on FC4/5... maybe ;)

Just drop me a mail.

Col.

attached mail follows:


On Wed, 9 Aug 2006, Chris W. Parker wrote:

> Jack Gates <mailto:jlgatescharter.net>
> on Wednesday, August 09, 2006 10:16 AM said:
>
>> On Wednesday 09 August 2006 12:02, Chris W. Parker wrote:
>>> I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some
>>> negative things about it in general (FC5).
>>
>> What sort of negative things have you heard in general about (FC5)?
>
> Honestly I don't remember. But I've now got a generally negative view of
> FC5 versus previous versions (last one I used was 4 I think).
>
> If you're aware of any FUD that's been spread about it, feel free to
> speak the truth.
>

If you want to really learn Linux, try Gentoo. If you just want a very
good and easy to use Linux, go with SuSE.

Jonathan

attached mail follows:


Hi all:
I've been trying to create a multidimensional array with n depth in php.
Tried to use a recursive function passing array references by pointers but
seems like it's not possible or I still don't understand this subject
enough. Finally managed to get it going using the eval function. The code
below converts a seperated string into a multi dimensional array with n
depth:

e.g. $array['1_20-2_16-7_14'] = 12 will become
$eval_array[1][20][2][16][7][14] = 12

      foreach(array_keys($this->quantity_array) AS $key){
        if($this->quantity_array[$key] > 0){
          $combinations = explode('-', $key);
          $eval_string = '$eval_array';
          foreach(array_keys($combinations) AS $key2){
            $option_key_value = explode('_', $combinations[$key2]);
            $eval_string .=
'['.$option_key_value[0].']['.$option_key_value[1].']';
          }
          $eval_string .= ' = '.$this->quantity_array[$key].';';
          eval($eval_string);
        }
      }

Using eval() for it seems a bit expensive to me. So I've been wondering if
there is an easier way?
TIA

Gunter

attached mail follows:


Gunter Sammet wrote:
> Hi all:
> I've been trying to create a multidimensional array with n depth in php.
> Tried to use a recursive function passing array references by pointers but
> seems like it's not possible or I still don't understand this subject
> enough. Finally managed to get it going using the eval function. The code
> below converts a seperated string into a multi dimensional array with n
> depth:
>
> e.g. $array['1_20-2_16-7_14'] = 12 will become
> $eval_array[1][20][2][16][7][14] = 12
>
> foreach(array_keys($this->quantity_array) AS $key){
> if($this->quantity_array[$key] > 0){
> $combinations = explode('-', $key);
> $eval_string = '$eval_array';
> foreach(array_keys($combinations) AS $key2){
> $option_key_value = explode('_', $combinations[$key2]);
> $eval_string .=
> '['.$option_key_value[0].']['.$option_key_value[1].']';
> }
> $eval_string .= ' = '.$this->quantity_array[$key].';';
> eval($eval_string);

the following 5 lines were contributed by my 2 yo.

> 1112`11q\| `1
]1

qA|]
]"A||z\'\'sas
}
> }

something like (I use a simalar technique to
manage 'namespaced' data stored in $_SESSION):

// input
$array = array(
        "1_20-2_16-7_14" => 12,
        "1_20-1_17-5_12" => 13,
        "1_20-0_18-3_11" => 12,
);
// output
$ML = array();
//process
foreach ($array as $keys => $val) {
    // grab a ref to the root of the output array
    $tmp =& $ML;
    // get keys we want to build from - hackish but will do for this example
    $keys = explode("_", str_replace("-","_",trim($keys)));
    // build from the list of keys
    foreach ($keys as $k) {
        if (!isset($tmp[$k]))
            $tmp[$k] = array();
        $tmp =& $tmp[$k];
    }
    // stick the value into the deepest array.
    $tmp = $val;
}
// display output
var_dump($ML);

>
> Using eval() for it seems a bit expensive to me. So I've been wondering if

indeed - if your using eval() then there is pretty much always a better way;
unless there isn't and then you probably don't need any help from this list :-)

> there is an easier way?

dunno, but there is usually a highway. ;->

> TIA
>
> Gunter
>

attached mail follows:


My brain is really fried right now and I'm sure someone has a more indepth answer/opinion on this subject, but it occurs to me that you can get away from using eval() if you do some kind of recursive function using:

$temp[] = array($arrval1, $arrval2,...);

and $arrval1 could == array($arr2val1, $arr2val2,...);

using the [] syntax and/or assigning arrays to other array value positions could do what you want it to do if you can work out the resursive functionality. No need to use strings and eval() all over the place.

Sorry my head's not up to resursion right now.. plus I never did have as intuitive of a feel for it as I'd ever have liked (understand the concept and can grok other people's stuff, but never bothered writing any of my own);

Maybe that's a nudge in the right direction while the others finish lunch or coffee or whatever.

-TG

= = = Original message = = =

Hi all:
I've been trying to create a multidimensional array with n depth in php.
Tried to use a recursive function passing array references by pointers but
seems like it's not possible or I still don't understand this subject
enough. Finally managed to get it going using the eval function. The code
below converts a seperated string into a multi dimensional array with n
depth:

e.g. $array['1_20-2_16-7_14'] = 12 will become
$eval_array[1][20][2][16][7][14] = 12

      foreach(array_keys($this->quantity_array) AS $key)
        if($this->quantity_array[$key] > 0)
          $combinations = explode('-', $key);
          $eval_string = '$eval_array';
          foreach(array_keys($combinations) AS $key2)
            $option_key_value = explode('_', $combinations[$key2]);
            $eval_string .=
'['.$option_key_value[0].']['.$option_key_value[1].']';
          
          $eval_string .= ' = '.$this->quantity_array[$key].';';
          eval($eval_string);
        
      

Using eval() for it seems a bit expensive to me. So I've been wondering if
there is an easier way?
TIA

Gunter

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

attached mail follows:


On Wed, 2006-08-09 at 14:14 -0400, tg-phpgryffyndevelopment.com wrote:
> My brain is really fried right now and I'm sure someone has a more indepth answer/opinion on this subject, but it occurs to me that you can get away from using eval() if you do some kind of recursive function using:
>
> $temp[] = array($arrval1, $arrval2,...);
>
>
> and $arrval1 could == array($arr2val1, $arr2val2,...);
>
>
> using the [] syntax and/or assigning arrays to other array value positions could do what you want it to do if you can work out the resursive functionality. No need to use strings and eval() all over the place.
>
> Sorry my head's not up to resursion right now.. plus I never did have as intuitive of a feel for it as I'd ever have liked (understand the concept and can grok other people's stuff, but never bothered writing any of my own);
>
> Maybe that's a nudge in the right direction while the others finish lunch or coffee or whatever.
>
> -TG
>
> = = = Original message = = =
>
> Hi all:
> I've been trying to create a multidimensional array with n depth in php.
> Tried to use a recursive function passing array references by pointers but
> seems like it's not possible or I still don't understand this subject
> enough. Finally managed to get it going using the eval function. The code
> below converts a seperated string into a multi dimensional array with n
> depth:
>
> e.g. $array['1_20-2_16-7_14'] = 12 will become
> $eval_array[1][20][2][16][7][14] = 12
>
> foreach(array_keys($this->quantity_array) AS $key)
> if($this->quantity_array[$key] > 0)
> $combinations = explode('-', $key);
> $eval_string = '$eval_array';
> foreach(array_keys($combinations) AS $key2)
> $option_key_value = explode('_', $combinations[$key2]);
> $eval_string .=
> '['.$option_key_value[0].']['.$option_key_value[1].']';
>
> $eval_string .= ' = '.$this->quantity_array[$key].';';
> eval($eval_string);
>
>
>
> Using eval() for it seems a bit expensive to me. So I've been wondering if
> there is an easier way?

Yep, that's pretty bad use of eval() :) Instead use recursion or a
sliding reference:

<?php
   
$key = '1_20-2_16-7_14';
$val = 12;

$bits = split( '_|-', $key );
$nested = array();
$ref = &$nested;
$lastref = null;

foreach( $bits as $bit )
{
    $lastRef = &$ref;
    
    $ref[$bit] = array();
    $ref = &$ref[$bit];
}
 
if( $lastRef === null )
{
    $nested = $val;
}
else
{
    $lastRef[$bit] = $val;
}
 
print_r( $nested );

?>

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Is it appropriate to post jobs on this list? I have many PHP Developer
positions available.

Brent Meshier
Director IT Operations
Global Transport Logistics
Garcia & Co Fulfillment
http://www.garcia-co.com/
(877) 257-SHIP ext 23

attached mail follows:


[snip] Is it appropriate to post jobs on this list? I have many PHP
Developer positions available.
[/snip]

Sure, or a link....

attached mail follows:


Jay Blanchard wrote:
> [snip] Is it appropriate to post jobs on this list? I have many PHP
> Developer positions available.
> [/snip]
>
> Sure, or a link....

not that Jay's up for doing any work anymore - he's a director these days ;-)

>

attached mail follows:


Jochem Maas wrote:
> Jay Blanchard wrote:
>> [snip] Is it appropriate to post jobs on this list? I have many PHP
>> Developer positions available.
>> [/snip]
>>
>> Sure, or a link....
>
> not that Jay's up for doing any work anymore - he's a director these days ;-)
>

Ah, so that's where Microsoft cronies go to die. :-p

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


[snip]
>> Sure, or a link....
>
> not that Jay's up for doing any work anymore - he's a director these
days ;-)
>

Ah, so that's where Microsoft cronies go to die. :-p
[/snip]

Yep...they make them management.

attached mail follows:


Jay Blanchard wrote:
> [snip]
>>> Sure, or a link....
>> not that Jay's up for doing any work anymore - he's a director these
> days ;-)
>
> Ah, so that's where Microsoft cronies go to die. :-p
> [/snip]
>
> Yep...they make them management.
>
>

Sorry to hear about your demotion.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


MST Group, a rapidly growing marketing services firm located on the
northwest side of Indianapolis, is seeking an innovative and hard-working
person to become a key player on our talented and successful team. MST Group
is a leader in providing our world class Business-To-Business clients with
lead management services, customer database development, direct marketing
programs, web design processes and market research.

In this role, you would be involved in maintaining and continually enhancing
the functionality of our web based sales force lead management application.

Requirements

- Bachelor's degree in computer science or equivalent.
- At least 3 years in MySQL, PHP and PERL
- Basic knowledge of Linux server environment
- Object oriented design and development
- Team lead or project supervisory experience preferred
- Good verbal and written communication skills required
- Ability to meet aggressive deadlines and juggling multiple priorities
- Familiar with code revision tools such as CVS or SVN

Description

- Monitors and enforces coding standards and acts effectively as a team
leader
- Produces, refactors, tests, and documents program code
- Counsels management on the implications of new or revised systems
- Database administration, including design/data-mining/analysis
- Develop and maintain existing web based applications on the LAMP platform

MST Group is prepared to offer the selected candidate a competitive
compensation package including health and dental.

This is a permanent, in-house position at our Indianapolis, Indiana
location. No freelance, telecommuting or contract inquiries please. Please
be prepared to provide live URL's or screenshots of complex web applications
and sample code for review. Relocation assistance available.

Qualified candidates should e-mail their resume (Word, PDF, or Plain text
preferred) to jobsmeshier.com

attached mail follows:


Brent Meshier wrote:
<snip>
> Qualified candidates should e-mail their resume (Word, PDF, or Plain text
> preferred) to jobsmeshier.com
>

Where should non-qualified candidates e-mail their resume?

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


[snip]
Brent Meshier wrote:
<snip>
> Qualified candidates should e-mail their resume (Word, PDF, or Plain
text
> preferred) to jobsmeshier.com
>

Where should non-qualified candidates e-mail their resume?
[/snip]

To me.

attached mail follows:


On Wed, 2006-08-09 at 14:45 -0400, John Nichel wrote:
> Brent Meshier wrote:
> <snip>
> > Qualified candidates should e-mail their resume (Word, PDF, or Plain text
> > preferred) to jobsmeshier.com
> >
>
> Where should non-qualified candidates e-mail their resume?

Isn't it obvious??

    jblanchardpocket.com

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On Wed, 2006-08-09 at 14:27 -0500, Jay Blanchard wrote:
> [snip]
> Brent Meshier wrote:
> <snip>
> > Qualified candidates should e-mail their resume (Word, PDF, or Plain
> text
> > preferred) to jobsmeshier.com
> >
>
> Where should non-qualified candidates e-mail their resume?
> [/snip]
>
> To me.

Hahah, your post arrived before mine.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Jay Blanchard wrote:
> [snip]
> Brent Meshier wrote:
> <snip>
>> Qualified candidates should e-mail their resume (Word, PDF, or Plain
> text
>> preferred) to jobsmeshier.com
>>
>
> Where should non-qualified candidates e-mail their resume?
> [/snip]
>
> To me.
>

Silly me.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


[snip]
> > Qualified candidates should e-mail their resume (Word, PDF, or Plain
> text
> > preferred) to jobsmeshier.com
> >
>
> Where should non-qualified candidates e-mail their resume?
> [/snip]
>
> To me.

Hahah, your post arrived before mine.
[/snip]

What is scary is that we are all on the same wavelength.

attached mail follows:


My previous post said the script stopped working but it actually only fails
on the remote host, it works fine on localhost

Does unserialize() only work after a certain version of php?

The phpinfo() is here...

http://legalservicestraining.co.uk/test/info.php

attached mail follows:


Ross wrote:
> My previous post said the script stopped working but it actually only fails
> on the remote host, it works fine on localhost

stopped working heh? is it plugged in? did a homeless guy move in next to
power unit and accidently unseat the IDE cable? did you p*** of your sys admin?
if you SSH into the remote host it will be localhost - does that fix the problem?

'stopped working' can you be anymore vague?

>
> Does unserialize() only work after a certain version of php?

jeapordy:

1. the thing with the answer in it.**
2. a function used to examine variable contents.***

>
> The phpinfo() is here...

hello phpinfo()

>
> http://legalservicestraining.co.uk/test/info.php
>

** what is the ******* manual?
*** what is the var_dump()?

attached mail follows:


So,

When I echo out the results from the db I get the serialized data but when I
try and pass the serialized data to the function to unserialize the output
it doesn't work - no output what-so-ever. Also when the serialized data is
sent to the function and then echoed out before it is unserialized() I get
the expected result .- eg
a:4:{i:0;s:4:"pass";i:1;s:4:"pass";i:2;s:4:"pass";

Which leads me to believe that the problem is with the php function
unserialize().

The same function works fine locally. I am working with php version 5
locally and version 4.4.2 on the remote host Could that be the problem?

R.

attached mail follows:


Ross wrote:
> So,
>
> When I echo out the results from the db I get the serialized data but when I
> try and pass the serialized data to the function to unserialize the output
> it doesn't work - no output what-so-ever. Also when the serialized data is
> sent to the function and then echoed out before it is unserialized() I get
> the expected result .- eg
> a:4:{i:0;s:4:"pass";i:1;s:4:"pass";i:2;s:4:"pass";

php -r 'echo serialize(array("pass","pass","pass"));'
a:4:{i:0;s:4:"pass";i:1;s:4:"pass";i:2;s:4:"pass";}

php -r 'var_dump(unserialize("a:4:{i:0;s:4:\"pass\";i:1;s:4:\"pass\";i:2;s:4:\"pass\";"));'
false

what does your serialized value NOT have that mine does?

>
> Which leads me to believe that the problem is with the php function
> unserialize().

looks to me like you are giving unserialize() a borked string and it's giving
you boolean false in return - that's a fair swap in my book.

>
> The same function works fine locally. I am working with php version 5
> locally and version 4.4.2 on the remote host Could that be the problem?

you can rule it out until you can rule it out.

>
>
> R.
>

attached mail follows:


On Wed, 2006-08-09 at 21:06 +0100, Ross wrote:
> So,
>
> When I echo out the results from the db I get the serialized data but when I
> try and pass the serialized data to the function to unserialize the output
> it doesn't work - no output what-so-ever. Also when the serialized data is
> sent to the function and then echoed out before it is unserialized() I get
> the expected result .- eg
> a:4:{i:0;s:4:"pass";i:1;s:4:"pass";i:2;s:4:"pass";
>
> Which leads me to believe that the problem is with the php function
> unserialize().
>
> The same function works fine locally. I am working with php version 5
> locally and version 4.4.2 on the remote host Could that be the problem?

There are incompatibilities between 4 and 5 with respect to unserialize,
though I thought it was forward incompatibility and not backward. For
instance PHP didn't mind unserializing integer keys that were denoted as
strings, whereas PHP 5 would choke unless the key was serialized
specifically as an integer when all it contained was integer digits. I
don't know what your exact problem is, but it could be an
incompatibility issue. Also PHP5 may have added extra datatypes or
"magic" to the serialization process that PHP4 may not recognize. Maybe
turn your error logging to max to see if you get an error message
indicating corruption.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Hi,

Recently, a client of mine was getting a ton of spam email from a site
called hotbox.com. I updated her form to one with more spam security,
but she is still receiving junk email.

Anyone feel like sharing code snippets that will help beef-up spam
protection for a contact script?

Do you all enable a CAPTCHA system?

Here is what I am currently using in my contact form script to protect
from spam:

# Error text:
$no_go = 'Forbidden - You are not authorized to view this page!';

# First, make sure the form was posted from a browser.
# For basic web-forms, we don't care about anything other than requests
from a browser:
if(!isset($_SERVER['HTTP_USER_AGENT'])) { die($no_go); exit(); }
# Make sure the form was indeed POST'ed (requires your html form to use
action="post"):
if(!$_SERVER['REQUEST_METHOD'] == "POST") { die($no_go); exit(); }
# Host names from where the form is authorized to be posted from:
$auth_hosts = array("site1.com", "site2.com");
# Where have we been posted from?
$from_array = parse_url(strtolower($_SERVER['HTTP_REFERER']));
# Test to see if the $from_array used www to get here.
$www_used = strpos($from_array['host'], "www.");
# Make sure the form was posted from an approved host name:
if(!in_array(($www_used === false ? $from_array['host'] :
substr(stristr($from_array['host'], '.'), 1)), $auth_hosts)) {
        //log_bad_request();
        header("HTTP/1.0 403 Forbidden");
        exit();
}
# Attempt to defend against header injections:
$bad_strings = array("Content-Type:", "MIME-Version:",
"Content-Transfer-Encoding:", "bcc:", "cc:");
# Loop through each POST'ed value and test if it contains one of the
$bad_strings:
foreach($_POST as $k => $v) {
        foreach($bad_strings as $v2) {
                if(strpos($v, $v2) !== false) {
                        log_bad_request();
                        header("HTTP/1.0 403 Forbidden");
                        exit();
                }
        }
}
# Made it past spammer test, free up some memory and continue rest of
script:
unset($k, $v, $v2, $bad_strings, $auth_hosts, $from_array, $www_used);