php-general Digest 28 Apr 2007 17:33:14 -0000 Issue 4761

Topics (messages 254047 through 254065):

*SOLVED* Need to POST multiple values with single name
        254047 by: Maxim.Sedelnikov.asplinux.ru

single sign on Solution php and .net
        254048 by: Murtaza Chang

Re: how to detect type of image
        254049 by: Tijnema !
        254054 by: tedd
        254055 by: Tijnema !
        254057 by: Edward Vermillion
        254060 by: Tijnema !
        254063 by: tedd
        254065 by: Tim

Re: Script feedback: insert string into another string
        254050 by: Tijnema !
        254051 by: Micky Hulse
        254052 by: Micky Hulse
        254053 by: Tijnema !
        254056 by: Micky Hulse
        254059 by: Tijnema !

Re: [ANNOUNCE] TODO parser
        254058 by: Edward Vermillion
        254064 by: Alexander Elder

phpbb / sessionid nightmare
        254061 by: Brad Sumrall
        254062 by: Tijnema !

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 ---
Thanks to all.
I've solved the problem with 'http_post_data()':

$data=array('aaa1' => '2', 'bbb2' => '');
$mult='licenses=lic1&licenses=lic2';
$http_response=http_post_data($url,http_build_str($data).'&'.$mult,$opt);

--- End Message ---
--- Begin Message ---
Hi, me and my fellow developer have built two applications that need to
authenticate users using LDAP, we have successfully accomplished it, but the
problem is his application is in .net and mine is in php, my php app needs
to call secure pages of .net and vice versa, now when the user is logged
onto let say my php app he is logged and his session is created and when I
redirect him to .net app he again sees a login form because the session isnt
created in .net app.
I need some single sign on solution I found lots of APIs and libraries for
java but have no idea what can I use for php and .net, kindly experience
programmers guide me.
Thankyou

--
Murtaza Chang
http://flickr.com/photos/blackstallion/

--- End Message ---
--- Begin Message ---
On 4/28/07, Tim <[EMAIL PROTECTED]> wrote:
On 21.04.2007 12:45, Alain Roger wrote:
> Hi,
>
> In my web application, end user is able to load images (png, jpeg,
> gif,..) into database. I would like to know how can i detect
> automatically the type of image (pnd, jpeg,...) ? i do not want to
> check the extension because this is easily faked... just by renaming
> it.
>
> Does it exist a technique for that ?
>
> thanks a lot,
>

Hi,

unfortunately mime_content_type() does not work for me. This functions
does always return false, although the "magic.mime" is valid.
Here is a function I wrote to determine the correct extension of an
image file:

function get_image_extension($filename)
{
    if (function_exists('exif_imagetype'))
    {
        switch (exif_imagetype($filename))
        {
            case 1:
                return 'gif';
            case 2:
                return 'jpg';
            case 3:
                return 'png';
            case 4:
                return 'swf';
            case 5:
                return 'psd';
            case 6:
                return 'bmp';
            case 7:
                return 'tiff';
            case 8:
                return 'tiff';
            case 9:
                return 'jpc';
            case 10:
                return 'jp2';
            case 11:
                return 'jpx';
            case 12:
                return 'jb2';
            case 13:
                return 'swc';
            case 14:
                return 'iff';
            case 15:
                return 'wbmp';
            case 16:
                return 'xbm';
            default:
                return false;
        }
    }
    else
        return false;
}

Best regards,
Tim


First of all, i don't see any reason why this works better then other
functions, as it also relies on the magic bytes.

Second, for your switch, you should use the constants
(IMAGETYPE_GIF,IMAGETYPE_JPEG,...) instead of just using decimal
values.

Tijnema

--- End Message ---
--- Begin Message ---
At 2:10 AM +0200 4/28/07, Tim wrote:
On 21.04.2007 12:45, Alain Roger wrote:
Hi,

In my web application, end user is able to load images (png, jpeg,
gif,..) into database. I would like to know how can i detect
automatically the type of image (pnd, jpeg,...) ? i do not want to
check the extension because this is easily faked... just by renaming
it.

