php-general Digest 19 Feb 2007 03:19:05 -0000 Issue 4633

Topics (messages 248994 through 249004):

EMAIL LIST AND PASSWORD
        248994 by: hackcrack

Re: Help with sessions on Log in and Log out
        248995 by: Haydar TUNA

Re: LOL, preg_match still not working.
        248996 by: Al

Re: reverse http authentication
        248997 by: Travis Doherty

Another hand wringer
        248998 by: jekillen
        248999 by: Matt Zandstra

re another hand wringer
        249000 by: jekillen

Re: needed Yahoo like window for db query.
        249001 by: Miguel J. Jiménez

Re: $_FILES path on client's machine?
        249002 by: Chris

What is $this->
        249003 by: Dick Richard
        249004 by: Leonard Burton

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hello,

Any Body with Email List and Password Should Kindly send it to my email
[EMAIL PROTECTED]
-- 
View this message in context: 
http://www.nabble.com/EMAIL-LIST-AND-PASSWORD-tf3248449.html#a9030106
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
Hi,
        Firstly , you should unset all of session variables an then you 
should destroy the session variables. After this process, redirect the page 
to HTML file (for example quit.html). By the way , you should use the GET 
variables or POST variables to quit.
if (isset($_GET['quit']))
{
   session_unset();
   session_destroy();
   include('quit.html');
   exit;
}

        in quit.html load the main page of your web site. If you can apply 
this process, you can easily quit the application. If you have even click 
the back button, you wouldn't have entered the page.
quit.html code

<html>
<body>
<script type="text/javascript">
window.top.location="index.php"
</script>
</body>
</html>


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net


""Ashish Rizal"" <[EMAIL PROTECTED]>, haber iletisinde þunlarý 
yazdý:[EMAIL PROTECTED]
>I am having some problem working with my script on session
> stuffs. Well, i have a login page which authenticates users by
> using sql script then if login is successful i have
> PHP Code:
>
> $_SESSSION['logged in']=true; and $_SESSION[userid]=$userid
>
> and when login is true i have included the page based on the
> access level of users . Like if it is a regular user i have
> include "user.php" ; exit() and if admin i have included admin page.
>
> Also i have a log out script which unsets the sessions variable
> and distroy the session at last.
> Also when admin loggs in to admin page i have a small php script
> that checks for those session variables and if the are set and
> "is true" then the pages are displayed.
>
> My problem is when admin just comes out to the login page again
> without log out it allows to login to the main page but in main
> page if any < a href> link is clicked it goes back to login page.
> So then i will have to go back and log out first and then log
> in.. I am not sure why this strange things happens.
> Also is there any way i can have a feature like when the users
> click back button it wont allow to go back to that page unless he
> is using the back button provided by the web interface.
>
> I am new at the session stuffs, so i am not sure what i am doing
> is really a safe way to code a php page. are there any other
> things that i need to be aware of while using sessions.
>
> Any suggestions or thoughts would be highly appreciated.
> Thanks 

--- End Message ---
--- Begin Message --- If you want help, you must provide some example text strings that are to be matched. You keep posting your pattern and that's the problem.



