php-windows Digest 26 Jan 2005 06:19:29 -0000 Issue 2550
Topics (messages 25437 through 25456):
PHP/Javascript question
25437 by: Allen D. Tate
25448 by: phpWalter
25456 by: The Disguised Jedi
Re: Random
25438 by: Jason Barnett
25441 by: Wagner, Aaron
PHP renders funny
25439 by: Louis Young
Re: [php-gurus] PHP renders funny]
25440 by: Louis Young
mysql connect problems
25442 by: Patrick Roane
Re: ello! =))
25443 by: SargeTron
Re: :)
25444 by: SargeTron
Problems with getprotobyname, win, php 4.3.10
25445 by: php_74562.mail.bg
unset Not working as expected
25446 by: Jeremy Schreckhise
25447 by: trystano.aol.com
25449 by: Jeremy Schreckhise
25450 by: trystano.aol.com
CGI Error
25451 by: Thomas Vanhal
25453 by: David Elliott
25454 by: Thomas Vanhal
COM - setting an indexed property
25452 by: Dale Schell
Strange CGI Timeout
25455 by: Eric Spies
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 ---
If I wanted to detect a users screen resolution, would I be better off
using PHP (if possible) or JavaScript?
--- End Message ---
--- Begin Message ---
> If I wanted to detect a users screen resolution, would I be better off
> using PHP (if possible) or JavaScript?
You have to use JS and have it report back to your server so your PHP can
work with it.
Simple! ;)
Walter
--- End Message ---
--- Begin Message ---
yes, PHP only runs on the server side. No php code is transferred to
the client, nor can it be run by the client. the browser only
displays the output of the PHP code that the server executed.
On Mon, 24 Jan 2005 13:50:18 -0600 (CST), phpWalter <[EMAIL PROTECTED]> wrote:
>
> > If I wanted to detect a users screen resolution, would I be better off
> > using PHP (if possible) or JavaScript?
>
> You have to use JS and have it report back to your server so your PHP can
> work with it.
>
> Simple! ;)
>
> Walter
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
The Disguised Jedi
[EMAIL PROTECTED]
PHP rocks!
"Knowledge is Power. Power Corrupts. Go to school, become evil"
Disclaimer: Any disclaimer attached to this message may be ignored.
This message is Certified Virus Free
--- End Message ---
--- Begin Message ---
SargeTron wrote:
"How can I create a random string"
rand() only returns an int (number), but I would like something like
dd75$6*, you know, containing any character. I would like it only to do a
certain string ONCE, so there are no duplicates (in a for loop). Hopefully I
won't need to do a huge array. Any suggestions?
I would suggest uniqid()
http://www.php.net/manual/en/function.uniqid.php
It creates a random string that is 32 characters long, hopefully this
will fit your needs?
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Jason Barnett [mailto:[EMAIL PROTECTED]
> Sent: January 24, 2005 09:41
> To: [email protected]
> Subject: [PHP-WIN] Re: Random
>
>
> SargeTron wrote:
> > "How can I create a random string"
> >
> > rand() only returns an int (number), but I would like something like
> > dd75$6*, you know, containing any character. I would like
> it only to do a
> > certain string ONCE, so there are no duplicates (in a for
> loop). Hopefully I
> > won't need to do a huge array. Any suggestions?
>
> I would suggest uniqid()
> http://www.php.net/manual/en/function.uniqid.php
>
> It creates a random string that is 32 characters long, hopefully this
> will fit your needs?
>
> --
> Teach a man to fish...
>
> NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
> STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
> STFM | http://www.php.net/manual/en/index.php
> STFW | http://www.google.com/search?q=php
> LAZY |
> http://mycroft.mozdev.org/download.html?name=PHP&submitform=Fi
> nd+search+plugins
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Here is a function I found a while back that I use for Random Password creation
##############################################
function str_makerand () {
$minlength = 5;
$maxlength = 10;
$useupper = 1;
$usespecial = 0;
$usenumbers = 1;
/*
Author: Peter Mugane Kionga-Kamau
http://www.pmkmedia.com
Description: string str_makerand(int $minlength, int $maxlength, bool
$useupper, bool $usespecial, bool $usenumbers)
returns a randomly generated string of length between $minlength and
$maxlength inclusively.
Notes:
- If $useupper is true uppercase characters will be used; if false they
will be excluded.
- If $usespecial is true special characters will be used; if false they
will be excluded.
- If $usenumbers is true numerical characters will be used; if false
they will be excluded.
- If $minlength is equal to $maxlength a string of length $maxlength
will be returned.
- Not all special characters are included since they could cause parse
errors with queries.
***********************************************************
* Change Log 11.19.03 *
***********************************************************
aw 11.19.03 Removed zero and alpha O from selection choices
*/
$charset = "abcdefghijklmnopqrstuvwxyz";
if ($useupper) $charset .= "ABCDEFGHIJKLMNPQRSTUVWXYZ";
if ($usenumbers) $charset .= "123456789";
if ($usespecial) $charset .= "[EMAIL PROTECTED]()_+-={}|]["; // Note:
using all special characters this reads: "[EMAIL
PROTECTED]&*()_+`-={}|\\]?[\":;'><,./";
if ($minlength > $maxlength) $length = mt_rand ($maxlength, $minlength);
else $length = mt_rand ($minlength, $maxlength);
for ($i=0; $i<$length; $i++) $key .=
$charset[(mt_rand(0,(strlen($charset)-1)))];
return $key;
}
###########################################
--- End Message ---
--- Begin Message ---
Hi guys
I've got a website set up on my machine and it all works fine if I
access it from the local machine, but when I access it from another
machine the web page comes out all distorted and only comes right if I
refresh the page a couple of times.
Any ideas?
Cheers
Louis
--- End Message ---
--- Begin Message ---
Just more on this. Check what happens to the HTML rendered by the PHP
script:
<tr>
<td align="left" valign="top" colspan="3"><img src="images/shim.gif"
alt="" width="87" height="5" border="0"></td>
</tr>
<tr>
<td align="leFILE0 á„z§ ?ì?8 X l – ` H
XÉGä+Á XÉGä+Á _lž?æÄP.WÅ € 0 p V
4;†3ªÄP¸š3ªÄP¸š3ªÄP¸š3ªÄ P D
p s b a s e . d l l ~ € H @ P D D 1^N# t‚ÿÿÿÿ‚yGÿÿÿÿ‚yG
– –FILE0 ÷’F¨ 8 ` m – ` H XÉGä+Á
XÉGä+Á?•Ë”?æÄЈˆ'Å € 0 x Z 4;†3ªÄ yš3ªÄ yš3ªÄ
yš3ªÄ – n t l a n m a n . d l l € H @ – – 1
ó ÿÿÿÿ‚yG – –FILE0 2“F¨ 8 X n – ` H
XÉGä+Á XÉGä+Á`ŸÈ’?æÄЈˆ'Å € 0 p V 4;†3ªÄ
¤š3ªÄ ¤š3ªÄ ¤š3ªÄ 0 $
n e t u i 0 . d l l ~ € H @ 0 $ $ 1ó x‚ÿÿÿÿ‚yGÿÿÿÿ‚yG –
–FILE0 m“F¨ 8 X o – ` H XÉGä+Á
XÉGä+ÁàØÔ’?æÄЈˆ'Å € 0 p V 4;†3ªÄH š3ªÄH
š3ªÄH š3ªÄ ? „
n e t u i 1 . d l l ~ € H 8 @ ? „ „ 19*ó x‚ÿÿÿÿ‚yGÿÿÿÿ‚yG –
–FILE0 jz§ ?ì?8 X p { ` H XÉGä+Á
XÉGä+Á|]¶?æÄ §WÅ € 0 p X 4;†3ªÄ 1š3ªÄ
1š3ªÄ 1š3ªÄ ? † w 3 2 t i m e . d l l € H ( @ ? † †
1)Œ³Q x‚ÿÿÿÿ‚yGÿÿÿÿ‚yG { {FILE0 ¨“F¨ 8 X q { `
H XÉGä+Á XÉGä+Á «”’?æÄЈˆ'Å º 0 p V
4;†3ªÄÐ×>š3ªÄÐ×>š3ªÄÐ×>š3ªÄ 0 *
n e t r a p . d l l ~ € H @ 0 * * 1ÑG# ÿÿÿÿ‚yGÿÿÿÿ‚yG {
{FILE0 PZ%¨ 8 X r { ` H XÉGä+Á
XÉGä+Áp?ã??æÄp¥EíÅ € 0 p X
4;†3ªÄ€˜Lš3ªÄ€˜Lš3ªÄ€˜Lš3ªÄ 0 6 m s v c p 6 0 . d l l € H
b @ 0 6 6 1cµ³Q x‚
-------- Original Message --------
Subject: [php-gurus] PHP renders funny
Date: Mon, 24 Jan 2005 17:18:16 +0200
From: Louis Young <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [email protected], [EMAIL PROTECTED]
Hi guys
I've got a website set up on my machine and it all works fine if I
access it from the local machine, but when I access it from another
machine the web page comes out all distorted and only comes right if I
refresh the page a couple of times.
Any ideas?
Cheers
Louis
------------------------------------------------------------------------
*Yahoo! Groups Links*
* To visit your group on the web, go to:
http://groups.yahoo.com/group/php-gurus/
* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/>.
--- End Message ---
--- Begin Message ---
I am trying to est. a connection to mysql via PHP5 on
my win XP and I keep getting the undefined function
error. By the way I am running apache 1.3.23.
I believe I've made the necessary adjustments to the
php.ini. (uncommented the extension=php_mysql.dll) and
copied this to my windows dir.
There is a line in php.ini that says:
; Default host for mysql_connect() (doesn't apply in
safe mode).
mysql.default_host =
Do i need to put anything here?
thanks
=====
----------------
"forget your lust for the rich man's gold. All that you need, is in your soul.
You can do this if you try. All that I want for you my son, is to be satisfied"
~ Lynard Skynard
--- End Message ---
--- Begin Message ---
Er... what? Anyway, it sounds like this shouldn't be here.
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Looking forward for a response :P
>
> password for archive: (snip)
>
--- End Message ---
--- Begin Message ---
hmm, another 1
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> I don't bite, weah!
>
> password: (snip)
--- End Message ---
--- Begin Message ---
Hi list,
I am writing a standalone PHP program (not web based, but
not GTK either, just a console app) and I want to
re-distribute the PHP binaries with it. Then I noticed that
on a particular WinXP machine - not a brand new install,
but recent-ish - the getprotobyname('tcp') call fails
(returning bool(false) according to var_dump).
When trying to reproduce the problem on my other WinXP
(where it normally works fine) I have pinpointed it to the
file called
C:\WINDOWS\system32\drivers\etc\protocol
If I either unset the SystemRoot environment setting, or
rename the 'protocol' file I get the same behaviour of
getprotobyname() (returning false instead of 6)
Btw, the SOL_TCP constant is undefined when getprotobyname
returns false, as it is set at runtime.
Of course I can bypass this by more ot less 'safely'
hardcoding SOL_TCP to be 6 (if undefined), but I don't like
it - I'd rather discover the primary reason for this to
happen.
Has anyone here tackled with a similar problem? Ideas what
might be wrong, or what additional test could be done?
Thanks.
-----------[ Code to reproduce ]-------------
<?php
$a = getprotobyname('TCP');
var_dump($a);
?>
---------------------------------------------
-----------------------------
http://www.atol.bg - ������ ������� �� ��������� � ����� ��������!
--- End Message ---
--- Begin Message ---
Good afternoon group! I have a simple addition form with add/cancel
buttons. When the add button is clicked the action of the browser is sent
to a second processing page that verifies data and either adds the current
record or sends the client back to the addition form prepopulating it the
SESSION data. This works great except when I try to unset the SESSION
variables their contents remain. So if my user refreshes or navigates to
the page at a latter time with the same session id the form pre-populates,
which is undesirable.
Here is the Code. Thanks for any help.
Jeremy Schreckhise
Page 1 the addition page called lnu_add.php:
/***************************************************************************
************/
<?php
session_start();
$strProject = $_SESSION['strProject'];
$strHowMany = $_SESSION['strHowMany'];
$strNodes = $_SESSION['strNodes'];
$strOutput = $_SESSION['strOutput'];
$strStation = $_SESSION['strStation'];
$strRoutes = $_SESSION['strRoutes'];
$strSections = $_SESSION['strSections'];
unset($_SESSION['strProject']); // these never get unset
unset($_SESSION['strHowMany']);
unset($_SESSION['strNodes']);
unset($_SESSION['strOutput']);
unset($_SESSION['strStation']);
unset($_SESSION['strRoutes']);
unset($_SESSION['strSections']);
?>
<html>
<head>
<title>Add L&U: <?php echo $lnu ?> </title>
<link rel="stylesheet" type="text/css" href="../homestyle.css">
<script language="javascript">
function Cancel_Click()
{
var strURL;
strURL = "./lnu_brw.php";
window.location = strURL;
}
</script>
</head>
<body>
<script type="text/javascript" src="utilicis_menu.js">
</script>
<br><br>
<table align="center" border=0>
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size=4>
<b>Add New L&U</b>
</font>
</td>
</tr>
</table>
<br><br>
<form name = "frmLNU" method = "post" action = '<?php echo
"./lnu_add2.php" ?>'>
<table class='displaytable3'>
<tr><td>
<table class='heading' align=center>
<tr>
<td class='heading'>New L&U Project</td>
</tr>
</table><br>
<table cellspacing=0 cellpadding=0>
<tr><td class='rpthead'>Project Name:</td><td
class='rptspace'> </td><td><input type="textbox" size=20
name="txtProject" class="text" value="<?php echo $strProject; ?>"></td></tr>
<tr><td class='rpthead'># of Routes:</td><td
class='rptspace'> </td><td><input type="textbox" size=20
name="txtHowMany" class="text" value="<?php echo $strHowMany; ?>"></td></tr>
<tr><td class='rpthead'>Routes:</td><td
class='rptspace'> </td><td><input type="textbox" size=20
name="txtRoutes" class="text" value="<?php echo $strRoutes; ?>"></td></tr>
<tr><td class='rpthead'>Nodes:</td><td
class='rptspace'> </td><td><input type="textbox" size=20
name="txtNodes" class="text" value="<?php echo $strNodes; ?>"></td></tr>
<tr><td class='rpthead'>Sections:</td><td
class='rptspace'> </td><td><input type="textbox" size=20
name="txtSections" class="text" value="<?php echo $strSections;
?>"></td></tr>
</table><br>
<center><font size=4 color=blue><b>STATION LIST</b></font></center>
<table class='displaytable4' align='center' cellspacing=0 cellpadding=0>
<tr>
<td><textarea rows=5 cols=90 name="tarStation" wrap="wrap"><?php echo
$strStation; ?></textarea></td>
</tr>
</table>
<center><font size=4 color=blue><b>OUTPUT STATION LIST</b></font></center>
<table class='displaytable4' align='center' cellspacing=0 cellpadding=0>
<tr>
<td><textarea rows=5 cols=90 name="tarOutput" wrap="wrap"><?php echo
$strOutput; ?></textarea></td>
</tr>
</table>
<tr><td align=center><input type="submit" alt="Add LNU" border=0
name="cmdAdd" value="Add L&U" ><input type="button" name="cmdCancel"
onclick="Cancel_Click()" value="Cancel"></td></tr>
</table>
</form>
</body>
</html>
/***************************************************************************
****************/
Page 2 the processing page called lnu_add2.php
/***************************************************************************
****************/
<?php
//session stuff
session_start();
$username = $_SESSION['username'];
$password = $_SESSION['password'];
//timer
set_time_limit(60);
//VARS
$dbconn = odbc_connect("Utilicis_Nargon_ODBC",$username,$password) ;
// error_reporting(0);
$_SESSION['strProject'] = $_POST['txtProject'];
$_SESSION['strHowMany'] = $_POST['txtHowMany'];
$_SESSION['strNodes'] = $_POST['txtNodes'];
$_SESSION['strOutput'] = $_POST['tarOutput'];
$_SESSION['strRoutes'] = $_POST['txtRoutes'];
$_SESSION['strSections'] = $_POST['txtSections'];
$_SESSION['strStation'] = $_POST['tarStation'];
$strProject = $_SESSION['strProject'];
$strHowMany = $_SESSION['strHowMany'];
$strNodes = $_SESSION['strNodes'];
$strOutput = $_SESSION['strOutput'];
$strRoutes = $_SESSION['strRoutes'];
$strSections = $_SESSION['strSections'];
$strStation = $_SESSION['strStation'];
if(!is_numeric($strHowMany))
{
error_reporting(E_ALL^E_NOTICE);
$strOut = "./lnu_add.php";
print("<script language='JavaScript'>alert('Number of Routes Not
Numeric...Please Try Again'); window.location = '$strOut' </script>");
die;
}
echo "$strProject $strHowMany";
$dbconn = odbc_connect("Utilicis_Nargon_ODBC",$username,$password) ;
$strQry = "SELECT * FROM lu WHERE project-name = '".$strProject."'";
$rsTable = odbc_do($dbconn, $strQry);
if (odbc_fetch_row($rsTable))
{
error_reporting(E_ALL^E_NOTICE);
$strOut = "./lnu_add.php";
print("<script language='JavaScript'>alert('Project Already
Exist...Please Try Again'); window.location = '$strOut' </script>");
die;
}
else
{
$strQry = "INSERT INTO lu
(how-many-routes,nodes,output-stations,project-name,routes,sections,station-
list)
VALUES($strHowMany,'".$strNodes."','".$strOutput."','".$strProject."','".$st
rRoutes."','".$strSections."','".$strStation."')";
//$strQry = "INSERT INTO lu VALUES(1,'','','lnu100','','','')";
$rsTable = odbc_do($dbconn, $strQry);
if($rsTable)
{
error_reporting(E_ALL^E_NOTICE);
$strOut = "./lnu_brw2.php?lnu=".$strProject;
unset($_SESSION['strProject']);
unset($_SESSION['strHowMany']);
unset($_SESSION['strNodes']);
unset($_SESSION['strOutput']);
unset($_SESSION['strStation']);
unset($_SESSION['strRoutes']);
unset($_SESSION['strSections']);
print("<script language='JavaScript'>alert('Record Added');
window.location = '$strOut' </script>");
}
else
{
error_reporting(E_ALL^E_NOTICE);
$strOut = "./lnu_add.php?lnu=".$strProject;
print("<script language='JavaScript'>alert('Unable to Add
Record....Query Problem'); window.location = '$strOut' </script>");
die;
}
}
?>
--- End Message ---
--- Begin Message ---
try, session_unset('session_var_name'),
Tryst
--- End Message ---
--- Begin Message ---
This did not work but I did find a solution. For some reason PHP's unset
was failing, because my local variables were named the same as my super
global SESSION variables. When I changed the naming convention of my
SESSION variables everything worked flawlessly. I thought you could have a
local variable and a SESSION variable named the same?
Jeremy Schreckhise
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> try, session_unset('session_var_name'),
>
> Tryst
>
--- End Message ---
--- Begin Message ---
I think this was one of the main problems that came about when PHP used to be
shipped with register_globals set to OFF (as well as security measures). With
PHP register_globals set to ON, you are not allowed, or are not supposed to,
have local variables and $SESSION, $POST, $GET etc with the same names.
Tryst
--- End Message ---
--- Begin Message ---
Hi,
I have a problem with my php script.
Let's say for my login page, it usually works but sometimes it doesn't and give
me this error :
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers.
My server is windows 2003. This didn't happen when our website was hosted on
third party.
Any idea why this would happen?
Thanks
Tom
--- End Message ---
--- Begin Message ---
Hello php-windows,
On 24 January 2005, at 14:06:21 -0800 (which was 22:06 where I live) Thomas
Vanhal on php-windows wrote
> I have a problem with my php script. Let's say for my login page, it
> usually works but sometimes it doesn't and give me this error :
> CGI Error
> The specified CGI application misbehaved by not returning a complete set
> of HTTP headers.
> My server is windows 2003. This didn't happen when our website was hosted
> on third party. Any idea why this would happen?
Yes. you have made an SQL call. Use ODBC not the mssql.dll it is related to
a very old connecter to mssql (like 6.5). I have explained this to this
list a few time before so it might be in some archives some where.
MS say it is PHP
PHP say it is MS
You choose !!
--
Ti2GO, _______________________________________________
David | David Elliott | Softwar Engineer |
_________________________| [EMAIL PROTECTED] | PGP Key ID 0x650F4534 |
| Man who sucks nipples, make clean breast of things. |
pgp7eQzdMRBwL.pgp
Description: PGP signature
--- End Message ---
--- Begin Message ---
I am actually using ODBC already to access our database.
I actually think my problem is the the :
header("Location: ../Issues/EditIssue.php?number=".$_GET['number']);
exit();
Because if replace it with a :
<HEAD><META HTTP-EQUIV="Refresh" CONTENT="0;url=
It seems to work.
Thanks for you help!
----- Original Message -----
From: "David Elliott" <[EMAIL PROTECTED]>
To: "Thomas Vanhal on php-windows" <[email protected]>
Sent: Monday, January 24, 2005 2:19 PM
Subject: Re: [PHP-WIN] CGI Error
--- End Message ---
--- Begin Message ---
I have a COM object "com" with a property "prop". "prop" is an indexed
array. I am using PHP 5.1.0-dev.
None of the following work:
$com->prop(0) = 'blue';
$com->prop(0, 'blue');
$com->prop = array ('blue');
Is there a way to write to an indexed property?
Dale Schell
--- End Message ---
--- Begin Message ---
Hello.
I recently moved my web server to a new machine. The operating system has
stayed the same (Windows 2000 server), the IIS version (IIS5) has stayed the
same. I am using the same version of php (4.3.6) and copied over the same
php.ini file. The directory structure I used is exactly the same with file
permissions given to all the proper directories.
The php pages are the same exact files that were used on the old server and
had worked there flawlessly for 2 years.
I have gone through and made sure all the IIS settings are the same as they
used to be, and checked php.ini about a billion times. I've also googled on
this problem for a few days now and nothing I've found has been able to
help.
I am having a problem whenever IE tries to post to any php page when the
form being posted includes a textarea with what seems like anything over 50
characters.
I can create forms from scratch and repeat this error with any form I make
posting to any existing or brand new php pages.
If I make a new php page that consists only of <? die("got here"); ?> it
will never even get that far.
I know the post is getting up to IIS, since IIS does load php.exe and then
begins to wait for it where I get the usual CGI Timeout error as php.exe
appears to hang.
I can test with the exact same pages, with the exact same php.ini, with the
exact same data, with the exact same ISS setup, with the exact same file
permissions set, on my old machine and it works just fine.
I have done phpinfo() on both machines and compared the results of each.
The only differences seem to be in the IP and computer names which of course
would make sense.
Any ideas? :)
--- End Message ---