Does it exist a technique for that ?

thanks a lot,


Hi,

unfortunately mime_content_type() does not work for me.

Tim:

It should, but instead try this:

$image_size = getimagesize($filename);
echo $image_size['mime'];

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On 4/28/07, tedd <[EMAIL PROTECTED]> wrote:
At 2:10 AM +0200 4/28/07, Tim wrote:
>On 21.04.2007 12:45, Alain Roger wrote:
>>Hi,
>>
>>In my web application, end user is able to load images (png, jpeg,
>>gif,..) into database. I would like to know how can i detect
>>automatically the type of image (pnd, jpeg,...) ? i do not want to
>>check the extension because this is easily faked... just by renaming
>>it.
>>
>>Does it exist a technique for that ?
>>
>>thanks a lot,
>>
>
>Hi,
>
>unfortunately mime_content_type() does not work for me.

Tim:

It should, but instead try this:

$image_size = getimagesize($filename);
echo $image_size['mime'];

Cheers,

tedd


mime_content_type fails a lot, and so does getimagesize, i believe one
relays on the other.

Tijnema

--- End Message ---
--- Begin Message ---

On Apr 28, 2007, at 6:54 AM, tedd wrote:

At 2:10 AM +0200 4/28/07, Tim wrote:
On 21.04.2007 12:45, Alain Roger wrote:
Hi,

In my web application, end user is able to load images (png, jpeg,
gif,..) into database. I would like to know how can i detect
automatically the type of image (pnd, jpeg,...) ? i do not want to
check the extension because this is easily faked... just by renaming
it.

Does it exist a technique for that ?

thanks a lot,


Hi,

unfortunately mime_content_type() does not work for me.

Tim:

It should, but instead try this:

$image_size = getimagesize($filename);
echo $image_size['mime'];


$image_size['mime'] ? Where did that come from?

From the manual:

"Returns an array with 4 elements. Index 0 contains the width of the image in pixels. Index 1 contains the height. Index 2 is a flag indicating the type of the image: 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15 = WBMP, 16 = XBM. These values correspond to the IMAGETYPE constants that were added in PHP 4.3.0. Index 3 is a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag."

So it should be $image_size[2], or has something changed that I don't know about?

Ed

--- End Message ---
--- Begin Message ---
On 4/28/07, Edward Vermillion <[EMAIL PROTECTED]> wrote:

On Apr 28, 2007, at 6:54 AM, tedd wrote:

> At 2:10 AM +0200 4/28/07, Tim wrote:
>> On 21.04.2007 12:45, Alain Roger wrote:
>>> Hi,
>>>
>>> In my web application, end user is able to load images (png, jpeg,
>>> gif,..) into database. I would like to know how can i detect
>>> automatically the type of image (pnd, jpeg,...) ? i do not want to
>>> check the extension because this is easily faked... just by renaming
>>> it.
>>>
>>> Does it exist a technique for that ?
>>>
>>> thanks a lot,
>>>
>>
>> Hi,
>>
>> unfortunately mime_content_type() does not work for me.
>
> Tim:
>
> It should, but instead try this:
>
> $image_size = getimagesize($filename);
> echo $image_size['mime'];
>

$image_size['mime'] ? Where did that come from?

 From the manual:

"Returns an array with 4 elements. Index 0 contains the width of the
image in pixels. Index 1 contains the height. Index 2 is a flag
indicating the type of the image: 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF,
5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte
order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15
= WBMP, 16 = XBM. These values correspond to the IMAGETYPE constants
that were added in PHP 4.3.0. Index 3 is a text string with the
correct height="yyy" width="xxx" string that can be used directly in
an IMG tag."

So it should be $image_size[2], or has something changed that I don't
know about?

Ed


Did you read the line just above example 935?
" mime is the correspondant MIME type of the image. This information
can be used to deliver images with correct the HTTP Content-type
header: "

Tijnema

--- End Message ---
--- Begin Message ---
At 9:22 AM -0500 4/28/07, Edward Vermillion wrote:
It should, but instead try this:

