php-windows Digest 24 Sep 2003 07:58:37 -0000 Issue 1925

Topics (messages 21531 through 21534):

Re: Problem with 2 buttons
        21531 by: William Cheung
        21532 by: Bobo Wieland

Re: Accessing Outlook via COM object
        21533 by: Sek-Mun Wong

Re: a Directory Crawler
        21534 by: Sven Schnitzke

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 use submit type, I don't need the 2 hidden lines. But as my boss wants
clickable images, the two lines somehow do the trick. If I took the 2 lines
away, the 2 images will not do anything if I click them. These codes are
done by a previous programmer and I don't know how she got that trick.

William Cheung B.Sc, MCSE, MCDBA

Databyte Corp.

-----Original Message-----
From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED] 
Sent: September 23, 2003 4:15 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] Problem with 2 buttons

What is the purpose of the HIDDEN elements?

On Mon, 2003-09-22 at 19:43, William Cheung wrote:
> I have 2 buttons sitting next to each other. One to update; the other
> to cancel. However, no matter which button I click, the
> isset($_POST["CHANGE"]) always returns true. My template code is list
> below. Could someone tell me what's wrong with my code?
> 
>  
> 
> <tr height=60>
> 
>        <td width="5%">&nbsp;</td>
> 
>        <td valign=bottom>
> 
>                    <input type="hidden" name="CHANGE">
> 
>                    <input type=image name=CHANGE
> src={#img_dir#}{#template#}page6grid_g3.gif
> onmouseover="this.src='{#img_dir#}{#template#}page6grid_g4.gif'"
> onmouseout="this.src='{#img_dir#}{#template#}page6grid_g3.gif'">
> 
>                    <font class=mpanel_mid_data style="font-weight:
> lighter;">Update order</font>
> 
>        </td>
> 
>        <td valign=bottom>
> 
>                    <input type="hidden" name="CANCEL">
> 
>                    <input type=image name="CANCEL"
> src={#img_dir#}{#template#}page6grid_g11.gif
> onmouseover="this.src='{#img_dir#}{#template#}page6grid_g12.gif'"
> onmouseout="this.src='{#img_dir#}{#template#}page6grid_g11.gif'">
> 
>                    <font class=mpanel_mid_data style="font-weight:
> lighter; text-indent: 0px;">Cancel order</font>
> 
>        </td>
> 
> </tr>
> 
>  
> 
> William Cheung B.Sc, MCSE, MCDBA
> 
> Databyte Corp. 
> 
> 
>  
> 
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
maybe you could do it like this:
change the name attribute of the buttons to something else (or leave them out all 
together)... add and onclick event and some javascript to set the values of the hidden 
fields...

something like this (simplified):

[CODE]
<script language='JavaScript'><!--
    function setChange(form) {
        form.change.value = true;
    }
//--></script>

<form name='theForm'>
    <input type='hidden' name='change' />
    <input type='image' name='some_name' onclick='setChange(document.theForm)' />
</form>
[/CODE]

Then you will have to have the form submitted somehow too... You could use an 
additional submit button or you could use a location.href in the javascript above with 
a hand written query string... or something...

btw... try reading up on the xhtml standard. It'll do you good (and it'll do others 
replaying to this thread good too... ;) )


cya

.bobo
  ----- Original Message ----- 
  From: William Cheung 
  To: [EMAIL PROTECTED] 
  Sent: Monday, September 22, 2003 7:43 PM
  Subject: [PHP-WIN] Problem with 2 buttons


  I have 2 buttons sitting next to each other. One to update; the other to cancel. 
However, no matter which button I click, the isset($_POST["CHANGE"]) always returns 
true. My template code is list below. Could someone tell me what's wrong with my code?



  <tr height=60>

         <td width="5%">&nbsp;</td>

         <td valign=bottom>

                     <input type="hidden" name="CHANGE">

                     <input type=image name=CHANGE 
