php-general Digest 24 Feb 2002 04:46:46 -0000 Issue 1190

Topics (messages 85942 through 85980):

Re: php 4.1.1 vs 4.0.6
        85942 by: John Lim
        85949 by: Jason Wong
        85950 by: Andrey Hristov

Novice question
        85943 by: brendan conroy

Associative array key as a variable
        85944 by: ejfs.sympatico.ca
        85945 by: Andrey Hristov

phpnuke site down?
        85946 by: Thalis A. Kalfigopoulos

Re: uploading files | how to avoid submitting twice?
        85947 by: Jim Winstead

Re: fork?
        85948 by: Jim Winstead

Re: Not Quite: how to build an array
        85951 by: Jason Wong
        85952 by: Philip Olson
        85960 by: jtjohnston

using PHP to access another site - stock quotes ??
        85953 by: Pax
        85954 by: Jim Winstead
        85956 by: Erik Price

encryption and HTTP
        85955 by: Erik Price
        85965 by: Johnson, Kirk

adding 'vote' mechanism
        85957 by: Nick Wilson
        85959 by: Erik Price
        85962 by: Steven Walker

Redirecting with PHP if JS is disabled?
        85958 by: Andy
        85961 by: Bogdan Stancescu

REDIRECT_QUERY_STRING weirdness ... redirecting from one file to another
        85963 by: Erica Douglass

Unknown column when column does exist.
        85964 by: lmlweb.mybc.com

PHP 5?
        85966 by: Weston Houghton

php - mail() and sendmails clientmqueue directory
        85967 by: Luke Vogel

upload a  file
        85968 by: czeslaw

countless
        85969 by: jtjohnston

Sendmail
        85970 by: Uma Shankari T.
        85977 by: Erica Douglass

I need a random number eather one or two
        85971 by: Philip J. Newman
        85972 by: Duncan Hill
        85973 by: jtjohnston
        85975 by: Bogdan Stancescu

Ughh not a cookie :(
        85974 by: John Cuthbert

sessions
        85976 by: Alexander P. Javier

help a newbie out...
        85978 by: Michael Zornek
        85979 by: Bogdan Stancescu

Re: help a newbie out... FIXED
        85980 by: Michael Zornek

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---

Cc Zona <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> In article <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED] (Ezra Nugroho) wrote:
>
> > I am deciding between 4.0.6 and 4.1.1 (or maybe 4.1.2 if it's comming
soon).
> > I heard that there is some significant difference between 4.0.x and
4.1.x
> > What is the main difference between 4.0.6 and 4.1.1 ?
> > Are the 4.1.x completely backward compatible with 4.0.x?

Should be 99% compatible.

>
> <http://www.php.net/release_4_1_0.php>
>
> --
> CC


--- End Message ---
--- Begin Message ---
On Sunday 24 February 2002 01:14, John Lim wrote:
> Cc Zona <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> > In article <[EMAIL PROTECTED]>,
> >
> >  [EMAIL PROTECTED] (Ezra Nugroho) wrote:
> > > I am deciding between 4.0.6 and 4.1.1 (or maybe 4.1.2 if it's comming
>
> soon).
>
> > > I heard that there is some significant difference between 4.0.x and
>
> 4.1.x
>
> > > What is the main difference between 4.0.6 and 4.1.1 ?
> > > Are the 4.1.x completely backward compatible with 4.0.x?
>
> Should be 99% compatible.

But the 1% which isn't compatible can be a major pain. If you're mainly 
writing your own stuff then you should be OK. The recommended php.ini 
settings for 4.1.X will break a lot of stuff written by other people.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Mr. Cole's Axiom:
        The sum of the intelligence on the planet is a constant;
        the population is growing.
*/
--- End Message ---
--- Begin Message ---
In 4.1.x series there are new vars (global scope) 
$_GET,$_POST,$_COOKIE,$_FILES,$_SESSION
not available in 4.0.x versions. For old scripts could be problem that 
register_globals is off in the 4.1.x tree(for new
installations, not upgrades). But this is for good.

Regards,
Andrey Hristov

--- End Message ---
--- Begin Message ---
Hi,
thanks for reading this, Im just going to say it cos i dont want to waste 
your time. Im looking for a really big favour here(cos I think it may take 
time to spot this, although it might only take five seconds to spot, but I 
dunno,the problem area of code is only four lines long), so dont  spend time 
reading this unless you got half an hour spare or are looking a good 
samaritan award or something.



Still reading this? Excellent, Iam saved.
I wrote code which takes a input string, breaks it up and puts the bits into 
an array called $real. THIS WORKS.