$image_size = getimagesize($filename);
echo $image_size['mime'];


$image_size['mime'] ? Where did that come from?

I duno, maybe the manual.

http://us2.php.net/getimagesize   <-- 5th or 6th example down.

Also, try this:

http://xn--nvg.com/image_data

Cheers,

tedd

PS: If your browser chokes, get a better browser.

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On 28.04.2007 10:39, Tijnema ! wrote:
First of all, i don't see any reason why this works better then other
functions, as it also relies on the magic bytes.

Second, for your switch, you should use the constants
(IMAGETYPE_GIF,IMAGETYPE_JPEG,...) instead of just using decimal
values.

Tijnema

Yes, I wrote this function because none of the others worked for me
properly. I found functions which determined the file type by a given
extension. Those file types can be easily faked by using an other extension.
I wrote the function a long time ago and was using PHP 4. The IMAGETYPE
constants are available since PHP 4.3.0.

It should, but instead try this:

$image_size = getimagesize($filename);
echo $image_size['mime'];

I needed a way to get the correct extension of an image file.
It is possible to create an array with all MIME types and the matching
extensions. Then you just have to search for $image_size['mime'] in it and you have correct extension. As I see there is a way,
which is a lot easier: You can use $image_size[2] which is a flag
indicating type of the image.

1 = GIF
2 = JPG
3 = PNG
4 = SWF,
5 = PSD
6 = BMP
7 = TIFF(intel byte order)
8 = TIFF(motorola byte order)
9 = JPC
10 = JP2
11 = JPX
12 = JB2
13 = SWC
14 = IFF
15 = WBMP
16 = XBM

Since PHP 4.3.0 you can use constants.

I reckon
  $type = exif_imagetype($filename);
is the same as
  $image_size = getimagesize($filename);
  $type = $image_size[2];

exif_imagetype would have to be faster than getimagesize because it only
gets the file type. getimagesize does also get the width/height, MIME
type, etc. I think getimagesize depends on exif_imagetype and will work even if exif is disabled, but I am not sure.

Tim

--- End Message ---
--- Begin Message ---
On 4/28/07, Micky Hulse <[EMAIL PROTECTED]> wrote:
Hi,

I pieced-together a script that will insert a string into another string
at a set interval of words... See here:

<http://www.ambiguism.com/sandbox/truncate/truncate.php>

[Click the "view source" link to view source.] :D

Basically, I need a setup a page where my client can paste an article,
automate the insertion of a template tag (in this case: {page_break})
and then copy/paste into the blog/cms. My goal for this script was to
make it easy for the CMS to create word-balanced pages.

Long story short, I got what I think will be an acceptable script... but
I would love to get feedback. What do you think? What can I improve?
What am I doing wrong?

The script does not need to be super-robust, but would love to hear what
the PHP gurus have to say. ;)

Many thanks in advance!
Cheers,
Micky


Nice idea, but it seems that it isn't working correctly. I did this example:
<?php
for($x = 0; $x < 100; $x++) { $string .= " abc"; }
echo break_up($string, 10, "||");
?>
With your break_up function. It results this:
abc abc abc abc abc abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc
abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc
abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc

While i expected this:
abc abc abc abc abc abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc abc

||abc abc abc abc abc abc abc abc abc abc

And i found where the problem is, it is this line:
$num += $num; // Set next number flag to look for.
This works only for one time, but after that, it doubles whole time,
so in above example, $num would go like this:
10
20
40
80

So to fix, replace this part of the code:

 for($i=0; $i < count($array); $i++) {
       # For every string in the array, we make one more test to
assure it is a word.
       # We assume that are words only strings that contain at least
a letter character (we will not count commas for example).
       # Checks for existence of letter characters, including the
special characters and increments the number of words if found.
       if(eregi('[0-9A-Za-zÀ-ÖØ-öø-ÿ]', $array[$i])) {
           if($words == $num) {
               $hldr[$up++]; // $num flag met, add one to $hldr array.
               $num += $num; // Set next number flag to look for.
           } else {
               $hldr[$up] .= $array[$i].' '; // $num flag not met
yet, insert a space.
           }
           $words++;
       }
   }