src={#img_dir#}{#template#}page6grid_g3.gif 
onmouseover="this.src='{#img_dir#}{#template#}page6grid_g4.gif'" 
onmouseout="this.src='{#img_dir#}{#template#}page6grid_g3.gif'">

                     <font class=mpanel_mid_data style="font-weight: lighter;">Update 
order</font>

         </td>

         <td valign=bottom>

                     <input type="hidden" name="CANCEL">

                     <input type=image name="CANCEL" 
src={#img_dir#}{#template#}page6grid_g11.gif 
onmouseover="this.src='{#img_dir#}{#template#}page6grid_g12.gif'" 
onmouseout="this.src='{#img_dir#}{#template#}page6grid_g11.gif'">

                     <font class=mpanel_mid_data style="font-weight: lighter; 
text-indent: 0px;">Cancel order</font>

         </td>

  </tr>



  William Cheung B.Sc, MCSE, MCDBA

  Databyte Corp. 



--- End Message ---
--- Begin Message ---
hi Ron,

I'll swing at this :)...

I've never done this in PHP, but have done a bit of work in Win32 Perl to
M$-Exchange.

The obvious thing to me is:

echo $session->Logon("'','',False,True,,True," . $strExchangeServer .$vbLF .
$strMailbox);

should read:

$session->Logon("'',"",False,True,-1,True," . $strExchangeServer."\n".
$strMailbox);

then something like:

$user = $session->CurrentUser->Address;

echo $user;

give this a go and let me know. thanks


"Ron Herhuth" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

I'm pulling my hair out trying to simply create a MAPI session by
instantiating the Outlook.Application COM object.  We have followed
instructions on setting up the server so that appears to be set up okay
with the appropriate permissions but everytime I run this simple 3 line
script I get the following message:

<-- SCRIPT -->
  $oOutlook = new COM("Outlook.Application");
  $session= new COM("MAPI.Session");

  $vbLF = "Chr(10)";
  $strExchangeServer = "exchange";
  $strMailbox = "testmail";

 echo $session->Logon("'','',False,True,,True," . $strExchangeServer .
$vbLF . $strMailbox);





This was extracted from VB code that does the same thing...here is that
code:

strExchangeServer = "exchange"
strMailbox = "testmail"
vbLF = Chr(10)

Set objSession = Server.CreateObject("MAPI.Session")
objSession.Logon "", "", False, True,,True, strExchangeServer & vbLF _ &
strMailbox








The Error:

The Outlook Application instantiation works and returns an object as
expected.

The MAPI session instantiates and returns an object as expected.

The logon fails and returns this error:

Warning: Invoke() failed: Exception occurred. Source: Collaboration Data
Objects Description: [Collaboration Data Objects -
[MAPI_E_LOGON_FAILED(80040111)]] in hs~MAPI001.php on line 8

Am I passing the wrong values?  Am I converting the code to PHP correctly?
What else can I try?  I know this should work but the logon method is
quite complex.

Thanks,
Ron

--- End Message ---
--- Begin Message ---
Hi Ro,
how about this snippet ? 

<?PHP

function Check_For_Final_Slash($path) {

   if (substr($path, (strlen($path) - 1), 1) != "\\") {
      $path = $path . "\\";
   }
   return($path);
}

// $path: input the topmost folder to be searched
function Get_Directory_Listing($path) {

   $path = Check_For_Final_Slash($path);
   if ($dir_handle = opendir($path)) {
      while ($file = readdir($dir_handle)) {
         chdir($path);
         if ($file != "..") {
            if (($file != ".")) {
               if (is_dir($file)) {
                  chdir($path . $file);
                           
                  // in this case, I make up a HTML page with refs; you would call 
Get_Directory_Listing($path . $file) recursively here
                  print("<FORM NAME='CHANGE_DIR' ACTION='index.html' METHOD='POST'>");
                  print("<INPUT TYPE='HIDDEN' NAME='PATH' VALUE='" . $path . $file . 
"'>");
                  print("<A HREF='#' onClick='submit();' >" . $file . "</A></INPUT>");
                  print("</FORM>");
               }
            }
            else {
               // up one step; you would probably leave out this branch
               $file = substr($path, 0, strrpos(substr($path, 0, strlen($path) - 1), 
"\\"));
               print("<FORM NAME='CHANGE_DIR' ACTION='index.html' METHOD='POST'>");
               print("<INPUT TYPE='HIDDEN' NAME='PATH' VALUE='" . $file . "'>");
               print("<A HREF='#' onClick='submit();' >[ up one level ]</A></INPUT>");
               print("</FORM>");
            }
         }
      }
      closedir($dir_handle);
   }
   if ($dir_handle = opendir($path)) {
      while ($file = readdir($dir_handle)) {
         $path = Check_For_Final_Slash($path);
         chdir($path);
         if (($file != ".") && ($file != "..")) {
            if (is_file($file)) {
            
               // here comes the action; I spit out a handle, you may open, read end 
extract
               print("<A HREF='" . $path . $file . "'>" . $file . "</A><BR>");
            }
         }
      }
      closedir($dir_handle);
   }
}
?>
-- 
Sven Schnitzke

> -----Ursprüngliche Nachricht-----
> Von:  Herhuth, Ron [SMTP:[EMAIL PROTECTED]
> Gesendet am:  Montag, 22. September 2003 17:59
> An:   [EMAIL PROTECTED]
> Betreff:      [PHP-WIN] a Directory Crawler
> 
> I'm stuck.
> 
> I have been attempting to put together a script with little tidbits I've
> found in the manual but I'm unable to figure out how to do this.
> 
> Basically I have a directory structure on my server that runs many levels
> deep and wide.  In the directories there are several files with the
> extension name ".schema"  I would like to have my script go through and
> open each of these files (they are text files) and add the contents to a
> variable which I will then store in a database.  I know how to display the
> contents of a directory, as well as open and read text files...and write
> to a database.  The problem I'm having is building the component that
> traverses the directory structure pulling back all the files.  I can make
> it read a single directory at a time but I'm at a loss to tell it how to
> navigate through the directories.
> 
> This app is not for anything malicious, but I need a dynamic archive of
> all the schemas and if I get brave I want to write an extraction tool to
> extract the SQL queries from the schemas and catagorize them for future
> use.
> 
> Thanks,
> Ron
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---

Reply via email to