php-windows Digest 21 Sep 2001 20:22:03 -0000 Issue 766 Topics (messages 9447 through 9457): some variable errors 9447 by: Burak Delice Re: to use PHP as a module in Apache? 9448 by: Ross Fleming Re: How can I retreive a users Windows logon name? 9449 by: Christian Sandfeld php_mcrypt.dll 9450 by: Hugo Alexandre Almeida Soares Dias please send your reply messages to PHP forum 9451 by: Burak Delice Installation Problem 9452 by: karthikeyan Re: also... a real time clock (no forms) 9453 by: Mike Flynn Warning: not a valid MySQL result resource 9454 by: Andrew.Martin Com Help 9455 by: Andy IP Address 9456 by: Craig Morrison 9457 by: Glenn Pickett 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] ----------------------------------------------------------------------
(win2000 professional, IIS 5 and PHP 4) I installed PHP on IIS 5 and run a php script on my local machine. It gave some errors below: -Warning: Undefined variable: QUERY_STRING in C:\Abt_deneme\mailit.php on line 103 -Warning: Undefined offset: 1 in C:\Abt_deneme\mailit.php on line 116 -Warning: Undefined index: host in C:\Abt_deneme\mailit.php on line 171 You can not execute this script standalone, please submit a form from a valid referrer shold I install Apache because of some variables like $QUERY_STRING? /////////////////////////////// mailit.php (Script © Yowen.com) ////////////////////////////// <?php $referers = array( "www.abt.com.tr", ); /* Do you want the script to log all emails? */ $log = "no"; /* yes or no - case sensetive */ /* please set the location of the file to be added to */ $logfile = "mailit.log"; file://do not edit anything below this line function savetofile($file_name,$file_contents,$mode) { if ($mode=="at"||$mode=="ab") { $file_opener = fopen($file_name, "r"); $file_read = fread($file_opener, filesize($file_name)); } $file_pointer = fopen($file_name, "w"); if ($mode=="at") { fwrite($file_pointer,$file_contents . $file_read); } if ($mode=="ab") { fwrite($file_pointer,$file_read . $file_contents); } if ($mode=="r") { fwrite($file_pointer,$file_contents); } fclose($file_pointer); } file://date $today = getdate(); $month = $today['month']; $mday = $today['mday']; $year = $today['year']; $date = "$month $mday, $year"; $recipient = "[EMAIL PROTECTED]"; if ($recipient==""||!isset($recipient)) { die("You must specify an email to send the form to."); } $ip = getenv("REMOTE_ADDR"); $userinput = "IP: " . $ip ."\n"; $queries = explode("&",$QUERY_STRING); if (isset($required)) { $validate = explode(",",$required); } for ($i=0;isset($queries[$i]);$i++) { $query = explode("=",$queries[$i]); if (isset($required)) { for ($c=0;isset($validate[$c]);$c++) { if ($validate[$c]==$query[0]&&$query[1]=="") { die("Please go back and fill in all required form fields."); } } } $userinput .= "" . $query[0] . ": " . $query[1] . "\n"; } file://you must keep the powered by mailit signature to use this script $userinput .= "\n----------------------\nPowered by Mailit - http://www.yowen.com/?p=mailit"; $userinput = str_replace("+"," ",$userinput); $userinput = str_replace("%7E","~",$userinput); $userinput = str_replace("%7e","~",$userinput); $userinput = str_replace("%60","`",$userinput); $userinput = str_replace("%21","!",$userinput); $userinput = str_replace("%23","#",$userinput); $userinput = str_replace("%24","\$",$userinput); $userinput = str_replace("%25","%",$userinput); $userinput = str_replace("%5E","^",$userinput); $userinput = str_replace("%5e","^",$userinput); $userinput = str_replace("%26","&",$userinput); $userinput = str_replace("%28","(",$userinput); $userinput = str_replace("%29",")",$userinput); $userinput = str_replace("%2B","+",$userinput); $userinput = str_replace("%2b","+",$userinput); $userinput = str_replace("%3D","=",$userinput); $userinput = str_replace("%3d","=",$userinput); $userinput = str_replace("%5B","[",$userinput); $userinput = str_replace("%5b","[",$userinput); $userinput = str_replace("%5D","]",$userinput); $userinput = str_replace("%5d","]",$userinput); $userinput = str_replace("%7B","{",$userinput); $userinput = str_replace("%7b","{",$userinput); $userinput = str_replace("%7D","}",$userinput); $userinput = str_replace("%7d","}",$userinput); $userinput = str_replace("%5C","\\",$userinput); $userinput = str_replace("%5c","\\",$userinput); $userinput = str_replace("%7C","|",$userinput); $userinput = str_replace("%7c","|",$userinput); $userinput = str_replace("%3B",";",$userinput); $userinput = str_replace("%3b",";",$userinput); $userinput = str_replace("%3A",":",$userinput); $userinput = str_replace("%3a",":",$userinput); $userinput = str_replace("%27","'",$userinput); $userinput = str_replace("%22","\"",$userinput); $userinput = str_replace("%2C",",",$userinput); $userinput = str_replace("%2c",",",$userinput); $userinput = str_replace("%3C","<",$userinput); $userinput = str_replace("%3c","<",$userinput); $userinput = str_replace("%3E",">",$userinput); $userinput = str_replace("%3e",">",$userinput); $userinput = str_replace("%2F","/",$userinput); $userinput = str_replace("%2f","/",$userinput); $userinput = str_replace("%3F","?",$userinput); $userinput = str_replace("%3f","?",$userinput); $userinput = str_replace("%0D","\n",$userinput); $userinput = str_replace("%0d","\n",$userinput); $userinput = str_replace("%20"," ",$userinput); file://start referrer check $ref = getenv('HTTP_REFERER'); $ref1=parse_url($ref); if ($ref1['host']=="") { die("You can not execute this script standalone, please submit a form from a valid referrer"); } for ($i=0;isset($referers[$i]);$i++) { if ($ref1['host']==$referers[$i]) { $continue = "true"; } } if ($continue!="true") { die("Mail failed, invalid referer.<br>If you are trying to use mailit then add '".$ref1['host']."' to the referers array."); } file://start emailing stage if(mail($recipient,$subject,$userinput,"From: ".$name." <".$email.">")) { file://logs email to log file: if ($log=="yes"&&is_writable($logfile)&&is_readable($logfile)) { $userinput1 = str_replace("\n","<br>",$userinput); savetofile($logfile,"¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯_¯ _¯_¯_¯_¯_¯_¯_¯_¯_¯_<br>Sent on " . $date . ":<br>" . $userinput1."<br>","at"); } file://send user to redirect url if set if (isset($redirect)) { header("Location: $redirect"); } if (!isset($redirect)) { echo "Message sent succesfully."; } } else { echo "An error has ocurred, please go back and try again."; } ?>
At least one problem I found when running PHP as a script in Apache is that not all of the functions are supported. For example, getallheaders() does not work unless you install PHP as an Apache module. There may be other reasons as well people? Ross -----Original Message----- From: Burak Delice [mailto:[EMAIL PROTECTED]] Sent: 21 September 2001 08:48 To: [EMAIL PROTECTED] Subject: [PHP-WIN] to use PHP as a module in Apache? hello, I was reading php setup's Install.txt. and I saw a advice in it: " If you would like to use PHP as a module in Apache, you should move php4ts.dll to the windows/system (for Windows 9x/Me) or winnt/system32 (for Windows NT/2000) directory, overwriting any older file. Then you should add the following two lines to you Apache conf file: LoadModule php4_module c:/php/sapi/php4apache.dll AddType application/x-httpd-php .php " why should Php used as "module" on apache server? which kind of advantages it has? -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Thanks for the info Frank, I appreciate it :) /Christian -----Original Message----- From: Frank M. Kromann [mailto:[EMAIL PROTECTED]] Sent: 18. september 2001 19:19 To: Christian Sandfeld Cc: '[EMAIL PROTECTED]'; 'Eric R. Gavin' Subject: Re: RE: [PHP-WIN] How can I retreive a users Windows logon name? Hi Christian, You can force NTLM to be activated by removing file access for the user IUSR_<computer name>. If you have both basic and NTLM access to the files and the user running the web service has read access to the files the basic method is used. If the user don't have access NTLM will kick in and you will be able to get the users login name. - Frank > Eric, > > Thanks for sharing. I too can not get the user name for pages where > anonymous access is allowed, but since it's on our intranet, that's ok (all > users are loged on to our NT domain). > > Regards, > > Christian > > -----Original Message----- > From: Eric R. Gavin [mailto:[EMAIL PROTECTED]] > Sent: 17. september 2001 22:50 > To: [EMAIL PROTECTED] > Subject: Re: [PHP-WIN] How can I retreive a users Windows logon name? > > > It's important to note that this only works for pages that require > authentication. > > I don't believe that there is a way to retrieve username information via > pages that are accessed anonymously (i.e. if you were trying to retrieve the > name of the anonymous web user.) > > I only say this because I tried to retrieve user name for debugging purposes > and couldn't do it. There are/were some POSIX functions/modules that > supposedly do this but I think I screwed something up trying to use them, > and needed to dl() the module or something like that, which I didn't do > because I'm the laziest person alive ^_^ > > > If you change the access control from Basic to NT LM for the Intranet web > site you will gain the following things: > > > [snip] > > > > 2) The users login name and auth method will be available in $AUTH_USER > and $AUTH_TYPE. > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi, i need the mcrypt DLL. Does anyone have it for php4.0.6? if so, please send it to me to [EMAIL PROTECTED] I need that lib, i already got one, but it stalls my browser even in a script as simple as: <?=phpinfo()?> Thank you Hugo Alexandre Dias Eng. Sistemas Informática [EMAIL PROTECTED]
hello PHP forum I sent a few message to this forum and messages came as e-mail for me (I think lot of message have been sent like this way). please send your talented advices to here. because a lot of message's reply is not found. thanks your helps and interests..
Hi folks, I want to know if anybody of u have successfully installed freetype and imagemagic in your systems(for windows). I have download the following files to my system. 1.freetype-2.0.4-src.zip, 2. freetype-2.0.4-doc.zip, 3.freetype-2.0.4-lib.zip, 4.freetype-2.0.4-bin.zip. 2.Imagemagic-nt.zip If yes i would like you detailed experience on how to proceed with it. I am working with php4.0.6. Waiting for your earliest reply, karthikeyan.
You can't have a dynamic clock on a webpage using a server-side script like PHP. That requires a client-side script or applet. What you can have PHP do is show the current time every time a page is reloaded. That's easy enough: Just use the date() function somewhere. And what the other guy that replied to you mentioned, using the meta tag to refresh the page every 60 seconds, that will simulate it but isn't guaranteed to work perfectly on all browsers. PHP is a server-side script and generates code before the user gets the page. It doesn't alter the page once the user has it, like Javascript does. -Mike At 03:16 PM 9/20/2001 +1200, you wrote: >hello again, >can someone please help me to make a realtime clock in PHP not using forms >only plain text that updates when the time changes, i.e. every minute etc... > >thank you again =) > > > >-- >PHP Windows Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -=- Mike Flynn - Burlington, VT -=- [EMAIL PROTECTED] http://www.mikeflynn.net/ * Give blood * ...maintaining lawns, watching televised sports, birthing children, listening to Top 40 music, and collecting stuffed animals...
I want to create an array of values from one table and for each result create a sub array from a lower table but I keep getting the following error not a valid MySQL result resource in I use the the following query. Isn't this possible? If not what should I use? Thanks. $query = "SELECT * FROM article WHERE category_id = $category_id"; $result = $db->query("$query") or die("Select Failed!"); $number = mysql_num_rows($result); echo "number of rows effected is $number<br>"; $counter=1; while ($row = mysql_fetch_array ($menu_result)) { $main_id[$counter] = $row[id]; $main_title[$counter] = $row[title]; echo "$main_title[$counter]"; echo "$main_id[$counter]"; $subquery = "SELECT * FROM sub_article WHERE article_id =$main_id[$counter] "; $subresult = $db->query("$subquery") or die("Select Failed!"); $z=1; while ($subrow = mysql_fetch_array ($subresult)) { $sub_id$z] = $subrow[id]; $sub_title[$z] = $subrow[title]; echo "$sub_title[$z]"; echo "$sub_id[$z]"; $z++; } $counter++; }
Hey, When i try to use COM, my machine just doesn't do anything, for example, you click a link to a php page that has the COM line in it, the browser stays still for a while, then just times out. Does anyone know what could be causin this? Please let me know asap please :) email is preffered. [EMAIL PROTECTED] thanks Andy Doyle
My apologies if this is a faq.. Will PHP allow me to get the remote IP of a connection? -- Craig Morrison MTS Professional @ http://www.mtsprofessional.com/ A Win32 Email server that works for _you_. EzMTS - A _free_ Win32 EMail Server http://www.ezmts.org/ Anonymous FTP at ftp://ftp.ezmts.org
Yes, look at REMOTE_ADDR in the manual. Glenn "Craig Morrison" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > My apologies if this is a faq.. > > Will PHP allow me to get the remote IP of a connection? >