with this:
 $look = $num
 for($i=0; $i < count($array); $i++) {
       # For every string in the array, we make one more test to
assure it is a word.
       # We assume that are words only strings that contain at least
a letter character (we will not count commas for example).
       # Checks for existence of letter characters, including the
special characters and increments the number of words if found.
       if(eregi('[0-9A-Za-zÀ-ÖØ-öø-ÿ]', $array[$i])) {
           if($words == $look) {
               $hldr[$up++]; // $num flag met, add one to $hldr array.
               $look += $num; // Set next number flag to look for.
           } else {
               $hldr[$up] .= $array[$i].' '; // $num flag not met
yet, insert a space.
           }
           $words++;
       }
   }

That's it.

Tijnema

--- End Message ---
--- Begin Message --- Tijnema! Thanks for the quick reply! I really really really appreciate the help. :D

Tijnema ! wrote:
Nice idea, but it seems that it isn't working correctly. I did this example:
<?php
for($x = 0; $x < 100; $x++) { $string .= " abc"; }
echo break_up($string, 10, "||");
?>
With your break_up function. It results this:
...<snip>...
While i expected this:
...</snip>...

Ahhhhhh! Great way to test this!

I thought I noticed a problem, but did not put two-and-two together due to the huge string I was using... The way you simplified things really made that error clear. Thanks for the help on this! :)

And i found where the problem is, it is this line:
$num += $num; // Set next number flag to look for.
This works only for one time, but after that, it doubles whole time,
so in above example, $num would go like this:
10
20
40
80

Doh! Great catch! I should have printed that var out... Hehe, I am such a noob!

So to fix, replace this part of the code:
...<snip>...
with this:
...<snip>...
That's it.

Woot! Looks good to me. I moved the script to a new location with a more fitting name:

<http://www.ambiguism.com/sandbox/insert/insert.php>

Your test code is at bottom of that page. ;)

Nice, I am stoked! Thanks again for the help, I owe you one. :D

Have a great day/night,
Cheers,
Micky


--
Wishlists: <http://snipurl.com/1gqpj>
   Switch: <http://browsehappy.com/>
     BCC?: <http://snipurl.com/w6f8>
       My: <http://del.icio.us/mhulse>

--- End Message ---
--- Begin Message --- Just FYI, I did some slight upgrades/updates to the code... Seems to be working pretty good now. :)

<http://www.ambiguism.com/sandbox/insert/insert.php>

Thanks again Tijnema!

Cheers,
Micky



--
Wishlists: <http://snipurl.com/1gqpj>
   Switch: <http://browsehappy.com/>
     BCC?: <http://snipurl.com/w6f8>
       My: <http://del.icio.us/mhulse>

--- End Message ---
--- Begin Message ---
On 4/28/07, Micky Hulse <[EMAIL PROTECTED]> wrote:
Just FYI, I did some slight upgrades/updates to the code... Seems to be
working pretty good now. :)

<http://www.ambiguism.com/sandbox/insert/insert.php>

Thanks again Tijnema!

Cheers,
Micky


I think i found another problem in your script, when i set the word
count to 2, with your example test, at some point there is this:
(separator = || )
||Vestibulum urna.

<h6>Test

||header</h6>

Nam egestas

||rhoncus nisl.

This occurs because you count a word starting with < not as a word,
but since there's no space between > and Test, Test isn't recognized
as a word either.
So you should want to use strip_tags on every word, but only on inside
the eregi function. So like this:
if(eregi('[0-9A-Za-zÀ-ÖØ-öø-ÿ]', $array[$i])) {
becomes:
if(eregi('[0-9A-Za-zÀ-ÖØ-öø-ÿ]', strip_tags($array[$i]))) {
That would fix it :)

Tijnema

--- End Message ---
--- Begin Message ---
Tijnema! You rock! Another great catch. :)