But I may have lots of input strings so I slapped a for loop around the code 
to do the same thing for all the inputs and THAT WORKS ASWELL!

Then i wanted to save the different bits of each input string in its own 
array, so I created an array of arrays and at the end of each cycle of the 
big loop, I take out all the element in $real and put them into the array of 
arrays, called $poly[][]. THIS DOESNT WORK.

I've spent a week trying to fix this and get that horrible feeling that all 
the work is going down the drain, cos if I dont get this working, I am 
screwed.

I'd be sincerely grateful if someone could help me with this


/*===========================*/
I put these type of comments around the problem area of the code, which is 
about four lines long near the bottom
/*===========================*/

Regards

Bren



<html>
<body>



<?



print_r($poly);
echo"<HR>";


$real[0]=0;
$z=array_pop($real);



$array[0] = 0;
$z = array_pop($array);

/*$real[0] = 0;
$z = array_pop($real);*/


$test[0]=0;
$z = array_pop($test);


/*big loop=============================================*/
for($ws=0;$ws<count($poly);$ws++)
{
$rt=0;





$c = explode("+", $poly[$ws]);

/*echo"C EQUALS"."<BR>".*/

/*echo"shit";
print_r($c);*/


      for($r=0;$r<=count($c);$r++)
          {
             /*  echo"peaches";
                echo"<HR>";*/
                $m=$c[$r];
                echo"M EQUALS"."<BR>";
                echo"$m";
                echo"<BR>";
                $count=0;







                for($j=0;$j<strlen($m);$j++)
                        {
                            /*  echo"purple";*/
                            /*  echo"$c[$r]";*/
                                echo"<BR>";
                                /*$count=0;*/
                                if($m[$j]=="-" )
                                {
                                $count++;
                                }



                }

                  if((($m[0]=="-")AND($count<2))OR($count<1))
                        {
                        echo"dumbass";
                        echo"<BR>";
                      /*if(count($real)<=4)*/
                       {
                       array_push($real,$c[$r]);

                        echo"<BR>";
                        }
                      }


                elseif(($m[0]=="-")AND($count>1))
                {
                echo"blaaaaaaaaaaaaa";
                echo"<BR>";
                $ss = explode("-",$m);

                for($cnt=0;$cnt<count($ss);$cnt++)
                        {
                        echo"sweetness";
                        echo"<BR>";
                        $ss[$cnt] = "-".$ss[$cnt];


                        for($waa=0;$waa<count($c);$waa++)
                        {
                        array_push($real,$ss[$cnt]);

                        }


                        }
                }

                else
                   {
                   echo"waaweaaawaaaweaaa";
                   echo"<BR>";
                   $ss = explode("-",$m);

                for($na=1;$na<count($ss);$na++)
                {
                $ss[$na] = "-".$ss[$na];
                }
                for($la=0;$la<=count($c);$la++)
                {
                array_push($real,$ss[$la]);


                echo"<BR>";
                }
                }













/*echo"$count";
echo"real";
echo"<BR>";
print_r($real); */


}
/*
for($rt=0;$rt<count($real);$rt++)
*/
/*=====================heres the problem==================*/
while(count($real)>0)
{
print_r($real);
echo"<BR>";
$poly[$ws][$rt]=array_pop($real);
$rt++;

echo"pink elephants";
/*========================================================*/
}

}
/*end of big loop*/




echo"real";
echo"<BR>";
print_r($real);


echo"<HR>"."POLY EQUALS";
for($ty=0;$ty<4/*count($poly[$ws][$rt])*/;$ty++)
{
echo"<HR>"."print loop";
echo $poly[0][$ty];
echo"<HR>";
}
echo"<HR>";


?>




</body>
</html>































_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

--- End Message ---
--- Begin Message ---
Hi.

I have the following PHP program executed from an HTML form where I pass
the associative array key name as a variable:

<?
function show($name)
{
  $cnt = count($HTTP_POST_VARS[$name]);
  echo "Count for $name is $cnt";
  echo "<br />";
}
show("countries");
show("cities");
?>

The result is always 0. The form fields do have name=countries[] and
name=cities[] to indicate an array.
When I hardcode the count line in the function as follows just to test
to make sure the transfer from the browser works, it displays a correct
non-zero result:

  $cnt = count($HTTP_POST_VARS["cities"]);

I even tried these statements in the function but all give a 0 result:

  $cnt = count($HTTP_POST_VARS["".$name.""]);

How do I get the count line to work with a variable in the function?
Thanks,

