[PHP-DB] regular expression and exact word search...

2002-11-07 Thread BAROILLER Pierre-Emmanuel
Hi!

does someone know how to find an exact word in a content with html tags ?
I'm using a regexp like this :

$searchRegEx = '\b.$word_search.\b'msi;

to get boundary word results, but... if the searched word is  like 'word or
word. or anything else, the
regular expression doesn't work..

if I remove the \b , I've got all words ( but without bound...)

Any idea?
(the big problem is I'm higlighting found sentences, and .. if the searched
word is part of an html tag, it's very auwfull... )




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




[PHP-DB] Re: losing my session variables

2002-10-29 Thread BAROILLER Pierre-Emmanuel
You only need to add session_start() in your script before storing your data
into the $_SESSION array.
Without session_start(), no session is started by php...

Regards,
P.E. Baroiller

Seabird [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
 Hi everyone,

 I use a login-script, but for some reason I keep losing my $_SESSION
 variables. Can Anyone tell me why?

 Here's my login script:

 ?php
 if(isset($_POST['submit'])) { // if form has been submitted
  /* check they filled in what they were supposed to and authenticate */
  if(!$_POST['uname'] | !$_POST['passwd']) {
   print 'form action=index.php method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8 maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   span class=welcomeplease fill in the required
 fields./span/div
   /form
 ';
  }
  // authenticate.
  if(!get_magic_quotes_gpc()) {
   $_POST['uname'] = addslashes($_POST['uname']);
  }
  $check = $db_object-query(SELECT username, password FROM users WHERE
 username = '.$_POST['uname'].');
  if(DB::isError($check)) {
   print 'form action=index.php method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8 maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   span class=welcomeusername doesn\'t exist./span a
 class=header
 href=javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')sign
up
 here/a/div
   /form
 ';
  }
  $info = $check-fetchRow();
  // check passwords match
  $_POST['passwd'] = stripslashes($_POST['passwd']);
  $info['password'] = stripslashes($info['password']);
  $_POST['passwd'] = md5($_POST['passwd']);
  if($_POST['passwd'] != $info['password']) {
   print 'form action=index.php method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8 maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   span class=welcomewrong password, try again/span/div
   /form
 ';
  }

  // if we get here username and password are correct, register session
 variables and set
  // last login time.
  $date = date('m d, Y');
  $update_login = $db_object-query(UPDATE users SET last_login = '$date'
 WHERE username = '.$_POST['uname'].');
  $_POST['uname'] = stripslashes($_POST['uname']);
  $_SESSION['username'] = $_POST['uname'];
  $_SESSION['password'] = $_POST['passwd'];
  $db_object-disconnect();
 ?
 span class=welcomeWelcome a class=header

href=javascript:loadPage('mainlayer',null,'users/edit.php?user=?=$_SESSION
 ['username']?')font
 color=white?=$_SESSION['username']?/font/abra class=header
 href=login/logout.phpLogout/a
 /span
 ?php
 }
 else { // if form hasn't been submitted
 ?
 form action=?=$HTTP_SERVER_VARS['PHP_SELF']? method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8 maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   a class=header
 href=javascript:loadPage('mainlayer',null,'login/signup.php')sign up
 here/a /div
   /form
 ?php
 }
 ?

 --
 http://seabird.jmtech.ca

 Attitude is Everything!
 But Remember, Attitudes are Contagious!
 Is Yours worth Catching





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




[PHP-DB] Re: Passing string variable to HTML TITLE tag fails within Netscape but works well within IE.

2002-10-16 Thread Baroiller Pierre-Emmanuel

your html is wrong...
you must write :

html 
head
title?php echo $title ? /title
/head
/html

With the head tag, IE  Netscape will display your title correctly.

Regards.
P.E.
  Darrian Walker [EMAIL PROTECTED] a écrit dans le message de news: 
01c274b9$2a10a1a0$[EMAIL PROTECTED]
  Passing string variable to HTML TITLE tag fails within Netscape but work
  well within IE.

  I have a single page consisting of inventory items to be sold. When an item
  is selected, it passes the product name to a DETAIL page as part of the
  TITLE tag for the DETAIL page. My problem is: Netscape does not like the
  SPACES between the text and refuses to display the DETAIL page.

  Initially, I thought there might be some way to parse the string and add the
  ascii code for SPACE, but I wasn't sure if I was on the right track. Does
  anyone have a proven solution to this problem?

  I thought the pseudo code might look something like this:
  ?php
  function
  parse_and_change(grab_string){ 
  $string_holder=$grab_string; 
  while stepping through the characters in this $string_holder 
  { if character =   (or some other representation) 
  replace it with something that doesn't 
  scare netscape or title tag 
  } 
  return $string_holder; 
  }
  ? 

  ?php 
  if (isset($HTTP_GET_VARS[itemname])) { 
  $title = (parse_and_change($HTTP_GET_VARS[itemname] )); 
  }else{ 
  $title=Generic Product Title; 
  }
  ? 

  html 
  title?php echo $title ? /title
  /html







[PHP-DB] file upload and php (Not a begginer question!)

2002-10-15 Thread Baroiller Pierre-Emmanuel

Hi,

everyone know how to upload files from the browser to your web server using
multipart-form method with move_downloaded_file() php function.

But... It's a slow method for multiple files  huge files transfert.

I'm currently working on a big photo album tool, and I want to provide user
the ability to upload a lot of jpeg files in one time...
The big problem with form is it's too slow...

Does anyone know how to by-pass this ( with java or other tools )?



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