Tijnema ! wrote:
...<snip>...
the eregi function. So like this:
if(eregi('[0-9A-Za-zÀ-ÖØ-öø-ÿ]', $array[$i])) {
becomes:
if(eregi('[0-9A-Za-zÀ-ÖØ-öø-ÿ]', strip_tags($array[$i]))) {
That would fix it :)

Just updated the code. (Hehe, tis hard to catch those zzZZzz's when my mind is thinking in code.)

<http://www.ambiguism.com/sandbox/insert/insert.phps>

Has anyone told you that you are a very good beta tester! :D

I hope I did it right... Looks like I may still be having the same problems (word count = "2", and separator = "| |":


| |Vestibulum urna.

<h6>Test

| |header</h6>

Nam egestas

| |rhoncus nisl.


Hmmm, going to stare at this code for a bit... Many thanks again for your help -- it really helps having that second pair of eyes.

I will post again if I significantly update the code. ;)

Thanks Tijnema! I really appreciate your time, help, and expertise.

Cheers,
Micky

--
Wishlists: <http://snipurl.com/1gqpj>
   Switch: <http://browsehappy.com/>
     BCC?: <http://snipurl.com/w6f8>
       My: <http://del.icio.us/mhulse>

--- End Message ---
--- Begin Message ---
On 4/28/07, Micky Hulse <[EMAIL PROTECTED]> wrote:
Tijnema! You rock! Another great catch. :)

Tijnema ! wrote:
> ...<snip>...
> the eregi function. So like this:
> if(eregi('[0-9A-Za-zÀ-ÖØ-öø-ÿ]', $array[$i])) {
> becomes:
> if(eregi('[0-9A-Za-zÀ-ÖØ-öø-ÿ]', strip_tags($array[$i]))) {
> That would fix it :)

Just updated the code. (Hehe, tis hard to catch those zzZZzz's when my
mind is thinking in code.)

<http://www.ambiguism.com/sandbox/insert/insert.phps>

Has anyone told you that you are a very good beta tester! :D

I hope I did it right... Looks like I may still be having the same
problems (word count = "2", and separator = "| |":


| |Vestibulum urna.

<h6>Test

| |header</h6>

Nam egestas

| |rhoncus nisl.


Hmmm, going to stare at this code for a bit... Many thanks again for
your help -- it really helps having that second pair of eyes.

I will post again if I significantly update the code. ;)

Thanks Tijnema! I really appreciate your time, help, and expertise.

Cheers,
Micky

Well, i found another thing, it's not really a bug, but you're using
eregi, which is a case insensitive function, and you're trying to find
a match for A-Z (ABCD...XYZ) and a-z (abcd...xyz), but they are both
the same, because you're using an case insensitive function. So you
could simplify your code a little bit to remove the double things.

Didn't find anymore bugs yet, maybe later... if i find one i'll let you know :)

Tijnema

--- End Message ---
--- Begin Message ---

On Apr 27, 2007, at 8:24 PM, Daevid Vincent wrote:

For a long time I've wanted a tool that would traverse my source code to
find all those little forgotten "TODO" entries.


[snip]

Doesn't phpDocumentor (http://phpdocu.sourceforge.net/) do that already?

Ed

--- End Message ---
--- Begin Message ---
Daevid Vincent wrote:
For a long time I've wanted a tool that would traverse my source code to
find all those little forgotten "TODO" entries.
It should handle most all kinds (as you'll see if you look at the example
files). The only one I didn't bother with was:
$foo = 1; //Todo: [dv] I meant todo this later. notice the 'todo' in there. it confuses my script. simple solution is just
spell it out as 'to do', which is proper English anyways!
I give you a fairly simple but useful tool that does just that. The output
can be command line (preferred way) or CSV so you can easily parse it into a
web page. I provided an example of how to do that. The web version of course
could be made much more interesting, with hyperlinks to the files, color,
etc, but I wanted to keep it simple for illustration purposes.
http://daevid.com/examples/todo/ Having said that, you should download it and try it for yourself. ./todo.php --path ./example --parse_tree ./todo.php --help for more options It's all in a single todo.php file so it's easy to add to /usr/local/bin or whatever. The tgz is really only for the examples. ÐÆ5ÏÐ P.S. While you're there, I'll give a plug to my DHCP web tool. Perfect for
seeing who's on your LAN.
http://daevid.com/examples/dhcp/
It would be nice if you added a flag for parsing 'FIXME' entries too. Quite a lot of source I've read contains 'TODO' and 'FIXME', often with little variation between meanings. Just my $0.02.

Alexander

--- End Message ---
--- Begin Message ---
Users log into web site in a sudo phpbb login which works fine.

Users are able to browse around phpbb and a sudo phpbb program called
photopost.

 

But when the goto a differen't part of the site which is not phpbb related,
the sessionid does not carry over.

 

The other pages are calling on the same isset variable???

This is blowing my mind for weeks now!!!

Would some kind code help a frazzed brother out?

 

Sincerely,

Brad

[EMAIL PROTECTED]

 

 

First is the login page

 

define("IN_LOGIN", true);

 

define('IN_PHPBB', true);

$phpbb_root_path = './';

include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path .
'common.'.$phpEx); session_start();

 

