php-windows Digest 24 Feb 2003 13:36:10 -0000 Issue 1603

Topics (messages 18682 through 18686):

Re: using frames
        18682 by: Jill.Ramonsky.Aculab.com

help! for my project...
        18683 by: Jeffrey S. Payao
        18686 by: toby z

Re: Unexplained CGI error
        18684 by: Christoph Christ (Wien)
        18685 by: Christoph Grottolo

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 ---
Nah. I've actually done this. *IT CAN BE DONE SERVER SIDE* using PHP.

Here's what you do. The link(s) in question have to look like this:

    <a href="whole_page.php?context_data=whatever_you_want"
target="_top">click here</a>

Here, "whole_page.php" is the "topmost" php script, the master one, the one
that controls everything else. It's a php script which generates a
<FRAMESET> page. It has a <TITLE> tag in its <BODY> so it will change the
title in the browser. The frameset page gets the context data from the GET
variables and specifies the urls of the subpages like this:
"sub_page.php?context_data=whatever_you_want", so the browser refreshes the
outer frame, which in turn refreshes the inner frames, and so repeat ad
infinitum. At each stage you pass context information down the chain in the
tags, and retreive them using $_GET["name"].

I did this for my wedding. My husband and I had an online stag party (for
both sexes), which was basically a chat root which ran in any old browser
window, so no-one needed IRC. I wrote all the code for that in PHP. I think
it had four frames in all. The topmost page contained two subframes (the top
one was just a visual title, but it had to change with the context). The
bottommost subpage was itself a frameset which passed the context down even
further.

There ARE things that you can't do server-side, obviously. But you can often
do a lot more server-side than you might at first expect.

Jill