Beauford wrote:
Mails been down since this morning (sorry, that's yesterday morning).
Anyway, not sure if this went through, so here it is again.
------

The bottom line is I want to allow everything in the expression and nothing
else. The new line does not seem to be an issue - I can put as many returns
as I want, but as soon as I add some punctuation, it falls apart.

As I said before, the ! and the period from my original example are reported
as invalid - as they are in the expression they should be valid, I'm sure
there are other examples as well, but you can see what the problem is. If I
take out the ! and period from my example and leave the new lines in, it
works fine.

Thanks



-----Original Message-----
From: Gregory Beaver [mailto:[EMAIL PROTECTED] Sent: February 17, 2007 12:21 PM
To: Beauford
Cc: PHP
Subject: [PHP] Re: LOL, preg_match still not working.

Beauford wrote:
Hi,

I previously had some issues with preg_match and many of
you tried to help,
but the same problem still exists. Here it is again, if
anyone can explain
to me how to get this to work it would be great - otherwise
I'll just remove
it as I just spent way to much time on this.

Thanks

Here's the code.

if(empty($comment)) { $formerror['comment'] = nocomments; }
        elseif(!preg_match('|[EMAIL PROTECTED]&*();:_.\\\\ /\t-]+$|',
$comment)) {
                                $formerror['comment'] = invalidchars;
        }       

This produces an error, which I believe it should not.

Testing 12345. This is a test of the emergency broadcast system.

WAKE UP!!!!!!
Hi,

Your sample text contains newlines.  If you wish to allow newlines,
instead of " \t" you should use the whitespace selector "\s"

<?php
$comment = 'Testing 12345. This is a test of the emergency broadcast system.

WAKE UP!!!!!!';
if(!preg_match('|[EMAIL PROTECTED]&*();:_.\\\\\s/-]+$|', $comment)) {
    echo 'oops';
} else {
    echo 'ok';
}
?>

Try that code sample, and you'll see that it says "ok"

What exactly are you trying to accomplish with this preg_match()? What
exactly are you trying to filter out?  I understand you want to
eliminate "invalid characters" but why are they invalid? I ask because there may be a simpler way to solve the problem, if you can explain what
the problem is.

Thanks,
Greg

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




--- End Message ---
--- Begin Message ---
Chris W wrote:

> I want to read a page that is protected with http authentication.  How
> do I pass the user name and password to be authenticated with my php
> code?
>
Have you tried to just put the username and password in the URL?  I'm
not sure if this works, its so simple its worth a try.  Instead of using
(whatever function you use) like the first example try changing it like
the second:

x('http://example.com/protected/page.php');
x('http://username:[EMAIL PROTECTED]/protected/page.php');

Of course it depends on the 'x' you are using...  I'm really not sure if
PHP's functions will take care of moving that username/password
information into the header of the HTTP request or just leave it there.

Travis Doherty

--- End Message ---
--- Begin Message ---
Hello;
I am having trouble with a loop in scripts run under
php v5.1.2.

I have produced a form in a web page that has a variable number
of text fields. These fields represent the result of opening a file
and populating the fields with the corresponding value data found
in the file. The field names are generated in a php loop using an
iterator $i and given a_$i+1 names. If I test for the field names
on post literally, a_1, a_2, a_...n, the values are getting posted
properly.
Then when I run through a loop looking for $_POST["a_$z"]
(where $z = $i +1) only one $_POST value with this name
series is processes and the loop quits.
Here is the post processing code at this stage of the script:

$edata = array();
$part = '';
$flen = '';
$file = '';
if($_POST['section'])
  {
   $part = $_POST['section']; // target file section
$flen = $_POST['flen']; // length of text field group, shows to be the correct number
   $file = $_POST['df'];      // file to work on
   $z = 1;
   switch($part)
         {
          case 'name':
          /*
            a_1, a_2 etc are field names
printing these values shows that all the fields are being posted properly
            array_push($edata, $_POST["a_1"]);
            array_push($edata, $_POST["a_2"]);
            array_push($edata, $_POST["a_3"]);
            array_push($edata, $_POST["a_4"]);
           could be as few as 1 and as many as 13 fields
          */
          for($i = 0; $i < count($flen); $i++)
              {
array_push($edata, $_POST["a_$z"]); // this loop terminates on the first iteration. print $_POST["a_$z"].'<br>'; // only prints the first in the series.
               $z++;
              };
          //edit_pa_rec($edata, $file, $flen, $part);
          break; -----> more cases with similar code
I want to avoid hard coding the $_POST variables
so, question, is this:
A: a bug?
B: $_POST data is getting dropped in the loop?
C: Something else is wrong with my code?
Thanks in advance
Jeff K

--- End Message ---
--- Begin Message --- Looks to me as if you're treating $flen as an array in one place and as a value in another:

String here:
  $flen = $_POST['flen'];    // length of text field group, shows to be the

Array here:
         for($i = 0; $i < count($flen); $i++)

Remove the count() and you'll probably get what you expect.

hth


On Sun, 18 Feb 2007, jekillen wrote:

Hello;
I am having trouble with a loop in scripts run under
php v5.1.2.

I have produced a form in a web page that has a variable number
of text fields. These fields represent the result of opening a file
and populating the fields with the corresponding value data found
in the file. The field names are generated in a php loop using an
iterator $i and given a_$i+1 names. If I test for the field names
on post literally, a_1, a_2, a_...n, the values are getting posted
properly.
Then when I run through a loop looking for $_POST["a_$z"]
(where $z = $i +1) only one $_POST value with this name
series is processes and the loop quits.
Here is the post processing code at this stage of the script:

$edata = array();
$part = '';
$flen = '';
$file = '';
if($_POST['section'])
 {
  $part = $_POST['section']; // target file section
$flen = $_POST['flen']; // length of text field group, shows to be the correct number
  $file = $_POST['df'];      // file to work on
  $z = 1;
  switch($part)
        {
         case 'name':
         /*
           a_1, a_2 etc are field names
printing these values shows that all the fields are being posted properly
           array_push($edata, $_POST["a_1"]);
           array_push($edata, $_POST["a_2"]);
           array_push($edata, $_POST["a_3"]);
           array_push($edata, $_POST["a_4"]);
          could be as few as 1 and as many as 13 fields
         */
         for($i = 0; $i < count($flen); $i++)
             {
array_push($edata, $_POST["a_$z"]); // this loop terminates on the first iteration. print $_POST["a_$z"].'<br>'; // only prints the first in the series.
              $z++;
             };
         //edit_pa_rec($edata, $file, $flen, $part);
         break; -----> more cases with similar code
I want to avoid hard coding the $_POST variables
so, question, is this:
A: a bug?
B: $_POST data is getting dropped in the loop?
C: Something else is wrong with my code?
Thanks in advance
Jeff K



--
getInstance()
http://www.getinstance.com

--- End Message ---
--- Begin Message ---
Sorry all;
regarding recent post  list troubles with code below
in the loop I was using count($value) instead of just $value

for($i = 0; $i < count($flen); $i++) // should be $flen instead of count($flen)
              {
array_push($edata, $_POST["a_$z"]); // this loop terminates on the first iteration. print $_POST["a_$z"].'<br>'; // only prints the first in the series.
               $z++;
              };

 for($i = 0; $i < $flen; $i++) // now it works
              {
               array_push($edata, $_POST["a_$z"]);
               print $_POST["a_$z"].'<br>'; //  prints all values.
               $z++;
              };

Thanks for your time;
Jeff K

--- End Message ---
--- Begin Message ---
El Sun, 18 Feb 2007 01:23:26 -0800 (PST)
Chris Carter <[EMAIL PROTECTED]> escribió:

> 
> Need some help on getting some database result in a css popup like
> yahoo. The requirement is to open a div or a window similar to yahoo
> one. As you can see from the link below.
> 
> http://news.yahoo.com/s/ap/20070218/ap_on_go_co/us_iraq
> 
> On this if you click on the Images next to the links "Iraq",
> "President Bush", "Hillary Rodham Clinton", "Pentagon", etc. This
> opens a div within the page with the search result. They are using
> some JavaScript to achieve this.
> 
> Is there anyone with idea of where to find a code for a similar kind
> of window. I need to present data from database in a similar kind or
> window.
> 
> Any link, text to search in google or code would do :-|
> 
> Thanks in advance,
> 
> Chris

What you need is called AJAX :-)


---
Miguel J. Jiménez
ISOTROL, S.A.
[EMAIL PROTECTED]
+34 955036800
+34 607448764

"I try to save a life a day. Usually it's my own."
John Crichton, FARSCAPE (1x07)

--- End Message ---
--- Begin Message ---
Skip Evans wrote:
Hey all,

I get the feeling from not finding an argument for the path on the client's machine for the complete path of a file in $_FILES that it might not be available for security reasons?

The reason I am interested in this is to restore the value of a input type='file' field in a form if the user has to return to the form for validation reasons.

I'd like to restore the full value so the user does not have to browse the file again.

Nope. Huge security hole ;)

I could prefill the form with something like "/etc/passwd" if you're on a *nix desktop, hide the file input box through css and grab all your details without you knowing it.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Can someone explain what $this-> does and means. For example what does this
bit ot php code mean?

$this->SetFont('Arial','B',15);

Thanks

[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
HI,

$this->SetFont('Arial','B',15);

what you include is a snippet from a class.  Here is a brief into to
how a class works, sort of like a function.  The $this refers to the
class from inside of the class.

<?php

class write{

var $message;

function set($message){

              $this->$message = $message;
}

function display(){

             print "$this->message\n";
}

}// class write

//actually use the class
$class = new write();
$class->set("This is a test message");
$class->display();

?>

I hope this helps.

Leonard


--
Leonard Burton, N9URK
http://www.jiffyslides.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]

"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

--- End Message ---

Reply via email to