//checking whether the user is logged in or nor and redirecting accordingly

if(isset($_GET["forum"]))

{

      if(!isset($_SESSION["userid"]))

      {

            header("location:index.php");

      }

}

//

// Set page ID for session management

//

 

 

Now the code from the page that it DOES NOT carry to and starts a new
session:

 

 

 

 

 

<?php

      ob_start();

 

      session_start();

 

 

 

      header("Cache-control: private");

      require("includes/configure.php");

      $conn=mysql_connect(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD);

      mysql_select_db(DB_DATABASE) or die(mysql_error().": database not
available");                  

      $show="no";

      if(isset($_SESSION['userid']) && $_SESSION['userid']!="")

            $show="yes";

$contestid=$_REQUEST[cid];

$contestid = $_GET[cid];

if ($contestid == 0){

$contestid = $_POST[cid];

}

$contestid=$_REQUEST[cid];

 

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

<html xmlns="http://www.w3.org/1999/xhtml";>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function textCounter(field, countfield, maxlimit) { if (field.value.length >
maxlimit) field.value = field.value.substring(0, maxlimit); else
countfield.value = maxlimit - field.value.length; } // End --> </script>
<head> <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />

<title>.: Color Me Gorgeous</title>

<link href="colorme.css" rel="stylesheet" type="text/css" /> <STYLE
TYPE="text/css"> a:link { color: blue; text-decoration: underline } a:active
{ color: red; text-decoration: none } a:visited { color: blue;
text-decoration: underline } a:hover { color: blue; text-decoration:
underline } </STYLE> <style type="text/css"> .msgtext {

      font-family: Verdana, Arial, Helvetica, sans-serif;

      font-size: 12px;

      color:#FF0000;

      text-align:center;

      font-weight:bold;

}

.style1 {font-size: 12px}

</style>

<script type="text/JavaScript">

<!--

function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
x.src=x.oSrc; }

 

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

 

function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x; }

 

function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array;
for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc)
x.oSrc=x.src; x.src=a[i+2];} } function checkSession() {

      if(document.form1.txt_comment.value=="")

      {

            alert("Please enter Comment");

            document.form1.txt_comment.focus();

            return false;

      }

      <?php if(!isset($_SESSION['userid']) && $_SESSION['userid'] == "")

      { ?>

      alert("You must first login to Post Comment");

      return false;

      <?php } else { ?>

 
document.form1.action="operation.php?mode=checksession&pid="+document.form1.
pid.value+"";

      document.form1.submit();

      return true;

      <?php } ?>

}

function logincheck()

{

      if(document.frm.txtusername.value=="")

      {

            alert("Please Enter Username.");

            document.frm.txtusername.focus();

            return false;

      }

      if(document.frm.txtpwd.value=="")

      {

            alert("Please Enter Password.");

            document.frm.txtpwd.focus();

            return false;

      }

      document.frm.login.value="Success";

      document.frm.action="operation.php?mode=login";

      document.frm.submit();

      return true;

}