-----Original Message-----
From: Matt Hillebrand [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 22, 2003 1:49 AM
To: 'Andrew Ferguson'; [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] using frames


This is a client-side programming issue, so you would use JavaScript and
not PHP. I guess you could do something like:

  <a href="blah.php" onClick="parent.document.title='The Blah
Page'">blah</a>

It can be fun/challenging to dynamically create javascript code with
PHP. I sometimes like to use borderless iframes (not frames). That way
the client-side javascript code can interact with a server-side PHP
script in order to change the content on the screen without changing the
location of the web browser (and without the appearance of frames).

Matt

|-----Original Message-----
|From: Andrew Ferguson [mailto:[EMAIL PROTECTED] 
|Sent: Friday, February 21, 2003 7:31 PM
|To: [EMAIL PROTECTED]
|Subject: [PHP-WIN] using frames
|
|
|I want to build a website with frames and have PHP call up the 
|data from a mySQL database. However, I also want the title to 
|change every you click a different link in the frame. Any ideas?
|
|
|
|-- 
|PHP Windows Mailing List (http://www.php.net/)
|To unsubscribe, visit: http://www.php.net/unsub.php
|
|
|



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

--- End Message ---
--- Begin Message --- hi guys! can anyone please help me in my project. please. im currently creating my thesis, a site with a search engine. i googled and found a lot for my projects. now my problem is i cant display my article links. :( im using php+apache+mysql on my w2k. here are the following code i took from http://www.devarticles.com/




the sql:


create database content;
use content;

create table articles
(
  articleId int auto_increment,
  title varchar(50) not null,
  content text,
  primary key(articleId),
  unique id(articleId)
);

create table searchWords
 (
  wordId int auto_increment,
  word varchar(50),
  articleIds varchar(255),
  primary key(wordId),
  unique id(wordId)
);

insert into articles values(0, 'MySQL is a great database', 'If you\'re after a top quality database, then you should consider MySQL. MySQL is packed with features, and can be installed on both Linux and Windows servers.');

insert into searchWords values(0, 'MySQL', '1');

insert into searchWords values(0, 'install', '1');

insert into articles values(0, 'MySQL: Most popular DBMS!', 'A recent survey conducted by Company X indicated that 98% of Linux developers prefer MySQL over any other DBMS. Developers prefer MySQL because it is fast, free and also cross-platform.');

update searchWords set articleIds = '1,2' where word = 'MySQL';

insert into searchWords values(0, 'survey', 2);

insert into articles values(0, 'Apache is pronounced A-Patchy', 'Did you know that Apache is pronounced A-Patchy, because back in its early days it consisted of code that was just \'patched\' together roughly to create a web server?');

insert into searchWords values(0, 'apache', 3);



the php:


<?php


  $submit = $_POST["submit"];
  $keywords = $_POST["keywords"];

  if(isset($submit) || isset($keywords))
  {
    doSearch($keywords);
  }
  else
  {
    getKeywords();
  }

  function getKeywords()
  {
    ?>

      <html>
      <head>
        <title> Enter Search Keywords </title>
      </head>

<body bgcolor="#FFFFFF">

        <form name="frmKW" action="searchdocs.php" method="post">
          <h1>Keyword Search</h1>
          Enter keywords to search on:
          <input type="text" name="keywords" maxlength="100">
          <br><br><input type="submit" name="submit" value="Search">

</form>

      </body>
      </html>

    <?php
  }

  function doSearch($search_keywords)
  {
    $arrWords = explode(" ", $search_keywords);

    if(sizeof($arrWords) == 0 || $search_keywords == "")
    {
      echo "You didn't enter any keywords<br>";
      echo "<a href='searchdocs.php'>Go Back</a>";
    }
    else
    {

      // Connect to the database
      $dServer = "localhost";
      $dDb = "content";
      $dUser = "admin";
      $dPass = "password";

      $s = @mysql_connect($dServer, $dUser, $dPass)
      or die("Couldn't connect to database server");

      @mysql_select_db($dDb, $s)
      or die("Couldn't connect to database");

      $count = 0;
      $articles = array();

for($i = 0; $i < sizeof($arrWords); $i++)
{
$query = "select articleIds from searchWords where word = '{$arrWords[$i]}'";
$result = mysql_query($query);


        if(mysql_num_rows($result) > 0)
        {
          // Get the id's of the articles
          $row = mysql_fetch_array($result);
          $arrIds = explode(",", $row[0]);
          $arrWhere = implode(" OR articleId = ", $arrIds);

$aQuery = "select articleId, title, left(content, 100) as summary from articles where articleId = " . $arrWhere;
$aResult = mysql_query($aQuery);


          if(mysql_num_rows($aResult) > 0)
          {
            while($aRow = mysql_fetch_array($aResult))
            {
              $articles[$count] = array (
                                  "articleId" => $aRow["articleId"],
                                  "title" => $aRow["title"],
                                  "summary" => $aRow["summary"]
                                                      );
                          $count++;
                    }
          }
        }


}
if(isset($articles))
{
$articles = array_unique($articles);

echo "<h1>" . sizeof($articles);
echo (sizeof($articles) == 1 ? " article" : " articles");
echo " found:</h1>";

foreach($articles as $a => $value)
{
?>
<a href="article.php?articleId=<?php echo $articles[$a]["articleId"]; ?>">
<b><u><?php echo $articles[$a]["title"]; ?></u></b>
</a>
<br><?php echo $articles[$a]["summary"] . "..."; ?>
<br>
<a href="article.php?articleId=<?php echo $articles[$a]; ?>">
http://localhost/article.php?articleId=<?php echo $articles[$a]["articleId"]; ?>
</a>
<br><br>
<?php
}
}
else
{
echo "No results found for '$search_keywords'<br>";
echo "<a href='searchdocs.php'>Go Back</a>";
}


    }
  }

?>



can anybody please point me out on how to display the articles? thaks in advance...


jeff...




--- End Message ---
--- Begin Message ---
hay jeff

how much time u got there ????

do u understand anyother language then english ????
well if u do i search for articles & display results on my site 
u can chek it out at www.zaban.net

then v will discuss what xactly n how u wanna do that

im sorry the site doesnt support english yet .... but will in a few
months
 :)

good luck vid ur thesis
ill try 2 help what i can ok :)

toby ....
 

--- "Jeffrey S. Payao" <[EMAIL PROTECTED]> wrote: > hi
guys! can anyone please help me in my project. please. im
> currently 
> creating my thesis, a site with a search engine. i googled and
> found a 
> lot for my projects. now my problem is i cant display my article
> links. 
> :( im using php+apache+mysql on my w2k. here are the following code
> i 
> took from http://www.devarticles.com/
> 
> 
> 
> 
> the sql:
> 
> create database content;
> use content;
> 
> create table articles
> (
>    articleId int auto_increment,
>    title varchar(50) not null,
>    content text,
>    primary key(articleId),
>    unique id(articleId)
> );
> 
> create table searchWords
>   (
>    wordId int auto_increment,
>    word varchar(50),
>    articleIds varchar(255),
>    primary key(wordId),
>    unique id(wordId)
> );
> 
> insert into articles values(0, 'MySQL is a great database', 'If
> you\'re 
> after a top quality database, then you should consider MySQL. MySQL
> is 
> packed with features, and can be installed on both Linux and
> Windows 
> servers.');
> 
> insert into searchWords values(0, 'MySQL', '1');
> 
> insert into searchWords values(0, 'install', '1');
> 
> insert into articles values(0, 'MySQL: Most popular DBMS!', 'A
> recent 
> survey conducted by Company X indicated that 98% of Linux
> developers 
> prefer MySQL over any other DBMS. Developers prefer MySQL because
> it is 
> fast, free and also cross-platform.');
> 
> update searchWords set articleIds = '1,2' where word = 'MySQL';
> 
> insert into searchWords values(0, 'survey', 2);
> 
> insert into articles values(0, 'Apache is pronounced A-Patchy',
> 'Did you 
> know that Apache is pronounced A-Patchy, because back in its early
> days 
> it consisted of code that was just \'patched\' together roughly to 
> create a web server?');
> 
> insert into searchWords values(0, 'apache', 3);
> 
> 
> 
> the php:
> 
> 
> <?php
> 
>    $submit = $_POST["submit"];
>    $keywords = $_POST["keywords"];
> 
>    if(isset($submit) || isset($keywords))
>    {
>      doSearch($keywords);
>    }
>    else
>    {
>      getKeywords();
>    }
> 
>    function getKeywords()
>    {
>      ?>
> 
>        <html>
>        <head>
>          <title> Enter Search Keywords </title>
>        </head>
> 
>        <body bgcolor="#FFFFFF">
> 
>          <form name="frmKW" action="searchdocs.php" method="post">
>            <h1>Keyword Search</h1>
>            Enter keywords to search on:
>            <input type="text" name="keywords" maxlength="100">
>            <br><br><input type="submit" name="submit"
> value="Search">
> 
>          </form>
> 
>        </body>
>        </html>
> 
>      <?php
>    }
> 
>    function doSearch($search_keywords)
>    {
>      $arrWords = explode(" ", $search_keywords);
> 
>      if(sizeof($arrWords) == 0 || $search_keywords == "")
>      {
>        echo "You didn't enter any keywords<br>";
>        echo "<a href='searchdocs.php'>Go Back</a>";
>      }
>      else
>      {
> 
>        // Connect to the database
>        $dServer = "localhost";
>        $dDb = "content";
>        $dUser = "admin";
>        $dPass = "password";
> 
>        $s = @mysql_connect($dServer, $dUser, $dPass)
>        or die("Couldn't connect to database server");
> 
>        @mysql_select_db($dDb, $s)
>        or die("Couldn't connect to database");
> 
>        $count = 0;
>        $articles = array();
> 
>        for($i = 0; $i < sizeof($arrWords); $i++)
>        {
>          $query = "select articleIds from searchWords where word = 
> '{$arrWords[$i]}'";
>          $result = mysql_query($query);
> 
>          if(mysql_num_rows($result) > 0)
>          {
>            // Get the id's of the articles
>            $row = mysql_fetch_array($result);
>            $arrIds = explode(",", $row[0]);
>            $arrWhere = implode(" OR articleId = ", $arrIds);
> 
>            $aQuery = "select articleId, title, left(content, 100)
> as 
> summary from articles where articleId = " . $arrWhere;
>            $aResult = mysql_query($aQuery);
> 
>            if(mysql_num_rows($aResult) > 0)
>            {
>              while($aRow = mysql_fetch_array($aResult))
>              {
>                $articles[$count] = array (
>                                    "articleId" =>
> $aRow["articleId"],
>                                    "title" => $aRow["title"],
>                                    "summary" => $aRow["summary"]
>                                                     );
>                         $count++;
>                   }
>            }
>          }
> 
> 
>        }
>          if(isset($articles))
>          {
>                       $articles = array_unique($articles);
>                       
>                       echo "<h1>" . sizeof($articles);
>                       echo (sizeof($articles) == 1 ? " article" : " articles");
>                       echo " found:</h1>";
>                       
>                       foreach($articles as $a => $value)
>                       {
>                               ?>
>                                       <a href="article.php?articleId=<?php echo 
> $articles[$a]["articleId"]; ?>">
>                                               <b><u><?php echo 
> $articles[$a]["title"]; ?></u></b>
>                                       </a>
>                                       <br><?php echo $articles[$a]["summary"] . 
> "..."; ?>
>                                       <br>
>                                       <a href="article.php?articleId=<?php echo 
> $articles[$a]; ?>">
>                                               
> http://localhost/article.php?articleId=<?php echo 
> $articles[$a]["articleId"]; ?>
>                                       </a>
>                                       <br><br>
>                               <?php
>                       }
>               }
>               else
>               {
>                       echo "No results found for '$search_keywords'<br>";
>                       echo "<a href='searchdocs.php'>Go Back</a>";
>               }
> 
>      }
>    }
> 
> ?>
> 
> 
> 
> can anybody please point me out on how to display the articles?
> thaks in 
> advance...
> 
> 
> jeff...
> 
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>  

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--- End Message ---
--- Begin Message ---
This bug has been fixed - take the latest CVS snapshot where a bugfix for
that problem has been applied.

The problem is, that php.exe crashes under IIS (seems to be a not properly
handled buffer overflow situation).

Kind regards
Christoph Christ

> I had a very nice little application I was working on. I selected options
> from an html page and then after selection I called a PHP script.  It
> worked
> just fine, but now when I use the same code unchanged, it gives me the
> error
> you see below and nothing more. This has happened to me twice before. What
> gives?  There must be something I'm doing, but I can't figure what it is.
> I
> can't be the only person who's gotten this.  Please help!
>
> Thanks,
>
> CGI Error
> The specified CGI application misbehaved by not returning a complete set
> of
> HTTP headers. The headers it did return are:
>
>
>


-- 
CC

--- End Message ---
--- Begin Message ---
The original mail is not clear enough to give an answer. To me it
sounds more like an IIS misconfiguration.

There was a problem with CGI not stopping under IIS when iisfunc
extension was enabled, but this won't give the CGI error mentioned
below. To me it sounds more like a misconfiguration in the ini file.

What happens if you call a script with the following content:

<?php phpinfo(); ?>

If you do not a beautiful configuration page, then RTM at
www.php.net/install.windows.

Christoph



[EMAIL PROTECTED] (Christoph Christ) wrote:

>This bug has been fixed - take the latest CVS snapshot where a bugfix for
>that problem has been applied.
>
>The problem is, that php.exe crashes under IIS (seems to be a not properly
>handled buffer overflow situation).
>
>Kind regards
>Christoph Christ
>
>> I had a very nice little application I was working on. I selected options
>> from an html page and then after selection I called a PHP script.  It
>> worked
>> just fine, but now when I use the same code unchanged, it gives me the
>> error
>> you see below and nothing more. This has happened to me twice before. What
>> gives?  There must be something I'm doing, but I can't figure what it is.
>> I
>> can't be the only person who's gotten this.  Please help!
>>
>> Thanks,
>>
>> CGI Error
>> The specified CGI application misbehaved by not returning a complete set
>> of
>> HTTP headers. The headers it did return are:
>>
>>
>>


--- End Message ---

Reply via email to