|
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 8 Jul 2004 07:22:01 -0000 Issue 2864
php-general-digest-help
lists.php.net
Date: Thu Jul 08 2004 - 02:22:01 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 8 Jul 2004 07:22:01 -0000 Issue 2864
Topics (messages 189893 through 189943):
Re: encode $searchenquiry
189893 by: Torsten Roehr
189895 by: John Taylor-Johnston
189896 by: John Taylor-Johnston
Re: Form Submission
189894 by: Torsten Roehr
Re: sending attachments
189897 by: Juan Pablo Herrera
189908 by: Juan Pablo Herrera
Re: post without <form>
189898 by: Lars Torben Wilson
189902 by: Marek Kilimajer
189906 by: Lars Torben Wilson
Re: Malicious SQL
189899 by: John W. Holmes
189900 by: John W. Holmes
189901 by: John W. Holmes
189935 by: Jason Wong
Active Directory Authentification
189903 by: Mike Tuller
$_SERVER[HTTP_REFERER]
189904 by: Shaun
189905 by: John Nichel
189907 by: Justin Patrin
189930 by: Gerard Samuel
Got error "Inappropriate ioctl for device" when trying ssl connection....
189909 by: Alex Shi
Slideshow using PHP
189910 by: Todd Cary
189928 by: Alex Shi
Storing website templates in sessions
189911 by: Joe Harman
189912 by: John W. Holmes
Client IP
189913 by: Rosen
189914 by: Matthew Sims
189915 by: John W. Holmes
189916 by: Rosen
189917 by: John W. Holmes
189918 by: Rosen
189919 by: Robert Sargant
189920 by: Lars Torben Wilson
189922 by: Lars Torben Wilson
189923 by: Rosen
189924 by: John W. Holmes
189925 by: Rosen
189929 by: Michael Sims
189931 by: Jason Wong
189936 by: Lars Torben Wilson
189937 by: Lars Torben Wilson
binary data over UDP with PHP?
189921 by: coder_1024
189927 by: Keith Greene
189940 by: coder_1024
Re: call_user_func and call-time pass-by-reference
189926 by: Tom Rogers
189938 by: Curt Zirzow
Double parenthesis crisis
189932 by: Ryan Schefke
189933 by: Justin Patrin
189934 by: John W. Holmes
Re: Using split to establish extension of file
189939 by: Curt Zirzow
ssl key and crt generation
189941 by: Hugh Beaumont
Re: Want to save png to file
189942 by: Wudi
[Newbie Guide] For the benefit of new members
189943 by: Ma Siva Kumar
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
"John Taylor-Johnston" <taylorjo
CollegeSherbrooke.qc.ca> wrote in message
news:40EC39BD.510A367E
CollegeSherbrooke.qc.ca...
> I have created an .inc that allows me to click on a submit to show the
next or previous 25 records found etc. The problem is that if $searchenquiry
includes a quotation mark, the html looks like:
>
> <input type="hidden" name="searchenquiry" value=""atwood's" -margaret\">
>
> Is there a function to encode $searchenquiry to do this?
>
> <input type="hidden" name="searchenquiry"
value=""atwood's" -margaret\">
>
> Or should I URLencode $searchenquiry or ... how should I approach this?
>
> <input type=\"hidden\" name=\"searchenquiry\"
value=\"".$searchenquiry."\">
>
> John
Hi John,
you are looking for htmlentities():
http://de3.php.net/htmlentities
Regards, Torsten Roehr
attached mail follows:
> > Or should I URLencode $searchenquiry or ... how should I approach this?
> Hi John,
> you are looking for htmlentities():
> http://de3.php.net/htmlentities
> Regards, Torsten Roehr
Torsten,
Thanks. I think I'm going to start with htmlspecialchars().
htmlentities() might be over kill?
Great :)
John
--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."
' ' ' Collège de Sherbrooke:
ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/
- Université de Sherbrooke:
http://compcanlit.ca/
819-569-2064
attached mail follows:
Torsten
Here it is, if it is any use to you?
John
-----------------------------------------------------------------------------------
$sql = 'SELECT *,MATCH (KW,AUS)
AGAINST (\''.stripslashes($searchenquiry).'\' IN BOOLEAN MODE)
AS relevancy FROM '.$table.'
WHERE MATCH (KW,AUS)
AGAINST (\''.stripslashes($searchenquiry).'\' IN BOOLEAN MODE)
ORDER BY relevancy DESC
LIMIT '.$offset.','.$limit.';';
include (back_forth.inc);
------------------------------------------------------------------------------------
<?php
###############
##back_forth.inc##
#####################################################
## $mycounter is set by script calling settings_limit.inc ####
#####################################################
#####################################################
############### Set $offset & $limit ################
#####################################################
if((!$offset) || ($offset < 0))
{
$offset = 0;
}
$limit = 25;
#####################################################
############### $nextinsert #########################
#####################################################
$new_offset = $offset + $limit;
$disp = $limit;
if ($new_offset + $limit > $mycounter)
{
$disp = $mycounter - $new_offset;
}
if ($disp > 0)
{
$nextinsert = "<form ACTION=\"".$SCRIPT_NAME."\" TARGET=\"_top\" METHOD=\"POST\"><td>Next ".$disp." Requests <input type=\"submit\" name=\"submit\" value=\">>\"><input type=\"hidden\" name=\"offset\" value=\"".$new_offset."\"><input type=\"hidden\" name=\"table\" value=\"".$table."\"><input type=\"hidden\" name=\"db\" value=\"".$db."\">";
if($searchenquiry)
$nextinsert .= "<input type=\"hidden\" name=\"searchenquiry\" value=\"".htmlspecialchars($searchenquiry)."\">";
if($scholarsenquiry)
$nextinsert .= "<input type=\"hidden\" name=\"scholarsenquiry\" value=\"".$scholarsenquiry."\">";
if($titlesenquiry)
$nextinsert .= "<input type=\"hidden\" name=\"titlesenquiry\" value=\"".$titlesenquiry."\">";
$nextinsert .= "</td></form>";
}
#####################################################
############### $previousinsert #####################
#####################################################
$new_offset2 = $offset - $limit;
if ($offset > 0) // can display previous msg
{
$disp = $limit;
$previousinsert = " <font face=\"arial\" size=2><A HREF=\"index.html?submit=submit&offset=".$new_offset2."&table=$table&db=$db\"><< Previous ".$disp." Requests</a></font>";
$previousinsert = "<form ACTION=\"".$SCRIPT_NAME."\" TARGET=\"_top\" METHOD=\"POST\"><td><input type=\"submit\" name=\"submit\" value=\"<<\"> Previous ".$disp." Requests<input type=\"hidden\" name=\"offset\" value=\"".$new_offset2."\"><input type=\"hidden\" name=\"table\" value=\"".$table."\"><input type=\"hidden\" name=\"db\" value=\"".$db."\">";
if($searchenquiry)
$previousinsert .= "<input type=\"hidden\" name=\"searchenquiry\" value=\"".htmlspecialchars($searchenquiry)."\">";
if($scholarsenquiry)
$previousinsert .= "<input type=\"hidden\" name=\"scholarsenquiry\" value=\"".$scholarsenquiry."\">";
if($titlesenquiry)
$previousinsert .= "<input type=\"hidden\" name=\"titlesenquiry\" value=\"".$titlesenquiry."\">";
$previousinsert .= "</td></form>";
}
#####################################################
############### $lastinsert #########################
#####################################################
$new_offset3 = $mycounter - $limit;
if (($new_offset3 > $limit) and ($offset != $mycounter - $limit)) // can display goto end msg
{
$lastinsert = "<form ACTION=\"".$SCRIPT_NAME."\" TARGET=\"_top\" METHOD=\"POST\"><td>Go To End <input type=\"submit\" name=\"submit\" value=\">>|\"><input type=\"hidden\" name=\"offset\" value=\"".$new_offset3."\"><input type=\"hidden\" name=\"table\" value=\"".$table."\"><input type=\"hidden\" name=\"db\" value=\"".$db."\">";
if($searchenquiry)
$lastinsert .= "<input type=\"hidden\" name=\"searchenquiry\" value=\"".htmlspecialchars($searchenquiry)."\">";
if($scholarsenquiry)
$lastinsert .= "<input type=\"hidden\" name=\"scholarsenquiry\" value=\"".$scholarsenquiry."\">";
if($titlesenquiry)
$lastinsert .= "<input type=\"hidden\" name=\"titlesenquiry\" value=\"".$titlesenquiry."\">";
$lastinsert .= "</td></form>";
}
#####################################################
############### $firstinsert ########################
#####################################################
$new_offset4 = $mycounter - $limit;
if ($new_offset4 > $limit) // can display goto beginning msg
{
$new_offset4 = 0;
$firstinsert = "<form ACTION=\"".$SCRIPT_NAME."\" TARGET=\"_top\" METHOD=\"POST\"><td><input type=\"submit\" name=\"submit\" value=\"|<<\"> Go To Beginning<input type=\"hidden\" name=\"offset\" value=\"".$new_offset4."\"><input type=\"hidden\" name=\"table\" value=\"".$table."\"><input type=\"hidden\" name=\"db\" value=\"".$db."\">";
if($searchenquiry)
$firstinsert .= "<input type=\"hidden\" name=\"searchenquiry\" value=\"".htmlspecialchars($searchenquiry)."\">";
if($scholarsenquiry)
$firstinsert .= "<input type=\"hidden\" name=\"scholarsenquiry\" value=\"".$scholarsenquiry."\">";
if($titlesenquiry)
$firstinsert .= "<input type=\"hidden\" name=\"titlesenquiry\" value=\"".$titlesenquiry."\">";
$firstinsert .= "</td></form>";
}
#####################################################
############### Display Inserts #####################
#####################################################
#####################################################
if (($previousinsert) or ($nextinsert))
#echo "<center><table border=0 cellspacing=\"5\" cellpadding=\"0\">";
echo "<table border=0 cellspacing=\"5\" cellpadding=\"0\">";
#if (($previousinsert) || ($nextinsert))
#echo "<caption ALIGN=BOTTOM><small>(Sorted by id - $mycounter records found total)</small></caption>";
if (($previousinsert) or ($nextinsert))
echo "<tr>";
if (($firstinsert) and ($offset != 0)) echo "$firstinsert";
if ($previousinsert) echo "$previousinsert";
if (($previousinsert) && ($nextinsert)) echo "<td> | </td>";
if ($nextinsert) echo "$nextinsert";
if ($lastinsert) echo "$lastinsert";
if (($previousinsert) or ($nextinsert))
#echo "</tr></table></center>";
echo "</tr></table>";
?>
attached mail follows:
"Justin Patrin" <papercrane
gmail.com> wrote in message
news:432beae0407071030c66e30a
mail.gmail.com...
> On Wed, 7 Jul 2004 10:06:25 +0200, Torsten Roehr <roehr
zilleon.com>
wrote:
> > "Curt Zirzow" <php-general
zirzow.dyndns.org> wrote in message
> > news:20040706221159.GM99175
bagend.shire...
> > > * Thus wrote Torsten Roehr:
> > > > > >
> > > > > > How do you check which button was pressed (read: which action
should
> > be
> > > > > > performed) when not relying on this?
> > > > > >
> > > > >
> > > > > The button is generally *not* sent by the browser if you hit enter
> > > > > instead of submit. This *will* happen, so you have to deal with
it.
> > > > >
> > > > > If you want to knwo what button was pressed, you have to have
> > > > > different button names or values and check them. A button is just
> > > > > another form element that is submitted.
> > > >
> > > > I believe you are wrong here. I just checked it in IE5 and Opera
7.23.
> > > > Submitting a form by hitting enter IS THE SAME as pressing a submit
> > button
> > >
> > > no, it is simply unpredictable to what will happen, my test case...
> > >
> > > Site: google.com
> > > Browsers: IE6, Opera, Firefox, netscape4
> > > Test: Enter 'asdf' and hit enter.
> > >
> > > Results:
> > > Opera and firefox sent in the url &btnG=Search, signifying that
> > > the first button has been submited.
> > >
> > > IE6 and netscape4, don't have that parameter in the url.
> > >
> > > In fact, google *had* code that checked for the btnG value and if it
> > > exsited it would display a tip about being able to simply hit
> > > enter. They no longer do that since it is unreliable.
> > >
> > > >
> > > > So from my point of view a form cannot be submitted without at least
one
> > of
> > > > the submit button values ending in POST.
> > >
> > > And if it did, which one does it send? If there are multiple
> > > buttons on a page, does it send the one closest to the focused
> > > item? or does it send the very first one it finds no matter how the
> > > page is visually layed out?
> > >
> > > >
> > > > What do you think?
> > >
> > > Never rely on button values to decide on a course of action.
> >
> > Dear Curt and Justin,
> >
> > thanks for putting so much effort into this topic. Then how do YOU
handle
> > this? How do you set up your form actions and how do you check them
> > regardless of the submit buttons?
> >
>
> To know if a form has been submitted, I generally use a hidden
> variable (usually called "submitted"). This lets me easily know if the
> form was submitted, even if it had no values in any other fields. I
> means I don't have to rely on user input or button-pushing.
>
> If you *do* have multiple buttons, you should still have the
> "submitted" hidden field, but also check the button values. If no
> button values are present, you either have to assume that the suer
> meant one of them (normal submit maybe?) or show an error and have the
> user click the right button.
>
> I've frequently used two buttons with the same name that have the
> values "yes" and "no". If the user submits the form without pressing a
> button, I assume "yes". In other words,
> if(isset($_REQUEST['submitted']) && $_REQUEST['confirm'] != 'no') {
> file://process form data
> }
Thanks, Justin!
attached mail follows:
Thix class http://www.phpbuilder.net/snippet/detail.php?type=snippet&id=614
it's good., but i can't embed Image in message body, i used function
embed_image.Who have experience in this class?.
Regards,
Juan
> Hi!
> The class it ok.
> How can I put a GIF in Base64 in the message body?
>
> Regards,
> Juan
>
>> ----- Original Message -----
>> From: "Curlys" <curlybraces
dialogsl.net>
>> To: "PHP" <php-general
lists.php.net>
>> Sent: Wednesday, July 07, 2004 1:04 PM
>> Subject: [PHP] sending attachments
>>
>>
>>> can some body help me to send an email attachment ( a log file ) from
>>> php
>> ?
>>> Actaually i need a real guide ............plz
>>
>> I used this e-mail class some time ago:
>>
>> http://www.phpbuilder.net/snippet/detail.php?type=snippet&id=614
>>
>>
>> regards,
>> Ewout
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi!
I'm testing HTML Mime Mail Class, it's really complete. Features:
- text
- text + attached
- html
- html + attached
- html + Embeds
Who has experience with this class?
Regards,
Juan
> This class
> http://www.phpbuilder.net/snippet/detail.php?type=snippet&id=614 it's
> good., but i can't embed Image in message body, i used function
> embed_image.Who have experience in this class?.
>
> Regards,
> Juan
>
>
>> Hi!
>> The class it ok.
>> How can I put a GIF in Base64 in the message body?
>>
>> Regards,
>> Juan
>>
>>> ----- Original Message -----
>>> From: "Curlys" <curlybraces
dialogsl.net>
>>> To: "PHP" <php-general
lists.php.net>
>>> Sent: Wednesday, July 07, 2004 1:04 PM
>>> Subject: [PHP] sending attachments
>>>
>>>
>>>> can some body help me to send an email attachment ( a log file )
>>>> from php
>>> ?
>>>> Actaually i need a real guide ............plz
>>>
>>> I used this e-mail class some time ago:
>>>
>>> http://www.phpbuilder.net/snippet/detail.php?type=snippet&id=614
>>>
>>>
>>> regards,
>>> Ewout
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Josh Close wrote:
> So basically there is no easy way around this.
>
> What I'm trying to do is have a page return to a page that was a
> couple pages back with the same get info. On the second page I can do
>
> $return_url = $_SERVER['HTTP_REFERER'];
>
> to get the previous url. But then I need to pass it on to the next
> page, then that page will return to the $return_url.
>
> I think passing via $_SESSION vars or cookies would be easier then
> doing actual socket posts.
>
> If there is an easier way than session or cookies to do this, I'd like to know.
>
> -Josh
It's super easy, actually. There's been a wee bit of code floating around
the mailing list for 5 or so years for this:
function PostToHost($host, $path, $data_to_send) {
$fp = fsockopen($host,80);
fputs($fp, "POST $path HTTP/1.1\n");
fputs($fp, "Host: $host\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
fputs($fp, "Content-length: ".strlen($data_to_send)."\n");
fputs($fp, "Connection: close\n\n");
fputs($fp, $data_to_send);
while(!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
Just modify to suit and you're good to go. Note: you need to URL-encode the
data you send into a string before passing it to the above function.
Hope this helps,
Torben
--
Torben Wilson <torben
php.net>
attached mail follows:
Lars Torben Wilson wrote:
> Josh Close wrote:
>
>> So basically there is no easy way around this.
>>
>> What I'm trying to do is have a page return to a page that was a
>> couple pages back with the same get info. On the second page I can do
>>
>> $return_url = $_SERVER['HTTP_REFERER'];
>>
>> to get the previous url. But then I need to pass it on to the next
>> page, then that page will return to the $return_url.
>>
>> I think passing via $_SESSION vars or cookies would be easier then
>> doing actual socket posts.
Use session var if you are already using sessions, else use cookie
>>
>> If there is an easier way than session or cookies to do this, I'd like
>> to know.
>>
>> -Josh
>
>
> It's super easy, actually. There's been a wee bit of code floating around
> the mailing list for 5 or so years for this:
but try to make the code working in the browser ;)
attached mail follows:
Marek Kilimajer wrote:
> Lars Torben Wilson wrote:
>
>> Josh Close wrote:
>>
>>> So basically there is no easy way around this.
>>>
>>> What I'm trying to do is have a page return to a page that was a
>>> couple pages back with the same get info. On the second page I can do
>>>
>>> $return_url = $_SERVER['HTTP_REFERER'];
>>>
>>> to get the previous url. But then I need to pass it on to the next
>>> page, then that page will return to the $return_url.
>>>
>>> I think passing via $_SESSION vars or cookies would be easier then
>>> doing actual socket posts.
>
>
> Use session var if you are already using sessions, else use cookie
Sessions are one way to deal with it, and would make the thing much
easier than setting your own cookies and hoping the user has cookies'
enabled (never a safe bet)--at least, assuming your PHP is configured
correctly. However, unless you wanted to send all the form data in the
cookie, you then need a way to store the data on the server side,
probably in the session manager. Not hard, but not an obvious win
over just posting the data where you wish.
In this situation, I would probably combine the two techniques and just
store the $return_url in a session var and then use the postToHost()
function to do the final post back to that page.
>>> If there is an easier way than session or cookies to do this, I'd
>>> like to know.
>>>
>>> -Josh
>>
>>
>>
>> It's super easy, actually. There's been a wee bit of code floating around
>> the mailing list for 5 or so years for this:
>
>
> but try to make the code working in the browser ;)
Not sure what you mean here. The browser is irrelevant with the posting
code. Using sessions means more interaction with the browser, not less.
The less you need to depend on the browser, the less you'll have to debug.
Granted, with the proper setup this is not so much of an issue with
sessions, but just posting the data saves a bit of server-side work.
Torben
attached mail follows:
Brian Dunning wrote:
> I have a question about this. Here is from the documentation:
>
> The PHP directive magic_quotes_gpc is on by default, and it
> essentially runs addslashes() on all GET, POST, and COOKIE data.
>
> Why doesn't this automatically prevent injections, since it escapes out
> any single quotes they try to submit?
What if the SQL they inject doesn't have any quotes? Depending on how
you create your SQL statement, magic_quotes_gpc may have no effect.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
Justin Patrin wrote:
> On Wed, 7 Jul 2004 10:31:17 -0700, Brian Dunning <brian
briandunning.com> wrote:
>> The PHP directive magic_quotes_gpc is on by default, and it
>>essentially runs addslashes() on all GET, POST, and COOKIE data.
>>
>>Why doesn't this automatically prevent injections, since it escapes out
>>any single quotes they try to submit?
>
> magic_quotes_gpc *should* fix all SQL injection attacks that come
> straight from $_GET, $_POST, and $_COOKIE,
No, it'll simple escape quotes in strings that are passed into those
variables. If the injected SQL doesn't have any quotes and you're not
quoting it in your SQL statement, then there's no protection.
> The proper way to handle this is to turn
> off magic quotes and do whatever
> escaping your code needs *when it needs it*.
This is fine if you control every server you develop on, but most people
can't do that.
Write your own escaping function that detects the magic_quotes_gpc
setting and act accordingly. Pass flags for whether your escaping the
data for insertion into a database or for displaying in HTML. Turn off
magic_quotes_runtime within your script, too.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
Matthew Sims wrote:
> I think a good programming habit it to treat it as if it were off.
With regards to magic_quotes_gpc, you can't just "treat it as if it were
off" otherwise you may end up escaping data twice if it's not really off
on a server that runs your code. Detect it's value with
get_magic_quotes_gpc() and act accordingly.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
On Thursday 08 July 2004 00:05, Keith Greene wrote:
Here's a simple (and probably quite common) example of how not checking user
input will lead to disaster:
DELETE FROM users WHERE userid = $userid
userid is an integer column. If you didn't check your inputs and someone
injected
$userid = '1 or 1'
you would have toasted your users table.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Klein bottle for rent -- inquire within.
*/
attached mail follows:
I have been working on this all day, and am not getting this to work. I
am creating an application where a user would authenticate against
Active Directory. Yesterday I was able to get PHP to connect to the AD
server and display entries using this script.
<?
// PHP script to connect to the Active Directory Server a return a
result
// used for testing Active Directory connections.
$dn = "OU=Staff,OU=LCDC,OU=Anoka-Hennepin,DC=ah,DC=isd11";
$attributes = array("displayName", "department");
$filter = "(cn=*)";
$ad = ldap_connect("ldap://myadserver")
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
$bd = ldap_bind($ad, "CN=Tuller\,
Mike,OU=Staff,OU=LCDC,OU=Anoka-Hennepin,DC=ah,DC=isd11","password")
or die("Couldn't bind to AD!");
$result = ldap_search($ad, $dn, $filter, $attributes);
$entries = ldap_get_entries($ad, $result);
for ($i=0; $i<$entries["count"]; $i++)
{
echo $entries[$i]["displayname"]
[0].", ".$entries[$i]["department"][0]."<br />";
}
ldap_unbind($ad);
?>
Everything lists correctly. I looked on the web, and in the mailing
lists, and between the two have come up with this script to
authenticate. I have a web page with forms to enter the username and
password.
<?
$dn = 'OU=Staff,OU=LCDC,OU=Anoka-Hennepin,DC=ah,DC=isd11';
function ldap_authenticate()
{
$username = $_POST['username'];
$password = $_POST['password'];
if ($username != "" && $password != "")
{
if (! ($ad = ldap_connect("172.22.1.20")))
{
die("Could not connect to LDAP server!");
}
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
if (! ldap_bind( $ad, "CN=Tuller\,
Mike,OU=Staff,OU=LCDC,OU=Anoka-Hennepin,DC=ah,DC=isd11", $password))
{
die("Unable to bind to server!");
}
if (! ($r = ldap_search( $ad, $dn, 'cn=' . $username)))
{
die("Nothing Found!");
}
if ($r)
{
$result = ldap_get_entries( $ad, $r);
if ($result[0])
{
if (ldap_bind( $ds, $result[0][$dn], $password) )
{
return $result[0];
}
}
}
}
}
if (($result = ldap_authenticate()) == NULL) {
echo('Authorization Failed');
exit(0);
}
echo('Authorization success');
print_r($result);
?>
When I run everything though, I get this error:
Warning: ldap_search(): Search: No such object in
/Library/Apache2/htdocs/ldap/auth.php on line 23
Nothing Found!
I have looked at this for too long, and now am to the point where I am
out of ideas. Could someone look at this and see if they can figure out
what I am doing wrong here?
Thanks,
Mike Tuller
attached mail follows:
Hi,
Can someone tell me why
echo '$_SERVER[HTTP_REFERER] = '.$_SERVER[HTTP_REFERER].'<br>';
Produces
$_SERVER[HTTP_REFERER] =
Is this a problem with my server configuration, if so is there a SERVER
variable I can use instead?
Many thanks
attached mail follows:
Shaun wrote:
> Hi,
>
> Can someone tell me why
>
> echo '$_SERVER[HTTP_REFERER] = '.$_SERVER[HTTP_REFERER].'<br>';
>
> Produces
>
> $_SERVER[HTTP_REFERER] =
>
> Is this a problem with my server configuration, if so is there a SERVER
> variable I can use instead?
>
> Many thanks
>
My guess is you didn't come to the page with that code on it from
another page (ie a link of some kind), and if you did, the referer
wasn't set by your browser.
--
John C. Nichel
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
On Wed, 7 Jul 2004 22:43:11 +0100, Shaun <shaunthornburgh
hotmail.com> wrote:
> Hi,
>
> Can someone tell me why
>
> echo '$_SERVER[HTTP_REFERER] = '.$_SERVER[HTTP_REFERER].'<br>';
>
> Produces
>
> $_SERVER[HTTP_REFERER] =
>
> Is this a problem with my server configuration, if so is there a SERVER
> variable I can use instead?
>
If you didn't get to the page by clicking on a link, then you won't
have a referer. Also, you should use quotes around array keys:
$_SERVER['HTTP_REFERER']
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
attached mail follows:
On Wednesday 07 July 2004 05:43 pm, Shaun wrote:
> Hi,
>
> Can someone tell me why
>
> echo '$_SERVER[HTTP_REFERER] = '.$_SERVER[HTTP_REFERER].'<br>';
>
> Produces
>
> $_SERVER[HTTP_REFERER] =
>
> Is this a problem with my server configuration, if so is there a SERVER
> variable I can use instead?
>
It could be the server. I never fully investigated this, but IIS 5/5.1
doesn't report an HTTP REFERER....
The last time I checked this out, was on w2k/iis5 and winxp/iis5.1 (pre sp1)
maybe over a year ago.
Could someone verify/deny this, so I know that Im not crazy ;)....
attached mail follows:
Hello,
I got an error message when trying following script:
<?
//......
if (!$handle = fsockopen ("ssl://my.com", 443, $errno, $errstr,
$timeout = 30)) {
print "$errno: $errstr\n";
return -1; /* connection failed */
}
/* The my.com site WAS installed with a SSL certificate, and
it works perfect if access from a browser with 'https://' prefix. */
//......
?>
The errstr said "25: Inappropriate ioctl for device".
I'm using PHP 4.3.0. Its phpinfo indicates that OpenSSL is
enabled.
However, I also tested the script on a server with php 4.3.2
and it works perfect. Both PHPs are OpenSSL enabled but
why behaved differently?
Thanks in advance!
Alex Shi
--
Regards,
Alex Shi
Stonix.com Inc.
Phone: 416-422-4466
Cell: 416-827-3685
Email: chpshi
stonix.com
attached mail follows:
I would like to have images displayed automatically using PHP with a
Database and/or an array of images. Is there any sample code available
for doing that?
Can that be done with Flash and PHP?
Todd
attached mail follows:
Search google for javascript slideshow script. Javascript slideshow need
an array of image names, this can be done by php and mysql when dynamically
generate the page.
Alex Shi
> I would like to have images displayed automatically using PHP with a
> Database and/or an array of images. Is there any sample code available
> for doing that?
>
> Can that be done with Flash and PHP?
>
> Todd
attached mail follows:
Hey everyone...
I was curious if anyone out there has some pros and cons to storing a
website template that is extracted from a mysql db and stored in a
session... is this an efficient way to do it?
also... does anyone know what the size limitations for a session would
be?
Thanks,
Joe
attached mail follows:
Joe Harman wrote:
> I was curious if anyone out there has some pros and cons to storing a
> website template that is extracted from a mysql db and stored in a
> session... is this an efficient way to do it?
>
> also... does anyone know what the size limitations for a session would
> be?
There's no practical limit on the size of sessions, but they are not the
place for template files. Neither are databases. Use the file system for
files ;) and include() or fopen() the templates, etc. Use Smarty or a
similar system if you want caching.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
Hi,
How can I get remote IP adress of client?
I use the fillow script::
$ip=getenv('HTTP_X_FORWARDED_FOR');
if (!$ip)
{
$ip = getenv('REMOTE_ADDR');
}
But sometime it return me "unknown" sa IP adress.
Can someone help me ?
Thanks in advance!
attached mail follows:
> Hi,
> How can I get remote IP adress of client?
> I use the fillow script::
>
> $ip=getenv('HTTP_X_FORWARDED_FOR');
> if (!$ip)
> {
> $ip = getenv('REMOTE_ADDR');
> }
>
>
> But sometime it return me "unknown" sa IP adress.
>
> Can someone help me ?
>
> Thanks in advance!
$_SERVER["REMOTE_ADDR"]
--Matthew Sims
--<http://killermookie.org>
attached mail follows:
Matthew Sims wrote:
>>Hi,
>>How can I get remote IP adress of client?
>>I use the fillow script::
>>
>>$ip=getenv('HTTP_X_FORWARDED_FOR');
>>if (!$ip)
>>{
>>$ip = getenv('REMOTE_ADDR');
>>}
>>
>>
>>But sometime it return me "unknown" sa IP adress.
>>
>>Can someone help me ?
>>
>>Thanks in advance!
>
>
> $_SERVER["REMOTE_ADDR"]
Either method will work. You just have to realize that sometimes the IP
address is not sent. There is no reliable way to get the clients IP
address, so do not depend on it.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
IP adress not send ?!? And how server communicate with client ?
"John W. Holmes" <holmes072000
charter.net> wrote in message
news:40EC8056.7050704
charter.net...
> Matthew Sims wrote:
>
> >>Hi,
> >>How can I get remote IP adress of client?
> >>I use the fillow script::
> >>
> >>$ip=getenv('HTTP_X_FORWARDED_FOR');
> >>if (!$ip)
> >>{
> >>$ip = getenv('REMOTE_ADDR');
> >>}
> >>
> >>
> >>But sometime it return me "unknown" sa IP adress.
> >>
> >>Can someone help me ?
> >>
> >>Thanks in advance!
> >
> >
> > $_SERVER["REMOTE_ADDR"]
>
> Either method will work. You just have to realize that sometimes the IP
> address is not sent. There is no reliable way to get the clients IP
> address, so do not depend on it.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
Rosen wrote:
> IP adress not send ?!? And how server communicate with client ?
A variety of ways. What I meant is that it's not sent in the browser's
headers that it sends to the site, which is where getenv() and
$_SERVER[] would snatch it from.
Do not rely on IP addresses. Trust me.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
:)
Ok - then how linux server communicate with client - the server must have IP
adress to whitch to send data.....
"John W. Holmes" <holmes072000
charter.net> wrote in message
news:40EC830A.3020009
charter.net...
> Rosen wrote:
>
> > IP adress not send ?!? And how server communicate with client ?
>
> A variety of ways. What I meant is that it's not sent in the browser's
> headers that it sends to the site, which is where getenv() and
> $_SERVER[] would snatch it from.
>
> Do not rely on IP addresses. Trust me.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
I've used this function before a couple of times, but I haven't tested
it fully. Give it a go if you want.
/*** BEGIN CODE ***/
// Function get_ip
function get_ip()
{
// List of possible ip sources, in order of priority
$ip_sources = array
(
"HTTP_X_FORWARDED_FOR",
"HTTP_X_FORWARDED",
"HTTP_FORWARDED_FOR",
"HTTP_FORWARDED",
"HTTP_X_COMING_FROM",
"HTTP_COMING_FROM",
"REMOTE_ADDR",
);
foreach ($ip_sources as $ip_source)
{
// If the ip source exists, capture it
if (isset($_SERVER[$ip_source]))
{
// Beware of semicolon seperated lists
$possible_ips = explode(";", $_SERVER[$ip_source]);
// Always take just the first
$proxy_ip = $possible_ips[0];
break;
}
}
// If the ip is still not found, try the getenv() function without
error reporting (may give false)
$proxy_ip = (isset($proxy_ip)) ? $proxy_ip :
getenv("REMOTE_ADDR");
return $proxy_ip;
}
/*** END CODE ***/
On Thu, 8 Jul 2004 02:17:00 +0300, Rosen <rosen
pernikinfo.com> wrote:
> :)
> Ok - then how linux server communicate with client - the server must have IP
> adress to whitch to send data.....
>
> "John W. Holmes" <holmes072000
charter.net> wrote in message
> news:40EC830A.3020009
charter.net...
>
>
> > Rosen wrote:
> >
> > > IP adress not send ?!? And how server communicate with client ?
> >
> > A variety of ways. What I meant is that it's not sent in the browser's
> > headers that it sends to the site, which is where getenv() and
> > $_SERVER[] would snatch it from.
> >
> > Do not rely on IP addresses. Trust me.
> >
> > --
> > ---John Holmes...
> >
> > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> >
> > php|architect: The Magazine for PHP Professionals – www.phparch.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Rosen wrote:
> IP adress not send ?!? And how server communicate with client ?
[snip]
The httpd server might know the remote IP address, but that doesn't
mean that it has to tell PHP about it. The SAPI module may or may not
set the value, for instance.
Even if you could rely on the IP address, in many cases it will not
do quite what you want. For instance, if you try to organize users
by IP address, you'll find that many users can appear to have the same
IP address, such as when they're behind a firewall or using a workstation
on an internal LAN--they may all appear to be coming from the same address.
Hope this helps clear it up,
Torben
>>>$_SERVER["REMOTE_ADDR"]
>>
>>Either method will work. You just have to realize that sometimes the IP
>>address is not sent. There is no reliable way to get the clients IP
>>address, so do not depend on it.
>>
>>--
>>---John Holmes...
>>
>>Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>>
>>php|architect: The Magazine for PHP Professionals – www.phparch.com
--
Torben Wilson <torben
php.net>
attached mail follows:
Rosen wrote:
> IP adress not send ?!? And how server communicate with client ?
[snip]
The httpd server might know the remote IP address, but that doesn't
mean that it has to tell PHP about it. The SAPI module may or may not
set the value, for instance.
Even if you could rely on the IP address, in many cases it will not
do quite what you want. For instance, if you try to organize users
by IP address, you'll find that many users can appear to have the same
IP address, such as when they're behind a firewall or using a workstation
on an internal LAN--they may all appear to be coming from the same address.
Hope this helps clear it up,
Torben
>>>$_SERVER["REMOTE_ADDR"]
>>
>>Either method will work. You just have to realize that sometimes the IP
>>address is not sent. There is no reliable way to get the clients IP
>>address, so do not depend on it.
>>
>>--
>>---John Holmes...
>>
>>Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>>
>>php|architect: The Magazine for PHP Professionals – www.phparch.com
--
Torben Wilson <torben
php.net>
attached mail follows:
Thanks,
This for the users, thath come from one IP adress - I know about it, but,
Can I get just adress of the IP, with which the server communicates ?
"Lars Torben Wilson" <torben
php.net> wrote in message
news:40EC86E9.3070205
php.net...
> Rosen wrote:
>
> > IP adress not send ?!? And how server communicate with client ?
>
> [snip]
>
> The httpd server might know the remote IP address, but that doesn't
> mean that it has to tell PHP about it. The SAPI module may or may not
> set the value, for instance.
>
> Even if you could rely on the IP address, in many cases it will not
> do quite what you want. For instance, if you try to organize users
> by IP address, you'll find that many users can appear to have the same
> IP address, such as when they're behind a firewall or using a workstation
> on an internal LAN--they may all appear to be coming from the same
address.
>
>
> Hope this helps clear it up,
>
> Torben
>
> >>>$_SERVER["REMOTE_ADDR"]
> >>
> >>Either method will work. You just have to realize that sometimes the IP
> >>address is not sent. There is no reliable way to get the clients IP
> >>address, so do not depend on it.
> >>
> >>--
> >>---John Holmes...
> >>
> >>Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> >>
> >>php|architect: The Magazine for PHP Professionals – www.phparch.com
>
> --
> Torben Wilson <torben
php.net>
attached mail follows:
Rosen wrote:
> Can I get just adress of the IP, with which the server communicates ?
If you don't see the IP address somewhere in the $_SERVER variable, then NO.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
Ok,
I don't understand why IP adress will bi "invisible" for $_SERVER variable.
"John W. Holmes" <holmes072000
charter.net> wrote in message
news:40EC8965.9030102
charter.net...
> Rosen wrote:
>
> > Can I get just adress of the IP, with which the server communicates ?
>
> If you don't see the IP address somewhere in the $_SERVER variable, then
NO.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
John W. Holmes wrote:
>> IP adress not send ?!? And how server communicate with client ?
>
> A variety of ways. What I meant is that it's not sent in the browser's
> headers that it sends to the site, which is where getenv() and
> $_SERVER[] would snatch it from.
Correct me if I'm wrong, but shouldn't $_SERVER['REMOTE_ADDR'] always be set
if you're using Apache? I've never experienced a case where it was not
available. I'm no C guru, but from what I can tell by looking into the
source for PHP 4.3.7 and Apache 1.3.28 it looks like Apache makes this
variable available to PHP based on the information it stores internally
about the currently-open connection to the client (see Apache's
"src/main/util_script.c", line 292). Have you experienced a case with
Apache & PHP where this variable was not available? Just curious...
attached mail follows:
On Thursday 08 July 2004 07:17, Rosen wrote:
>
> Ok - then how linux server communicate with client - the server must have
> IP adress to whitch to send data.....
Look some form of IP *will* be set and *will* be available in $_SERVER. What
you was using in your original post has been deprecated and thus may have
mislead you into thinking that no IP was set. Use the info in $_SERVER and if
you come across a situation where the IP is not set then file a bug.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Stupidity is its own reward.
*/
attached mail follows:
Rosen wrote:
> Ok,
> I don't understand why IP adress will bi "invisible" for $_SERVER variable.
It should be there, but mostly because the CGI 1.1 spec requires that it
be provided to the script. There is no physical requirement for it to be
there.
Reasons for it not being present could include:
o Incomplete SAPI code;
o A bug in the httpd or SAPI module,
o etc...
Even if it is there, it's entirely possible that it's just the IP address
of a proxy--or even some other IP address entirely; it's not hard to spoof.
Of course, all of this only applies when running as a CGI or module for
handling web requests. No $_SERVER['REMOTE_ADDR'] will be set when running
on the command line.
Torben
> "John W. Holmes" <holmes072000
charter.net> wrote in message
> news:40EC8965.9030102
charter.net...
>
>>Rosen wrote:
>>
>>
>>>Can I get just adress of the IP, with which the server communicates ?
>>
>>If you don't see the IP address somewhere in the $_SERVER variable, then
>
> NO.
>
>>--
>>---John Holmes...
>>
>>Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>>
>>php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
Rosen wrote:
> Ok,
> I don't understand why IP adress will bi "invisible" for $_SERVER variable.
It should be there, but mostly because the CGI 1.1 spec requires that it
be provided to the script. There is no physical requirement for it to be
there.
Reasons for it not being present could include:
o Incomplete SAPI code;
o A bug in the httpd or SAPI module,
o etc...
Even if it is there, it's entirely possible that it's just the IP address
of a proxy--or even some other IP address entirely; it's not hard to spoof.
Of course, all of this only applies when running as a CGI or module for
handling web requests. No $_SERVER['REMOTE_ADDR'] will be set when running
on the command line.
Torben
> "John W. Holmes" <holmes072000
charter.net> wrote in message
> news:40EC8965.9030102
charter.net...
>
>>Rosen wrote:
>>
>>
>>>Can I get just adress of the IP, with which the server communicates ?
>>
>>If you don't see the IP address somewhere in the $_SERVER variable, then
>
> NO.
>
>>--
>>---John Holmes...
>>
>>Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>>
>>php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
I'm trying to send some binary data to a UDP server using PHP. The examples
I've been able to find show sending binary data over TCP, or they show
sending text over UDP.
I'm constructing the messages using the below:
$text_msg = "Hello, World\r\n";
$binary_msg = chr(0x01).chr(0x02).chr(0x00).chr(0xAD);
$binary_msg_size = 4;
I've tried a couple methods of sending the data:
$fp = fsockopen("udp://" . $host,$port,....);
fwrite($fp,$binary_msg,$binary_msg_size);
and
$sock = socket_create(AF_INET,SOCK_DGRAM,SOL_UDP);
socket_sendto($sock,$binary_msg,$binary_msg_size,0,$host,$port);
In either case, a UDP packet is sent, but with a zero data size. If I
instead send the $text_msg, it works as expected. For some reason sending
the binary data doesn't work.
Does anyone have insight into how to send binary data over UDP using PHP?
attached mail follows:
I use the following without problem:
$fp = fsockopen("udp://www.server.com", 24250, &$errno, &$errstr, .2);
if (!$fp) {
$status = "Server not available";
} else {
$trigger =
chr(hexdec('FF')).chr(hexdec('FF')).chr(hexdec('01')).chr(hexdec('00'));
fwrite($fp,$trigger); # Send trigger to the
status server
$junk = fread($fp, 4); # discard echoed command
from status server
}
Keith
At 04:23 PM 7/7/2004, coder_1024 wrote:
>I'm trying to send some binary data to a UDP server using PHP. The examples
>I've been able to find show sending binary data over TCP, or they show
>sending text over UDP.
>
>I'm constructing the messages using the below:
>
> $text_msg = "Hello, World\r\n";
> $binary_msg = chr(0x01).chr(0x02).chr(0x00).chr(0xAD);
> $binary_msg_size = 4;
>
>I've tried a couple methods of sending the data:
>
> $fp = fsockopen("udp://" . $host,$port,....);
> fwrite($fp,$binary_msg,$binary_msg_size);
>
>and
>
> $sock = socket_create(AF_INET,SOCK_DGRAM,SOL_UDP);
> socket_sendto($sock,$binary_msg,$binary_msg_size,0,$host,$port);
>
>In either case, a UDP packet is sent, but with a zero data size. If I
>instead send the $text_msg, it works as expected. For some reason sending
>the binary data doesn't work.
>
>Does anyone have insight into how to send binary data over UDP using PHP?
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Thanks for the feedback. As it turns out, the reason I was getting zero
data bytes in my UDP packet was that I had declared the packet variable
outside the function in which I was using it.
$packet = chr(0x01).chr(0x1d).... etc
function doSomething($x)
{
// using $packet in here gives you an empty variable.
}
So I guess it was a very basic PHP language thing I was running into. Guess
I've done too much Perl and assumed the variables were accessible in the
function. :-)
"Keith Greene" <hitek
cox.net> wrote in message
news:6.1.1.1.0.20040707170321.01dda740
pop.west.cox.net...
> I use the following without problem:
>
> $fp = fsockopen("udp://www.server.com", 24250, &$errno, &$errstr,
.2);
> if (!$fp) {
> $status = "Server not available";
> } else {
> $trigger =
> chr(hexdec('FF')).chr(hexdec('FF')).chr(hexdec('01')).chr(hexdec('00'));
> fwrite($fp,$trigger); # Send trigger to the
> status server
> $junk = fread($fp, 4); # discard echoed command
> from status server
> }
>
> Keith
>
> At 04:23 PM 7/7/2004, coder_1024 wrote:
> >I'm trying to send some binary data to a UDP server using PHP. The
examples
> >I've been able to find show sending binary data over TCP, or they show
> >sending text over UDP.
> >
> >I'm constructing the messages using the below:
> >
> > $text_msg = "Hello, World\r\n";
> > $binary_msg = chr(0x01).chr(0x02).chr(0x00).chr(0xAD);
> > $binary_msg_size = 4;
> >
> >I've tried a couple methods of sending the data:
> >
> > $fp = fsockopen("udp://" . $host,$port,....);
> > fwrite($fp,$binary_msg,$binary_msg_size);
> >
> >and
> >
> > $sock = socket_create(AF_INET,SOCK_DGRAM,SOL_UDP);
> > socket_sendto($sock,$binary_msg,$binary_msg_size,0,$host,$port);
> >
> >In either case, a UDP packet is sent, but with a zero data size. If I
> >instead send the $text_msg, it works as expected. For some reason
sending
> >the binary data doesn't work.
> >
> >Does anyone have insight into how to send binary data over UDP using PHP?
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi,
Thursday, July 8, 2004, 3:38:41 AM, you wrote:
AN> Hmm ... this still echos 0 and not 1. I am using 4.3.7 with all
AN> warnings on.
AN> Does anyone know how to use this function or anything similiar with
AN> passing by refernce. Since the call-time pass by reference is
AN> deprecated, this practice is no longer valid, but there must be a work
AN> around?
AN> Thanks for any assistance
AN> Andrew
Strange as it works for me (http://fred.kwikin.com/user.php) with this
code exactly:
<?php
function fun($arg) {
$arg++;
}
$var = 0;
echo "Before:$var<br>";
call_user_func_array("fun", array(&$var));
echo "After:$var<br>";
?>
What version of PHP are you using?
--
regards,
Tom
attached mail follows:
* Thus wrote Andrew Nagy:
> Curt Zirzow wrote:
>
> >* Thus wrote Andrew Nagy:
> >
> >>How do you use the call_user_func function with call-time
> >>pass-by-reference deprecation?
> >>
> >>For example:
> >>
> >>function fun(&$arg) {
> >> $arg++;
> >>}
>
> ...
>
> >$func_call = 'fun';
> >$func_call($var);
> >
>
> This does not do what I need. I need to be able to call a dynamic
> function name and pass in the parameters with the &. The problem is
> this syntax is now deprecated.
Did you even try it!
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
attached mail follows:
In the below code the variable $thecomments might have some quotations in
it. Like:
$thecomments = how you "like me now"
I'm trying to display the value of that variable in an input box using the
value=" " as shown below; however, the double quotations are screwing me up.
Can someone please make some suggestions on how I can fix this. I've tries
several combinations.addslashes, value= (no quotations, etc). Thanks.
$thecomments = addslashes($row_allitems[6]);
// echo $thecomments;
// this is the section to list the instructions
comments
echo
"<tr>
<td colspan=\"2\" > <div
align=\"right\">Instructions/comments:</div></td>
<td colspan=\"3\"> <div align=\"left\">
<input
name=\"instructionslist[$row_allitems[0]]\" type=\"text\" size=\"50\"
maxlength=\"255\" value=$thecomments></td>
</div></td>
</tr>";
attached mail follows:
You want htmlentities(), not addslashes().
On Wed, 7 Jul 2004 20:35:54 -0400, Ryan Schefke <ryan
triomfgroup.com> wrote:
> In the below code the variable $thecomments might have some quotations in
> it. Like:
>
> $thecomments = how you "like me now"
>
> I'm trying to display the value of that variable in an input box using the
> value=" " as shown below; however, the double quotations are screwing me up.
> Can someone please make some suggestions on how I can fix this. I've tries
> several combinations.addslashes, value= (no quotations, etc). Thanks.
>
> $thecomments = addslashes($row_allitems[6]);
>
> // echo $thecomments;
>
> // this is the section to list the instructions
> comments
>
> echo
>
> "<tr>
>
> <td colspan=\"2\" > <div
> align=\"right\">Instructions/comments:</div></td>
>
> <td colspan=\"3\"> <div align=\"left\">
>
> <input
> name=\"instructionslist[$row_allitems[0]]\" type=\"text\" size=\"50\"
> maxlength=\"255\" value=$thecomments></td>
>
> </div></td>
>
> </tr>";
>
> !DSPAM:40ec94f2143861361910547!
>
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
attached mail follows:
Ryan Schefke wrote:
> I'm trying to display the value of that variable in an input box
Seriously, how many times can this question be asked in a week?
You just need to run htmlentities() or htmlspecialchars() on the data
before you place it in the <input> element.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
* Thus wrote Russell Curtis:
> I'm trying to use the split function to identify the extension of an
> uploaded file:
>
> $file_name = $_FILES['userfile']['name'];
> $pieces = explode(".", $file_name);
> $file_extension = $pieces[1]; // piece2
You could always use the built in php function pathinfo()
http://php.net/pathinfo
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
attached mail follows:
Hello List,
I'm trying to get the following code to work :
<?
$dn = array("countryName" => "US",
"stateOrProvinceName" => "state",
"localityName" => "town",
"organizationName" => "foo",
"organizationalUnitName" => "foo",
"commonName" => "www.domain.com",
"emailAddress" => "user
domain.com");
$privkey = openssl_pkey_new(array("config" => "/usr/share/ssl/openssl.cnf"));
// Generate a certificate signing request
$csr = openssl_csr_new($dn, $privkey);
// You will usually want to create a self-signed certificate at this
// point until your CA fulfills your request.
// This creates a self-signed cert that is valid for 365 days
$sscert = openssl_csr_sign($csr, null, $privkey, 365);
// Show any errors that occurred here
while (($e = openssl_error_string()) !== false) {
echo $e . "<br>\n";
}
openssl_csr_export($csr, $csrout);
openssl_pkey_export($privkey, $pkeyout, "");
openssl_x509_export($sscert, $crtout);
$match = openssl_x509_check_private_key($crtout, $pkeyout);
if ($match) {
echo "<p>Yes, these match</p>";
}
else {
echo "<pre>Error: crt and key do not match</pre>";
}
exit();
?>
The code is mainly from the php manual pages and notes.
It appears to correctly generate a key, csr and crt. However when I try to verify
them with:
openssl_x509_check_private_key()
I get a mismatch. Any ideas?
There are some errors generated on the csr creation but when I echo the text of the .crt and .key
they appear to be valid so I'm not too sure what is going on?
Is anyone aware of where I can find some code similiar to this that works (create csr and key on
demand). Thanks in advance!
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
attached mail follows:
int imagepng ( resource image [, string filename])
On Tue, 6 Jul 2004 13:48:44 +0200
Victor Spång Arthursson <scooterbabe
home.se> wrote:
> Hi!
>
> Creating a transparent png using GD and PHP is (almost) no problem, but
> it's impossible to save…
>
> No matter what I try, the saved image wont remember that it's
> transparent. I suspect the reason it works "on the fly" is because I
> manually set the header to image/png, but if I try so save the stream
> to a file, the transparency disappears…
>
> Please please please somebody help!
>
> Sincerely
>
> Victor
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
------------------------------------------------------------------------
Comment: English is not my first language.
Wudi <wudicgi
seoul.com>
attached mail follows:
=======================================
Please feel free to add more points and send
to the list.
=======================================
1. If you have any queries/problems about PHP
try http://www.php.net/manual/en first. You
can download a copy and use it offline also.
Please also try
http://www.php.net/manual/faq.php
for answers to frequently answered questions
about PHP (added by Christophe Chisogne).
2. Try http://www.google.com next. Searching
for "php YOUR QUERY" may fetch you relevant
information within the first 10 results.
3. There is a searchable archive of the
mailing list discussion at
http://phparch.com/mailinglists. Many of the
common topics are discussed repeatedly, and
you may get answer to your query from the
earlier discussions.
For example: One of the repeatedly discussed
question in the list is "Best PHP editor".
Everyone has his/her favourite editor.
You can get all the opinions by going through
the list archives. If you want a chosen list
try this link :
http://www.thelinuxconsultancy.co.uk/phpeditors/
(contributed by Christophe Chisogne).
4. Not sure if PHP is working or you want
find out what extensions are available to
you?
Just put the following code into a file with
a .php extension and access it through your
webserver:
<?php
phpinfo();
?>
If PHP is installed you will see a page with
a lot of information on it. If PHP is not
installed (or not working correctly) your
browser will try to download the file.
(contributed by Teren and reworded by Chris W
Parker)
5. If you are stuck with a script and do not
understand what is wrong, instead of posting
the whole script, try doing some research
yourself. One useful trick is to print
the variable/sql query using print or echo
command and check whether you get what you
expected.
After diagnosing the problem, send the
details of your efforts (following steps 1,
2 & 3) and ask for help.
6. PHP is a server side scripting language.
Whatever processing PHP does takes place
BEFORE the output reaches the client.
Therefore, it is not possible to access
users' computer related information (OS,
screen size etc) using PHP. Nor can you
modify any the user side settings. You need
to go for JavaScript and ask the question in
a JavaScript list.
On the other hand, you can access the
information that is SENT by the user's
browser when a client requests a page from
your server. You can find details about
browser, OS etc as reported by
this request. - contributed by Wouter van
Vliet and reworded by Chris W Parker.
7. Provide a clear descriptive subject line.
Avoid general subjects like "Help!!", "A
Question" etc. Especially avoid blank
subjects.
8. When you want to start a new topic, open a
new mail composer and enter the mailing list
address php-general
lists.php.net instead of
replying to an existing thread and replacing
the subject and body with your message.
9. It's always a good idea to post back to
the list once you've solved your problem.
People usually add [SOLVED] to the subject
line of their email when posting solutions.
By posting your solution you're helping the
next person with the same question.
[contribued by Chris W Parker]
10. Ask smart questions
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)
11. Do not send your email to the list with
attachments. If you don't have a place to
upload your code, try the many pastebin
websites (such as www.pastebin.com).
[contributed by Burhan Khalid]
--
Integrated Management Tools for leather
industry
----------------------------------
http://www.leatherlink.net
Ma Siva Kumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]