function showlogin()

{

      document.getElementById("tbllogin").style.visibility="visible";

      document.frm.txtusername.focus();

}

//-->

</script>

</head>

 

<body
onload="MM_preloadImages('images/home_b_h.jpg','images/about_b_h.jpg','image
s/forum_b_h.jpg','images/photo_gallery_b_h.jpg','images/protfolio_b_h.jpg','
images/crictic_b_h.jpg','images/contest_b_h.jpg','images/contact_b_nhjpg','i
mages/contact_b_h.jpg')">

<table width="779" border="0" align="center" cellpadding="0"
cellspacing="0">

  <?php include_once("header1.php") ?>

  <tr>

    <td><img src="images/header_bottom.jpg" width="779" height="8"  alt=""
/></td>

  </tr>

</table>

<table width="779" border="0" align="center" cellpadding="0" cellspacing="0"
class="centerbg">

  <tr>

    <td width="558" align="left" valign="top"><table width="100%" border="0"
cellspacing="0" cellpadding="0">

      <tr>

        <td height="68" align="left" valign="bottom" ><table width="100%"
border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td><img src="images/inner_top.jpg" width="559" height="68" /></td>

    <td><img src="images/right_img.jpg" width="221" height="68" /></td>

  </tr>

</table></td>

      </tr>   

      <tr>

        <td height="15" align="center" valign="middle">

            

            

 

<div align="center" class="style1"></div> <table width="558" border="0"
align="center" cellpadding="0" cellspacing="0">

  <tr>

  <td><strong>&nbsp;&nbsp;Contest Entries </strong><br /> <?
if(isset($_POST['Submit'])) { ?>

  <div align="center"><strong>Entry submitted!</strong></div>

  <? 

  }

  ?></td>

  </tr>

  <tr>

   

    <td align="center" valign="top"><table width="760" border="0"
cellpadding="0" cellspacing="0">

        <tr>

          <td width="760" align="center"><table width="760" border="0"