Eurico

--- End Message ---
--- Begin Message ---
Use global. Read the docs about variable scoping.
If you use php >=4.1.0 then use $_POST, $_GET,... they not need to use global. Global 
scope.
<?
function show($name)
{ global $HTTP_POST_VARS;
  $cnt = count($HTTP_POST_VARS[$name]);
  echo "Count for $name is $cnt";
  echo "<br />";
}
show("countries");
show("cities");
?>

Regards,
Andrey Hristov

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 23, 2002 7:31 PM
Subject: [PHP] Associative array key as a variable


> Hi.
> 
> I have the following PHP program executed from an HTML form where I pass
> the associative array key name as a variable:
> 
> <?
> function show($name)
> {
>   $cnt = count($HTTP_POST_VARS[$name]);
>   echo "Count for $name is $cnt";
>   echo "<br />";
> }
> show("countries");
> show("cities");
> ?>
> 
> The result is always 0. The form fields do have name=countries[] and
> name=cities[] to indicate an array.
> When I hardcode the count line in the function as follows just to test
> to make sure the transfer from the browser works, it displays a correct
> non-zero result:
> 
>   $cnt = count($HTTP_POST_VARS["cities"]);
> 
> I even tried these statements in the function but all give a 0 result:
> 
>   $cnt = count($HTTP_POST_VARS["".$name.""]);
> 
> How do I get the count line to work with a variable in the function?
> Thanks,
> 
> Eurico
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Anyone have any idea what's wrong with www.phpnuke.org? No response neither yesterday, 
nor today :-(


--- End Message ---
--- Begin Message ---
Andy <[EMAIL PROTECTED]> wrote:
> Is there a way to redirect imediatelly to a waiting page? I tryed to
> redirect, but somehow the server is first uploading the file before
> something else happens.

unfortunately, no. one thing you can do is use javascript to pop up a
small window in your form's onsubmit method that tells the user to hang
on, and then close that window in the next page's onload method. it
isn't easy to do a real progress meter, but even this little bit should
help tremendously.

you may also want to check the md5 sum of the file contents against
previous uploads to detect duplicates.

jim
--- End Message ---
--- Begin Message ---
Paul Roberts <[EMAIL PROTECTED]> wrote:
> how do i do two things at the same time, i'm thinking of the
> equivalent of fork in perl

you need to enable the pcntl extension, and then you can use pcntl_fork
(http://php.net/pcntl_fork). you may also be able to use the 'ticks'
mechanism (http://www.php.net/manual/en/control-structures.declare.php).

jim
--- End Message ---
--- Begin Message ---
On Saturday 23 February 2002 14:43, jtjohnston wrote:
> OK. I use:
>
>  while ($mydata = mysql_fetch_object($news))
>  {
>  $authors = explode(";", $mydata->AS);
>  }
>
> Then why "Invalid argument supplied for foreach()"

Have you checked that $authors is indeed an array? Try print_r($authors), if 
you see an Array printed then you're OK, anything else then $authors is not 
an array hence your foreach loop fails. Also what does a typical 'AS' field 
look like?

> Am I indeed building an array as I go through my database?

As it stands your code will only get the last set of $authors. Your while 
loop is not adding to $authors, it is replacing it each time through the 
loop. Thus you'll end up with whatever is in the last row of the results.

As someone already suggested, you could use:
 
 array_push($authors, explode(";", $mydata->AS));


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
It's not the men in my life, but the life in my men that counts.
                -- Mae West
*/
--- End Message ---
--- Begin Message ---

Let's work on some debugging.  By using mysql_error() 
you'd eventually find out that AS is a reserved word 
in mysql, see:

  http://www.mysql.com/doc/R/e/Reserved_words.html

That said, here's some example code to play with, 
untested but should work.

if (!$conn = mysql_connect($host, $user, $pass)) {
    echo 'Cannot Connect: '. mysql_error();
    exit;
}

if (!mysql_select_db($dbname)) {
    echo 'Cannot Select Db: '. mysql_error();
    exit;
}

$sql = "SELECT something FROM $tablename";

// AS is reserved as the following is a valid
// SQL query: SELECT foo AS bar FROM blah
// See: http://www.sqlcourse.com/
//      http://www.w3schools.com/sql/

if (!$result = mysql_query($sql)) {
    echo "Cannot run query ($sql): ". mysql_error();
    exit;
}

while ($row = mysql_fetch_assoc($result)) {
    $authors[] = explode(';', $row['something']);
}

print_r($authors);

Rename your field to something other then AS, like 
perhaps "authors" or something ;)  Also eventually 
learn about "Database Normalization".

Regards,
Philip Olson


> OK. I use:
> 
>  while ($mydata = mysql_fetch_object($news))
>  {
>  $authors = explode(";", $mydata->AS);
>  }
> 
> Then why "Invalid argument supplied for foreach()"
> Am I indeed building an array as I go through my database?
> 
>  foreach($authors as $author)
>  {
> #echo sort($author)".<br>\n";
>  echo "$author<br>\n";
>  }
> 
> http://www.php.net/manual/en/control-structures.foreach.php
> foreach ($arr as $value) {
> echo "Value: $value<br>\n";
> }
> 
> I have the right syntax? Did I build the array?
> Newbie, but have to learn it somehow :)
> 
> ----------------snip---------------------
> $myconnection = mysql_connect($server,$user,$pass);
> mysql_select_db($db,$myconnection);
> 
>  $news = mysql_query("select AS from $table");
> 
>  while ($mydata = mysql_fetch_object($news))
>  {
>  $authors = explode(";", $mydata->AS);
>  }
> 
>  foreach($authors as $author)
>  {
>  echo "$author<br>\n";
>  }
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
I'm splitting mysql entries to build an array of author names called $authors.

> As someone already suggested, you could use:
>  array_push($authors, explode(";", $mydata->AS));

http://ccl.flsh.usherb.ca/db/authors_under_study.php

It works, but still gets "First argument to array_push() needs to be an array"
and fails before it gets to "print_r($authors)". Am I doing something wrong
here:

 $authors = array_push($authors, explode(";", $mydata->AUS));

---------------snip--------------------------------
$news = mysql_query("select id,AUS from $table");
$authors = array();
 while ($mydata = mysql_fetch_object($news))
 {
 echo $mydata->id."|".$mydata->AUS."<hr>\n";
 $authors = array_push($authors, explode(";", $mydata->AUS));
 }
print_r($authors);
---------------------snip---------------------

The data looks like:

id->1 = "Zola, Émile";
id->2 = "Mendès, Catielle ??; Grutman; Bernabé, Jean; Andrade, Mario de;
Sutherland, Ronald; Faulkner, William Harrison; Nabokov, Vladimir; Klein,
Abraham Moses; Chassay, Jean-François; Glissant, Édouard; Martí, José;
Jonassaint, Jean; Aguiar, Flavio";
id->3 = "Roberts, Charles George Douglas; Carman, Bliss; Scott, Francis
Reginald; Gustafson, Ralph; Marriott, Anne; Kenneth, Leslie";
id->4 = "Roberts, Charles George Douglas; Carman, Bliss; Scott, Francis
Reginald; Gustafson, Ralph; Marriott, Anne; Kenneth, Leslie";
id->5 = "Tremblay, Michel; Glassco, Bill; Freeman, David; Meunier, Claude;
Gaboriau, Linda; Fennario, David;";
id->6 = "Tremblay, Michel; Laurendeau, André; Gélinas, Gratien; Glassco, Bill;
Dassylva, Martial; Desbiens, Jean-Paul; Dubé, Marcel; Germain, Jean-Paul;
Renaud, Jacques; Van Burik, John; Renaud Jacques;";


--- End Message ---
--- Begin Message ---

Hi,

I am developing site that needs to have stock quotes retrieved and
placed into the database. Perhaps someone know if there is a site that
would supply me with quotes? - I just do not want to do it manually :-((

I guess I could setup a cron job to run @ midnight and update quotes for
selected stocks but I am not sure where to access quotes - any pointers?

Thanks
Paul


--- End Message ---
--- Begin Message ---
Pax <[EMAIL PROTECTED]> wrote:
> I am developing site that needs to have stock quotes retrieved and
> placed into the database. Perhaps someone know if there is a site that
> would supply me with quotes? - I just do not want to do it manually :-((

http://www.google.com/search?q=php%20stock%20quotes

gives lots of solutions. most of them pull the data from yahoo.

jim
--- End Message ---
--- Begin Message ---
You might be interested in learning more about XML-RPC, which will allow 
cross-platform language-neutral XML documents to generate events or 
perform remote procedural calls (RPC).

You can use any language that can parse XML documents, which of course 
includes our beloved PHP.  This article focuses on Python, but it's just 
an introduction and the theory is the same for PHP:
http://www.onlamp.com/pub/a/python/2000/11/22/xmlrpcclient.html

Erik


On Saturday, February 23, 2002, at 02:04  PM, Pax wrote:

>
> Hi,
>
> I am developing site that needs to have stock quotes retrieved and
> placed into the database. Perhaps someone know if there is a site that
> would supply me with quotes? - I just do not want to do it manually :-((
>
> I guess I could setup a cron job to run @ midnight and update quotes for
> selected stocks but I am not sure where to access quotes - any pointers?
>
> Thanks
> Paul
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>





----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Without using SSL or JavaScript, is there any way to make an md5 hash or 
encrypt a string before sending it out as a POST request?

It seems that without encrypting the data before sending it, it can 
still be intercepted.  Once intercepted, it doesn't matter if I use 
md5() on the $_POST['password'] once it gets to the script, because 
anyone can submit the same intercepted string to the script via POST and 
it will be md5()ed when it gets there, thus defeating the purpose.

Maybe I haven't quite wrapped my brain around a decent authentication 
scheme yet.


Erik





----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
The PHPLIB auth class has some code to do this. You might want to look there
for ideas. If I recall correctly, they sent a hidden random string along
with the form that was different on each request. They then did an md5 hash
of the post data concatenated with the random string.

Kirk

> -----Original Message-----
> From: Erik Price [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, February 23, 2002 12:20 PM
> To: PHP
> Subject: [PHP] encryption and HTTP
> 
> 
> Without using SSL or JavaScript, is there any way to make an 
> md5 hash or 
> encrypt a string before sending it out as a POST request?
> 
> It seems that without encrypting the data before sending it, it can 
> still be intercepted.  Once intercepted, it doesn't matter if I use 
> md5() on the $_POST['password'] once it gets to the script, because 
> anyone can submit the same intercepted string to the script 
> via POST and 
> it will be md5()ed when it gets there, thus defeating the purpose.
> 
> Maybe I haven't quite wrapped my brain around a decent authentication 
> scheme yet.
> 
> 
> Erik
> 
> 
> 
> 
> 
> ----
> 
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all, 
I have an SQL table that holds 'tips' and is linked to a table
containing the authors details.

I'd like to add a simple 'thumbs up, thumbs down' vote mechanism to it.
The (simplified) table looks like this:

id | authId | title | tip


The only way I've come up with so far is to add two more fields
(thumbs_up and thumbs_down). Then....

each time someone votes...
get the current value of the field (say thumbs_up)
use php to increment it's value and 
pop it back in the db.


Is there a better way?
- -- 
- -----------------------------------------------------------
 www.explodingnet.com   |    Projects, Forums and
                        +    Articles for website owners 
- -- Nick Wilson --     |    and designers.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8d/CbHpvrrTa6L5oRAkiJAJ9jSWhYcfaYkCLwh89oBRgPO4qGAACfVk35
2wYbTAlhyXEEsXEOh/x7u8k=
=N0Cm
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---

On Saturday, February 23, 2002, at 02:42  PM, Nick Wilson wrote:
> I'd like to add a simple 'thumbs up, thumbs down' vote mechanism to it.
> The (simplified) table looks like this:
>
> id | authId | title | tip
>
>
> The only way I've come up with so far is to add two more fields
> (thumbs_up and thumbs_down). Then....
>
> each time someone votes...
> get the current value of the field (say thumbs_up)
> use php to increment it's value and
> pop it back in the db.

What if you made the field a signed INT field, and used PHP to subtract 
one from the current value of the field every time someone chose "thumbs 
down" or add one to the current value of the field every time someone 
chose "thumbs up".  This way you could have a "level" of how well the 
author stacks up.

This is just another idea shooting the moon, the truth is that it would 
probably be fine either way.  A matter of personal preference.

Erik





----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
I personally prefer voting mechanisms that display how many votes have 
been cast. If you keep the thumbs_up separate from thumbs_down, you can 
figure the total number of votes. Otherwise, you will not be able to 
know whether the author is *really* average or just never voted for.

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]

On Saturday, February 23, 2002, at 11:45  AM, Erik Price wrote:

>
> On Saturday, February 23, 2002, at 02:42  PM, Nick Wilson wrote:
>> I'd like to add a simple 'thumbs up, thumbs down' vote mechanism to it.
>> The (simplified) table looks like this:
>>
>> id | authId | title | tip
>>
>>
>> The only way I've come up with so far is to add two more fields
>> (thumbs_up and thumbs_down). Then....
>>
>> each time someone votes...
>> get the current value of the field (say thumbs_up)
>> use php to increment it's value and
>> pop it back in the db.
>
> What if you made the field a signed INT field, and used PHP to subtract 
> one from the current value of the field every time someone chose 
> "thumbs down" or add one to the current value of the field every time 
> someone chose "thumbs up".  This way you could have a "level" of how 
> well the author stacks up.
>
> This is just another idea shooting the moon, the truth is that it would 
> probably be fine either way.  A matter of personal preference.
>
> Erik
>
>
>
>
>
> ----
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>
>
> -- PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hi there,

I am wondering if it is anyhow possible to check if the client has activated
JavaScript and in case he has not to redirect him to another page?

The thing is, as soon as the noscipt tap detects it, php is already parsed
and withouth JS I don not see a possibility to redirect him.

Does anybody have an idea on that?

Thanx andy




--- End Message ---
--- Begin Message ---
Why don't you do it the other way round: redirect if JS *is* available?

Bogdan

Andy wrote:

>Hi there,
>
>I am wondering if it is anyhow possible to check if the client has activated
>JavaScript and in case he has not to redirect him to another page?
>
>The thing is, as soon as the noscipt tap detects it, php is already parsed
>and withouth JS I don not see a possibility to redirect him.
>
>Does anybody have an idea on that?
>
>Thanx andy
>
>
>
>
>



--- End Message ---
--- Begin Message ---
Hi,

I would like any file under the root of a certain domain name to redirect to
a PHP template file.

For instance, I would like a request for /services/ to redirect to
http://myhost/index.php?path=/services/ . This is similar to what PHP.Net
does with their function lookup shortcut (where you can go to
http://php.net/function-name instead of the longer equivalent.)

I have it set up with mod_rewrite as follows:

RewriteEngine on
RewriteRule  ^(.+)  /path/to/index.php?path=$1  [L]

The only problem is that Apache is considering this a redirect, and is thus
overwriting my $1 with the name of the current file (index.php.) The only
place I can find the original file is
HTTP_SERVER_VARS["REDIRECT_QUERY_STRING"]. Is there a way to pull out the
name of the original file without going through extracting $HTTP_SERVER_VARS
and the like?

BTW, I know there was a post on how PHP.Net did the function shortcut a
while back. If someone can post a link to that again, I'd be grateful. I
can't seem to find it.

Thanks!
Erica


--- End Message ---
--- Begin Message ---
I've just created a "add record to table" type of page - basically copied
a working php file I have on hand, and changed the values etc.

Now, I am having problems trying to troubleshoot something. Basically
my mySQL query is:

INSERT INTO events (TITLE, SUMMARY, ORG, CITY, PROVINCE, DATE, REG_DATE,
FEE) VALUES ('Another Event', 'Summary of this event goes here', 'Another
Organization', 'Coquitlam', 'BC', 'Another Date', 'Another Date', '$250')

and I have a coding in my php file that pretty much tells mySQL if it
can't insert this, spit out the problem:

Can't execute INSERT INTO events (TITLE, SUMMARY, ORG, CITY, PROVINCE,
DATE, REG_DATE, FEE) VALUES ('Another Event', 'Summary of this event
goes here', 'Another Organization', 'Coquitlam', 'BC', 'Another Date',
'Another Date', '$250') Unknown column 'ORG' in 'where clause'

Okay, there's an ORG column in the database table, and if I check my
mySQL phpAdmin interface (even ran the same query in the myPHPAdmin interface),
the very record has been inserted into the
database without problems. So the inserting record into database part
isn't the problem - it seems to me that the problem is that somewhere
along the line, PHP is confused and is telling me something else.

Ideas?

Thanks!


-- 
Laurie Landry
[EMAIL PROTECTED] - email
(604) 693-1120 - voicemail/fax


--- End Message ---
--- Begin Message ---

Are there rumblings of what to look for in the next major release of PHP
yet? Is there a different, better place to ask? I'm just curious...

Wes


--- End Message ---
--- Begin Message ---
I'm setting up a contact page on a site.

Typically I use form inputs to assemble the data and then use the mail()
function to send the data to the appropriate user.

Whenever I submit the form data, I immediately see a system error
reporting that sendmail (version 8.12.1) cant chdir to
/var/spool/clientmqueue ... and naturally the mail does not get
delivered.

Permissions and ownership of this directory are 4770 and root.smmsp
respectively. (smmsp is the SendMail Mail Submission Protocol
userid/groupid).  If I change permissions to 4777, the mail gets
through, but I get a syslog warning that I have dangerous permissions
set for that directory (I agree).

Has anyone else experienced this issue, and or can anyone recommend a
secure solution.
-- 
Regards
Luke
------
Q:  What does FAQ stand for?
A:  We are Frequently Asked this Question, and we have no idea.
------
C.O.L.S FAQ - http://www.linuxsecurity.com/docs/colsfaq.html
Note: Remove NOSPAM from my return address if necessary
------
--- End Message ---
--- Begin Message ---
hi,
I try to upload a file using a form. When I use INPUT TYPE="text" it is ok,
but when i change it to "hidden" it doesn't work :(
This is a part of the form:
<INPUT TYPE="hidden" NAME="dir" VALUE="<? echo $dir?>"  >
where $dir is a directory where I want ot place the file. The script to copy
a file looks like that:
copy($userfile, $dir.$userfile_name);
Please help

Czeslaw



--- End Message ---
--- Begin Message ---
Success. After a bit of tinkering :) and reading up. Thanks for the
ideas.

Now one last question. here is my array $authors:
http://ccl.flsh.usherb.ca/db/authors_under_study.php
sorted alphabetically.

How do I go about sorting again it so it renders:

Aguiar, Flavio            1
Andrade, Mario de    1
Ashcroft, W.D.          1
Atwood, Margaret     3
Auden, W. H.            3
Bernabé, Jean            1
Birney, Earle              4

Basically, I want to start a new array (do i have to?)
and count every time an author appears, eliminating repetition.

J

--- End Message ---
--- Begin Message ---


 Hello,

   
     Can anyone help me in solving this problem..

 For sending mail using sendmail i have written the code like this but it
is giving some error messages in the From address instead of address

 $TO=Me;
 $[EMAIL PROTECTED];


    $fd = popen("/usr/sbin/sendmail -t","w");
    fputs($fd, "To: $user\n");
    fputs($fd, "From: $TO\n");
    fputs($fd, "Subect: Feedback\n");
    $ver = phpversion();
    fputs($fd, "X-Mailer: PHP/FI $ver\n\n");
    fputs($fd, "Hii $user,\n $body \n");
    pclose($fd);


  Can anyone tell the solution for this.....


-Uma

--- End Message ---
--- Begin Message ---
Do you have a specific reason for calling Sendmail directly? If not, try
http://www.php.net/manual/en/function.mail.php

Erica

"Uma Shankari T." <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
>  Hello,
>
>
>      Can anyone help me in solving this problem..
>
>  For sending mail using sendmail i have written the code like this but it
> is giving some error messages in the From address instead of address
>
>  $TO=Me;
>  $[EMAIL PROTECTED];
>
>
>     $fd = popen("/usr/sbin/sendmail -t","w");
>     fputs($fd, "To: $user\n");
>     fputs($fd, "From: $TO\n");
>     fputs($fd, "Subect: Feedback\n");
>     $ver = phpversion();
>     fputs($fd, "X-Mailer: PHP/FI $ver\n\n");
>     fputs($fd, "Hii $user,\n $body \n");
>     pclose($fd);
>
>
>   Can anyone tell the solution for this.....
>
>
> -Uma
>


--- End Message ---
--- Begin Message ---
I'm trying to make a random number kind of a coin toss, 

heads = 1 = left
tales = 2 = right

any solutions

Philip J. Newman
Philip's Domain - Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]
Phone: +64 25 6144012
--- End Message ---
--- Begin Message ---
On Sun, 24 Feb 2002, Philip J. Newman wrote:

> I'm trying to make a random number kind of a coin toss, 
> 
> heads = 1 = left
> tales = 2 = right

Google is your friend.

'php rand'

http://www.alt-php-faq.org/local/90/

Other details in PHP manual, Mathematical functions section.

--- End Message ---
--- Begin Message ---
rand (1, 2)
http://www.php.net/manual/en/function.rand.php
?
J

"Philip J. Newman" wrote:

> I'm trying to make a random number kind of a coin toss,
>
> heads = 1 = left
> tales = 2 = right
>
> any solutions
>
> Philip J. Newman
> Philip's Domain - Internet Project.
> http://www.philipsdomain.com/
> [EMAIL PROTECTED]
> Phone: +64 25 6144012

--
John Taylor-Johnston
-----------------------------------------------------------------------------

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     Université de Sherbrooke:
          http://compcanlit.ca/
          819-569-2064


--- End Message ---
--- Begin Message ---
He was probably looking for an "alternative" solution, such as 
$heads=(microtime() % 2) :-)

Bogdan

Duncan Hill wrote:

>On Sun, 24 Feb 2002, Philip J. Newman wrote:
>
>>I'm trying to make a random number kind of a coin toss, 
>>
>>heads = 1 = left
>>tales = 2 = right
>>
>
>Google is your friend.
>
>'php rand'
>
>http://www.alt-php-faq.org/local/90/
>
>Other details in PHP manual, Mathematical functions section.
>
>



--- End Message ---
--- Begin Message ---
Below is included part of a script for a polls (simple yes no) I am trying
to use cookies to determin if they have already voted or not. No errors are
displaed but, I have tried to vote, and it gives no errors, nor does it give
an increase in the database, fine you might think its doing its job right.
But no, because i asked someone else to vote on it and it still didnt go up,
and he definately has not got the cookies.
Also, is it possible to use variables within cookies' names?
as you can see I am using _$id because there is more than 1 poll likely to
be used. If anyone can help clear up this odd problem I would be very happy.
Alternatilvly, would it be easier to use a second table with IP's of those
voted and the polls wich they have and used
while($num < $max)
{
    if($currip == $row["voter_ip"];
    {
        $gvarvoted = "true";
    }
}
if($gvarvoted == "true")
{
    showres();
}
} or something like that ?
Code follows
--------------
 include "config.php";
 include "functions.php";
$mode=$HTTP_GET_VARS['mode'];
$id = $HTTP_GET_VARS['id'];
$submitted = $HTTP_POST_VARS['pollsubmitted'];
$isyes = $HTTP_POST_VARS['yes'];
$isno = $HTTP_POST_VARS['no'];
/* is set, do some thin */
switch ($mode)
{
 case'show':
 $hasvoted = $HTTP_COOKIE_VARS["hasvoted_$id"];
 if($hasvoted == "hasvoted")
 {
  /* Show Results */
 } else {
 $sql = "SELECT * FROM polls WHERE id = '$id'";
 $result = mysql_db_query($database,$sql,$db);
 $row = mysql_fetch_array($result);
 $noofresponses = $row["noofresponses"];
 $yes = $row["yes"];
 $no = $row["no"];
 $yes = $yes +1;
 $no = $no +1;
 $noofresponses = $noofresponses + 1;
 if(isset($isyes))
 {

  $usql = "UPDATE polls SET noofresponses = '$noofresponses', yes = '$yes'
WHERE id = '$id'";
  $res = mysql_db_query($database,$usql,$db);

 }
 if(isset($isno))
 {
  $usql = "UPDATE polls SET noofresponses = '$noofresponses', no = '$no'
WHERE id = '$id'";
  $res = mysql_db_query($database,$usql,$db);
 }
 setcookie("hasvoted_$id","hasvoted");
 /* end of if(isset($hasvoted_$id) */
 }
?>



--- End Message ---
--- Begin Message ---
ok, i got i working now, thanx to all who helped especially michael, chris & edward

 alyx 



---------------------------------
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
--- End Message ---
--- Begin Message ---
I'm getting a parse error with the following on line 9

http://www.applestudentdevelopers.org/testbed/ASD_PrintEmailLink.phps

any clue?

~ Mike
-- 
Mike Zornek | Project Leader
Apple Student Developers
The Insanely Great Site with the Insanely Long URL
http://www.applestudentdevelopers.org

Personal Site: 
http://www.mikezornek.com

--- End Message ---
--- Begin Message ---
Michael Zornek wrote:

>I'm getting a parse error with the following on line 9
>
>http://www.applestudentdevelopers.org/testbed/ASD_PrintEmailLink.phps
>
>any clue?
>
>~ Mike
>

|$full_anchor_tag  = "<a href=\"mailto\:" ;|

should be

|$full_anchor_tag  = "<a href=\"mailto:\"; ;|

--- End Message ---
--- Begin Message ---
Twas 2/23/02 11:27 PM, when "Michael Zornek" <[EMAIL PROTECTED]>
said:

> I'm getting a parse error with the following on line 9
> 
> http://www.applestudentdevelopers.org/testbed/ASD_PrintEmailLink.phps
> 
> any clue?

Fixed, I figured it out.. I forgot to replace a bunch of vars with the new
names... ugh (so newbie :-)

If you are interested in small little function to help you write less
spamable mailto anchors checkout:

http://www.applestudentdevelopers.org/testbed/ASD_PrintEmailLink.php
http://www.applestudentdevelopers.org/testbed/ASD_PrintEmailLink.phps

~ Mike
-- 
Mike Zornek | Project Leader
Apple Student Developers
The Insanely Great Site with the Insanely Long URL
http://www.applestudentdevelopers.org

Personal Site: 
http://www.mikezornek.com

--- End Message ---

Reply via email to