cellspacing="0" cellpadding="0">

            <tr>

              <td colspan="2">

                    <?php if($_POST['hiddensubmit']){

if (!$_POST['story']){

echo "<font color=\"red\">please feel out the form before hitting
submit</a><br>"; } else { //Varify that only one entry per user per contest

            $get_count5 = mysql_query("SELECT * FROM `contest_stories` WHERE
contest_id = '".$_POST['cid']."' AND year='2007'  AND username
='".$_SESSION["userid"]."'");   

            $startcount5 = mysql_num_rows($get_count5);

            

            if($startcount5 < 3){

 

$query2 = mysql_query("INSERT INTO contest_stories SET
contest_id='".$_POST['cid']."', year='2007' ,story='".$_POST['story']."',
time='" . time() . "', username='".$_SESSION["userid"]."', approved='1'");
$contestid = $_POST['cid'];

        }else{

echo "<font color=\"red\">You can only submit 3 stories per
contest.</a><br>";

        }

    }

}

 

    

      

            

            

/*

 

$vara=$_REQUEST['increment'];

if($vara!="") {$increment=10*$vara-10;}

else {$increment=0;}

$cer=mysql_query("SELECT * FROM contest_stories WHERE approved = 1 AND
year='2007' AND contest_id = '".$contestid."' ORDER BY time DESC ");
$linii=mysql_num_rows($cer); $rez=$linii/10;

$linii=round($linii/10);            

if($rez>$linii) $linii+=1;

 

$query = mysql_query("SELECT * FROM contest_stories WHERE approved = 1 AND
year='2007' AND contest_id = '".$contestid."' ORDER BY time DESC LIMIT
$increment , 10");

 

?></td>

            </tr>

 

            <tr>

              <td colspan="2">

                    <table width="760" align="center" cellpadding="6"
cellspacing="20">

                    <?php

                    

                    while ($row = mysql_fetch_array($query)){

                        

                    echo "<tr >

              <td style=\"border-style:solid;\" style=\"border-width:1px;\"
style=\"border:#12B683;\"><div align=\"left\"
style=\"vertical-align:top;\"><strong>Posted by ".$row['username']."&nbsp;";


      

                    

                  

                    echo "<br /><br /></div><div
align=\"left\">".$row['story']."<br /><br /></div>";

                  

                        

                        }

                        ?>                      </table></td>

              </tr>

            <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<strong>Page <? 

                  $page=$_REQUEST['page'];

                  if($page=="") $page=1;

                  echo $page; ?></strong></td>

                  <td>

                  <? 

                  for($i=1;$i<=$linii;$i++)

                  {

                  ?>

                  &nbsp;&nbsp;&nbsp;<a href="contest_storiesm.php?cid=<?
echo $contestid;?>&increment=<? echo $i;?>&page=<? echo $i;?>"><? echo $i;
?></a>

                  <?

                  }

                  ?>

                  </td>

            </tr>

                  <?php

                  

                  */

                        if(!isset($_SESSION["userid"]))

                        {

                        ?>

            

                  <tr>

              <td colspan="2"><div align="left"><br /><br
/><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Login to submit your contest
entry!</strong></div></td>

              </tr>

                    <?php

                        }

                        else

                        {

                        ?>

                     <tr>

              <td colspan="2"><div align="left"><br /><br />

              <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Submit your entry
into the contest. </strong></div></td>

              </tr>

            <tr>

              <td width="125"><div align="right">&nbsp;</div></td>

              <td width="433">

                  <label>

                  <div align="left">&nbsp;</div>

                  </label>              </td>

            </tr>

            <form id="form2" name="form2" method="post"
action="contest_storiesm.php?cid=<?php echo $contestid ?>">

                  <tr>

              <td height="62" colspan="2">

                <div align="center"><span class="style1">( You may enter up
to 1600 characters. )</span><br>

                  <textarea name="story" maxlength="1600"
style="width:500px;" rows="5"
onKeyDown="textCounter(this.form.story,this.form.remLen,1600);"
onKeyUp="textCounter(this.form.story,this.form.remLen,1600);"></textarea>

 <br>

<input readonly type=text name=remLen size=4 maxlength=4 value="1600"> 

<span class="style1">characters left                </span></div></td>

              </tr>

            <tr>

              <td colspan="2" align="center"><label>

                    <div align="right"><br />

                              <input type="hidden" name="hiddensubmit"
value="3" />

                              <input type="hidden" name="cid" value="<?php
echo $contestid ?>" />

                      <input type="submit" name="Submit" value="Submit"
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</div>

                    </label>               </td>

              </tr></form>

           <?php

                        }

                        ?>  

 

          </table></td>

        </tr>

            </table>      </td>

  </tr>

</table>

 

            

            

            

            </td>

      </tr>

            

    </table></td>

      </tr>

  <tr><td align="right"><a title="Top" href="#"><img
src="images/top_button.jpg" width="81" height="21"  alt=""  border="0"
/></a></td></tr>

  <tr><td align="right" height="10"></td></tr> </table>

 

<?php include_once("footer.php") ?>

</body></html>

 

 


--- End Message ---
--- Begin Message ---
On 4/28/07, Brad Sumrall <[EMAIL PROTECTED]> wrote:
Users log into web site in a sudo phpbb login which works fine.

Users are able to browse around phpbb and a sudo phpbb program called
photopost.



But when the goto a differen't part of the site which is not phpbb related,
the sessionid does not carry over.



The other pages are calling on the same isset variable???

This is blowing my mind for weeks now!!!

Would some kind code help a frazzed brother out?



Sincerely,

Brad

[EMAIL PROTECTED]





<snip>

Really cool that code, but do you think really that someone takes the
time to read it all? You should only post the most important parts.

And how are you're files organized? is that "other part" on a
(another) subdomain?

Tijnema

--- End Message ---

Reply via email to