f



Establishing PHP session ID in an included file

Forgive me if this doesn't make too much sense but I've been working on this
project all day and my brain is a bit fried.

To make some of my code more readable I made a file (called urls.inc) which
I include in my PHP scripts.  This file contains functions to return a URL
with the session id tagged on the end.  I've now found out that the session
id returned by the functions in urls.inc is not necessarily the current, and
more importantly correct, session id.  I need to know if there is a way to
establish the current session id within the included file.

For info, I've built the scripts so that the session id is passed from page
to page to avoid using cookies (part of the challenge, it's a college
project) so I need the urls.inc file to know which session id to pass back
otherwise it all goes a bit squiffy.

Here's urls.inc :

<?php

session_start();

function logoutURL()
{
  return "logout.php?PHPSESSID=" . session_id();
}

function adminURL()
{
  return "admintools.php?PHPSESSID=" . session_id();
}

function homeURL()
{
  return "main.php?PHPSESSID=" . session_id();
}

?>

These are called like this :
echo "<h3 align=\"center\"><a href=\"" . adminURL() . "\"
target=\"mainFrame\">Administration Tools</a></h3>";

If it turns out that there's no way to do what I'm after then it's not big
deal because I can change the URL line to :
echo "<h3 align=\"center\"><a href=\"admintools.php?PHPSESSID=" .
session_id() . "\" target=\"mainFrame\">Administration Tools</a></h3>";

I just wanted to show some initiative and keep the code as tidy and as
possible.

Thanks for any help,

Pete.


0
Peter
8/1/2004 8:58:30 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

3 Replies
826 Views

Similar Articles

[PageSpeed] 5

"Peter Redding" <skredding_NOSPAM_@.netscape.net> wrote in
message
news:WPcPc.21359$a8.6881@fe2.news.blueyonder.co.uk...
> Forgive me if this doesn't make too much sense but I've
been working on this
> project all day and my brain is a bit fried.
>
> To make some of my code more readable I made a file
(called urls.inc) which
> I include in my PHP scripts.  This file contains functions
to return a URL
> with the session id tagged on the end.  I've now found out
that the session
> id returned by the functions in urls.inc is not
necessarily the current, and
> more importantly correct, session id.  I need to know if
there is a way to
> establish the current session id within the included file.
>
> For info, I've built the scripts so that the session id is
passed from page
> to page to avoid using cookies (part of the challenge,
it's a college
> project) so I need the urls.inc file to know which session
id to pass back
> otherwise it all goes a bit squiffy.
>
> Here's urls.inc :
>
> <?php
>
> session_start();
>
> function logoutURL()
> {
>   return "logout.php?PHPSESSID=" . session_id();
> }
>
> function adminURL()
> {
>   return "admintools.php?PHPSESSID=" . session_id();
> }
>
> function homeURL()
> {
>   return "main.php?PHPSESSID=" . session_id();
> }
>
> ?>
>
> These are called like this :
> echo "<h3 align=\"center\"><a href=\"" . adminURL() . "\"
> target=\"mainFrame\">Administration Tools</a></h3>";
>
> If it turns out that there's no way to do what I'm after
then it's not big
> deal because I can change the URL line to :
> echo "<h3 align=\"center\"><a
href=\"admintools.php?PHPSESSID=" .
> session_id() . "\" target=\"mainFrame\">Administration
Tools</a></h3>";
>
> I just wanted to show some initiative and keep the code as
tidy and as
> possible.
>
> Thanks for any help,
>
> Pete.
>
>


Hey Pete,

A couple things: First I think PHP 4.x and higher suggest
using the $_SESSION global array

    $_SESSION ['session_id']

Second, if I read
http://us2.php.net/manual/en/ref.session.php correctly, then
you would have a new session id every time you run the app
because you have never set a session variable.


In general you want to do something like this:

web page 1:
session_start();
$_SESSION['some_session_var'] = "This variable is now set -
was done so with session_id = ".$_SESSION['session_id'];

web page 2:
session_start();
$temp = $_SESSION['some_session_var'];

print " 'some_session_var' was previous set to '$temp'";
print " <br>The session_id is now ".
$_SESSION['session_id'];


-CF



0
deja696 (62)
8/2/2004 12:27:39 PM
"ChronoFish" <deja@chronofish.com> wrote in message
news:2rqPc.18425$cv5.3480@lakeread07...

<Snip my previous post>

> Hey Pete,
>
> A couple things: First I think PHP 4.x and higher suggest
> using the $_SESSION global array
>
>     $_SESSION ['session_id']
>
> Second, if I read
> http://us2.php.net/manual/en/ref.session.php correctly, then
> you would have a new session id every time you run the app
> because you have never set a session variable.
>
>
> In general you want to do something like this:
>
> web page 1:
> session_start();
> $_SESSION['some_session_var'] = "This variable is now set -
> was done so with session_id = ".$_SESSION['session_id'];
>
> web page 2:
> session_start();
> $temp = $_SESSION['some_session_var'];
>
> print " 'some_session_var' was previous set to '$temp'";
> print " <br>The session_id is now ".
> $_SESSION['session_id'];
>
>
> -CF

First things first : Now that my brain is slightly less frazzled today I can
tell you that I am using PHP 4.3.7 on Apache 2 under Mandrake Linux 8.2.

I am passing through the session id via the URL into the second page (and so
on) and use session_start() in subsequent pages so that means that it
doesn't start a brand new session with a new session id and allows me access
to all my previously stored session variables (unless I unset them or
destroy the session).  At least that is my understanding and that is what
has been happening.

So is session_id() now superseded by $_SESSION['session_id']?  Not that it
seems to make much difference as session_id() is still working for me but if
using the other method is recommended then I would change my code.

For info, I tried to pass through the session id into the function call,
store it in a local variable and return it with the URL but it didn't seem
to work (the session id returned was still different to the session id in
some hard coded URLs).  As I said previously I was just trying to show some
initiative but I'll probably just hard code the URLs in for now as I don't
want to get hung up on something which is trivial in comparison to some of
the other things I have done (and I am running out of time!!!).

Thanks again,

Pete.


0
Peter
8/2/2004 5:35:41 PM
<SNIP>

> First things first : Now that my brain is slightly less frazzled today I
can
> tell you that I am using PHP 4.3.7 on Apache 2 under Mandrake Linux 8.2.
>
> I am passing through the session id via the URL into the second page (and
so
> on) and use session_start() in subsequent pages so that means that it
> doesn't start a brand new session with a new session id and allows me
access
> to all my previously stored session variables (unless I unset them or
> destroy the session).  At least that is my understanding and that is what
> has been happening.
>
> So is session_id() now superseded by $_SESSION['session_id']?  Not that it
> seems to make much difference as session_id() is still working for me but
if
> using the other method is recommended then I would change my code.
>
> For info, I tried to pass through the session id into the function call,
> store it in a local variable and return it with the URL but it didn't seem
> to work (the session id returned was still different to the session id in
> some hard coded URLs).  As I said previously I was just trying to show
some
> initiative but I'll probably just hard code the URLs in for now as I don't
> want to get hung up on something which is trivial in comparison to some of
> the other things I have done (and I am running out of time!!!).
>
> Thanks again,
>
> Pete.
>

Okay, I've had one of those "Now it works, but should it?" experiences.  The
problem arose in the first bit I tested so I assumed that I couldn't do what
I was trying, period.  However, the part that I was testing was a set of
search results from a database based on criteria posted from a form on a
separate page.  When the form was posted to the searchresults.php page I
wasn't passing through the session id but as soon as I added that to the URL
in the action part of the form, it worked.

Now the session id is the same when returned from urls.inc as it is if I
"hard code" it in to the script using "<URL>.php?PHPSESSID=" . session_id()
so it seems as though the included file will pick up the correct session
details and as it works, I'm not going to fiddle with it anymore.

If only I'd tested another bit first....


0
Peter
8/2/2004 5:53:15 PM
Reply:

Similar Artilces:

Is a PHP variable supposed to be seen in a .js file included into a .php file
Is a PHP variable supposed to be seen in a .js file included into a .php file? I have a client side javascript code stored in a .js file which is included into a PHP file using <script src="filename.js></script> This code initialises a Javascript variable var u="string"; The string is supposed to be the value of $HTTP_HOST So, when initialise this variable like var u=<? echo $HTTP_HOST;?>; I sterted getting a javascript message Syntax Error Am I doing something wrong, or PHP variables are not seen in included js files? aa wrote: > Is a PHP variable supposed to be seen in a .js file included into a .php > file? > > I have a client side javascript code stored in a .js file which is included > into a PHP file using > <script src="filename.js></script> > > This code initialises a Javascript variable > var u="string"; > > The string is supposed to be the value of $HTTP_HOST > > So, when initialise this variable like > > var u=<? echo $HTTP_HOST;?>; > > I sterted getting a javascript message Syntax Error > > Am I doing something wrong, or PHP variables are not seen in included js > files? js files are not parsed for PHP code unless you specifically tell the webserver to do so. Therefore, "var u=<? echo $HTTP_HOST;?>;" in the .js will error since the browser doesn't know what to do. -- Justin Koivisto - spam@koiv...

Parsing a php include (which also contains php code)
Hello, I am using the <?php include() ?> statement on my website for organizational purposes. However, one of my includes contains some PHP code. Is there any way for the server to actually parse the include? I've tried this before, and it did not parse the include. Rather, it included the file as just plain ASCII. ======================= /*EXAMPLE 1*/ /*index.php*/ .... <?php include('global/includes/footer.inc') ?> .... /*footer.inc*/ .... <p>&copy 1993-<?php echo date("Y") ?> Kingswood School. All rights reserved.</p> .... /*EXAMPLE 2*/ /*index.php*/ .... <?php include('global/includes/lastmod.php') ?> .... /*lastmod.php*/ .... <?php echo "This file was last modified: "; echo strftime("%A %B %d %Y"); include('whateverfilename.inc'); ?> ============================= I would like to be able to parse the include if it has php code, and in some cases, create nesting includes (an include within an include). Is this even possible? Any ideas? Any help is certainly appreciated. Thanks! Steven Borrelli Web Developer Kingswood School Steven Borrelli wrote: > Hello, > > I am using the <?php include() ?> statement on my website for > organizational purposes. However, one of my includes contains some > PHP code. Is there any way for the server to actually parse the > include? I've tried this before, and it did not parse the in...

SSI Including PHP File Within PHP File Causes Seg Fault and Crash
Can somebody concur or verify the following? I'm having this problem on all of my installations. I've got Apache 2.0.40 and PHP 4.2.2 installed and configured from RedHat RPMs. Nothing out of the ordinary. In the httpd.conf file, PHP files are called with the following: <Files *.php> SetOutputFilter PHP;INCLUDES SetInputFilter PHP LimitRequestBody 524288 </Files> I create two files as follows: /test1.php <!--#include virtaul="/test2.php" --> and /test2.php Testing 1 2 3 By going to http://host/test1.php, it may or may not display the file contents of test2.php. Usually (9/10 times) I get a seg fault in the error log. If I change the filename of test.php to test.html and include that, it works fine. I've tried this on various versions of both Apache and PHP up to the most recent CVS versions and still get the same results. If somebody can help me out or concur my problem, I would much appreciate it. Arthur don't try to treat a .php file as an .shtml just do this <?php include("test2.php"); ?> -- Mike Bradley http://www.gzentools.com -- free online php tools "Arthur M. Kang" <arthur@levelogic.com> wrote in message news:UABWb.39235$QJ3.24102@fed1read04... > Can somebody concur or verify the following? I'm having this problem on all > of my installations. > > I've got Apache 2.0.40 and PHP 4.2.2 installed and configured from RedHat > RPMs. Nothin...

including a PHP file displays the file's content to the user agent (PHP 5.1)
Hi all I'm having a strange problem when upgrading the content management system eZ publish from PHP 4.4 to PHP 5.1. Some cache files related to i18n are included with the "include" function, but they are being displayed to the user agent instead of being parsed by PHP. With PHP 4.4 there was no problem. You can download a test script from: http://blog.kristofcoomans.be/wp-content/uploads/test.tar Thanks for your help Cheers -- Kristof Cyberwolf wrote: > Hi all > > I'm having a strange problem when upgrading the content management > system eZ publish from PHP 4.4 to PHP 5.1. Some cache files related to > i18n are included with the "include" function, but they are being > displayed to the user agent instead of being parsed by PHP. With PHP > 4.4 there was no problem. > > You can download a test script from: > http://blog.kristofcoomans.be/wp-content/uploads/test.tar > > Thanks for your help > > Cheers > > -- > > Kristof Do any other php pages parse properly? If not, then it will most likely be a problem with your install and/or configuration. If you can parse some php pages, it might be worth checking your PHP 5 configuration, and then Apache's configuration if nothing jumps out at you in there. Is there any particular reason you chose to go with PHP 5? I have heard of lots of people having problems with it, which is why I stay away from it. Well, until I understand it a bit better...

Failed opening required 'PEAR.php' (include_path='F:\www\include') in F:\Program Files\PHP\PEAR\Text\CAPTCHA.php on line 22
Hi, Guys=EF=BC=8Cwhen I run my site ,I got some errors: Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in F:\Program Files\PHP\PEAR \Text\CAPTCHA.php on line 22 Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path=3D'F:\www\include') in F:\Program Files \PHP\PEAR\Text\CAPTCHA.php on line 22 It appears that it cann't find the pear.php ,but i checked my dir,and this file was there,and also I have my php.ini file checked,the include_path=3Dinclude_path=3D".;F:\Program Files\PHP\pear;F:\www \include" ,it looks all right,was there anything I have missed in the config file?Or something wrong ? Wish somebody can help me out. Thanks, Mikay >Warning: require_once(PEAR.php) [function.require-once]: failed to >open stream: No such file or directory in F:\Program Files\PHP\PEAR >\Text\CAPTCHA.php on line 22 >Fatal error: require_once() [function.require]: Failed opening >required 'PEAR.php' (include_path='F:\www\include') in F:\Program Files >\PHP\PEAR\Text\CAPTCHA.php on line 22 So where is the pear.php file? >It appears that it cann't find the pear.php ,but i checked my dir,and >this file was there,and also I have my php.ini file checked,the >include_path=include_path=".;F:\Program Files\PHP\pear;F:\www >\include" ,it looks all right,was there anything I have missed in the >config...

Is this code looking good to exchange PHP session ID between Flash and PHP
Hi There Can some Flash guru tell me if this Flash code is OK to set / retrieve a cookie for exchange with PHP? stop(); var ses:string; //create the local Shared Object myLocalSO = sharedobject.getLocal("hookie" ); if(_root.destroy) { myLocalSO.data.name = "destroyed"; } else { //if cookie already exists then get ses from cookie if (myLocalSO.data.name.length == 32) { ses = myLocalSO.data.name; getURL("index.php", "_self", "GET"); } //if cookie does not exist then make it else { myLocalSO.data.name = _root.PHPSESSID; } ses = myLocalSO.data.name; getURL("voter.php", "_self", "POST"); } ...

PHP does not parse .PHP files
I have this problem with PHP that someone might be able to help. With CLI, I am able to execute my .php files. For example, if I type "php phpinfo.php" , this works fine on my system. If I put the phpinfo.php file is in /var/www/html and I try to access it through the browser, I get the content of the file and not the execution of the file. Instead of display the info of PHP, I got the text of the file as: <?php phpinfo(); ?> Why? Thanks Phong Ho wrote: >I have this problem with PHP that someone might be able to help. > >With CLI, I am able to execute my .php files. For example, if I type >"php phpinfo.php" , this works fine on my system. > >If I put the phpinfo.php file is in /var/www/html and I try to access >it through the browser, I get the content of the file and not the >execution of the file. Instead of display the info of PHP, I got the >text of the file as: > ><?php > phpinfo(); >?> > > >Why? >Thanks Do you have a webserver such as Apache running on the machine where you expect this to happen? Because it's the webserver, not the browser, that needs to know about php. The browser only does html. Margaret -- (To mail me, please change .not.invalid to .net, first. Apologies for the inconvenience.) "Phong Ho" wrote: > I have this problem with PHP that someone might be able to help. > > With CLI, I am able to execute my .php files. For exam...

File Permissions of PHP Session Files
Hi! I noticed that the file permissions (unix) of the PHP session files have only read and write permissions for the Apache process (600 or rw- --- ---). Does anyone have any idea where this permission is set ? I can't find any umask or chmod settings for it in the php.ini file. Can't find anything in the httpd.conf either. Is it set in the PHP code that implements session_start()? Thanks for any pointers Those files are created and modified by the the apache process, so you probably want the umask of that user (most likely "nobody"). Just out of curiosity, why do you need to change the permissions on those files? I was trying to write a bash script to be executed by cron to clean up old session files that were not properly removed, eg, when the user didn't do a proper logout which would have activated a session_destroy(). Apparently, the system (either PHP or apache) doesn't do 'garbage collection' of such files as part of its normal operation. Or am I missing something ? Spendwiser wrote: > I was trying to write a bash script to be executed by cron to clean up > old session files that were not properly removed, eg, when the user > didn't do a proper logout which would have activated a > session_destroy(). > > Apparently, the system (either PHP or apache) doesn't do 'garbage > collection' of such files as part of its normal operation. Or am I > missing something ? You are missing some...

I need to create html files from php files using php
I am very new to PHP, although I have been using ASP for a few years. I use a product in ASP called ASPTear, it's a small dll that my hosting company happens to have loaded. Basically you can set up a function that you can pass an ASP page to and it will read the ASP and write out an HTML file. I use this to save load on the server and speed up my site, I have a few include files that look up data and then present it, this data does not change very often, so I run a routine called rebuildhtml.asp that will call a few ASP files and create HTML versions. I am now converting the site to PHP as I want to use mod_rewrite, what I need is a routine that I can pass a php file to and end up with an HTML version. For example rewrite(somefile.php) Will create somefile.html I am sure this can't be too difficult, but as a newbie I cannot find out how to do it. Any help appriciated. Dennis Dennis wrote: > what > I need is a routine that I can pass a php file to and end up with an > HTML version. > > For example > > rewrite(somefile.php) http://www.php.net/ob_start Happy Coding :-) -- USENET would be a better place if everybody read: | to mail me: simply | http://www.catb.org/~esr/faqs/smart-questions.html | "reply" to this post, | http://www.netmeister.org/news/learn2quote2.html | *NO* MIME, plain text | http://www.expita.com/nomime.html | and *NO* attachments. | Dennis wrote: > I am now converti...

Open .php file with PHP Designer 2007 by clicking the file in XP
In windows XP, I want to be able to click on a .php file and have it opened in PHP Designer 2007, Or right-click on it and have an "edit" menu option presented to me. I know how to tweak the registry to do this in general, but what would the command line look like in this specific case ? PHP Designer does not do this automatically. It is as if the program does not allow commandline options. It only opens with the last file used or a menu of recently opened files. ...

want to get content of one php file in another php file
i have one php file having content Contents of ex1.php file <body> <?php $content = "c://webserver/www/abc.php"; $handle = fopen($content, "r"); echo fread($handle,filesize($content)); ?> </body> this is reading abc.php file in which i m simply using an echo statement. When i execute ex1.php file i cant see the php statement of abc.php file content of abc.php file is <?php echo "hello";?> sarika wrote: > i have one php file having content > > Contents of ex1.php file > <body> > <?php > $content = "c://webserver/www/abc.php"; > $handle = fopen($content, "r"); > echo fread($handle,filesize($content)); > ?> > </body> > this is reading abc.php file in which i m simply using an echo > statement. When i execute ex1.php file i cant see the php statement of > abc.php file > > content of abc.php file is > <?php echo "hello";?> That's interesting, I've found out that it's the browser that's hiding <?php ?> tags within .phpx pages. Probably to avoid short tags scripts (on a server that doesn't allow them) from getting leaked by visitors who don't know about this browser trick, until the dev' realizes his error. Not a good thing, IMO; dev's should take care, themselves, and it's still not secure since the hidden string is still in the rendered source. And now we don't know how ...

php assembly of multiple php files
I am trying to combine multiple php pages into 1. Basically I have created a shell page and then a seperate php file for each form to be included within the shell. The problem I am having is that when a user submits one of the forms the main shell and the other php files POST values are all returned as NULL and I only get the values pertaining to the form that was submitted?. If all the files were combined into one very long php file, I would get all the POSTs returned how can I do the same but with multiple files? When you submit an include, do the POST values not get passed back to the Main calling page? Thank you, QB Question Boy wrote: > I am trying to combine multiple php pages into 1. > > Basically I have created a shell page and then a seperate php file for > each form to be included within the shell. > > The problem I am having is that when a user submits one of the forms > the main shell and the other php files POST values are all returned as > NULL and I only get the values pertaining to the form that was > submitted?. If all the files were combined into one very long php > file, I would get all the POSTs returned how can I do the same but > with multiple files? > > When you submit an include, do the POST values not get passed back to > the Main calling page? > > Thank you, > > QB This has nothing to do with PHP - it's how HTML works. The browser will only send the data for the form being subm...

Including PHP arguments in... PHP Argument
I know the subject is a bit confusing, but I really need to know if this is possible. I've got a php page. Let's call that a.php In a.php, I make a call to a webpage (b.php), with some arguments (http://domain.com/b.php?abcd=1234&efgh=5678). Can I do something like this: http://domain.com/a.php?argument='abcd=1234&efgh=5678', then from a.php use $_GET['argument'] to use in the creation of the URL to call b.php? In other words, I want to include a php argument in a php argument. Is this possible? I'd prefer not to use seperate variables (i.e. http://domain.com/a.php?abcd=1234&efgh=5678) to forward it to b.php, but if it's not possible, I guess I'll have to. Thanks, iwp506@gmail.com > > I'd prefer not to use seperate variables (i.e. > http://domain.com/a.php?abcd=1234&efgh=5678) to forward it to b.php, > but if it's not possible, I guess I'll have to. > > Thanks, > iwp506@gmail.com > What you are trying to do is called 'indirection' in other languages i.e. $varb='$a=20'; execute $varb; echo $a; Result in '20' showing on the screen However I do not have enough knowledge to know if it is possible in php to do this. Sorry - googlin for 'php' and 'indirection' is throwing up a blank... it might be called somthing else in PHP. try using urlencode() function on the second url. look it up on the php manual. ex: $argument = urlencode(...

When does the php interpreter loads the php file?
Hi All, I'm wondering three facts about php, apache and apache module. 1.How can i differentiate the php intepreter if it's running as a apache module or as cgi? 2.When does the php interpretor loads the php file to main memory? 3.and till when it keeps the php file on memory? - in my experience only after installing Zend it caches the php file. Thak you *** Kim Gijung wrote/escribi� (20 Oct 2004 00:03:35 -0700): > 1.How can i differentiate the php intepreter if it's running as a > apache module or as cgi? If I recall correctly phpinfo() calls it "Server API". > 2.When does the php interpretor loads the php file to main memory? In a web page, when the file is requested. In a command line script, when the file is executed. > 3.and till when it keeps the php file on memory? Until the execution ends. > - in my experience only after installing Zend it caches the php > file. Right, if you aren't using a cache the file is not cached. -- -- �lvaro G. Vicario - Burgos, Spain -- Thank you for not e-mailing me your questions -- ...

How to invoke remote php file from php?
Hi, I have a local php file and I need to get info back from php file on the server. How do I invoke remote a php? I can access this remote php thru a simple url and it prints some info on the web page. How do I get this info back to store as a variable in local php? Regards, Alex. Alex wrote: > Hi, I have a local php file and I need to get info back from php file > on the server. How do I invoke remote a php? I can access this remote > php thru a simple url and it prints some info on the web page. How do I > get this info back to store as a variable in local php? > > Regards, > Alex. > See example 16-11 here: http://www.php.net/manual/en/function.include.php Alex wrote: > > I have a local php file and I need to get info back from php file > on the server. How do I invoke remote a php? I can access this remote > php thru a simple url and it prints some info on the web page. How do I > get this info back to store as a variable in local php? $info = file_get_contents('http://remoteserver.com/script.php'); Cheers, NC Carl & NC, Thank you very much!!! Both examples work great. Not precisely sure what you mean, something simple like this might do what you want: $contents = file_get_contents('http://www.site.com/alexs_page.php?param=1&id=2'); NC wrote: > Alex wrote: > >>I have a local php file and I need to get info back from php file >>on the server. How do I invoke remote a php? I...

Modify a php file(model) with php
I have an invoice model on my server! and i want to replace some field(like adresse, phone, price, VAT, ....) do you know a tools or class that allows those kind of manipulations Thanks you Yoni Yoni Alhadeff a �crit : > I have an invoice model on my server! and i want to replace some field(like > adresse, phone, price, VAT, ....) > > do you know a tools or class that allows those kind of manipulations > > Thanks you > > Yoni > > Couldn't you replace field with var and have them set when including your template (it become one in fact) ? I didn't understand good! I'm french speaker :p how can i replace field by var ? with a pdf that I make once at home! in my pdf i have line like this Adress: [Adr] Phone : [Tel] Number: [NBR] Article: [Article] And u want to replace the field under bracket! Thanks you Yoni "manu" <manu@netou.com> a �crit dans le message de news: 420e01ef$0$617$636a15ce@news.free.fr... > Yoni Alhadeff a �crit : > > I have an invoice model on my server! and i want to replace some field(like > > adresse, phone, price, VAT, ....) > > > > do you know a tools or class that allows those kind of manipulations > > > > Thanks you > > > > Yoni > > > > > Couldn't you replace field with var and have them set when including > your template (it become one in fact) ? ...

Quoting PHP code in a .php file???
I am new to PHP and I want to quote the followong content into a Web page <html> <head><title>Connect Server</title></head> <body> <? $link = mysql_connect("localhost",$_POST['username'],$_POST['password'])or die("Connect Error: ".mysql_error()); print "Successfully connected.\n"; mysql_close($link); ?> </body> </html> The Web page is generated by a xxx.php file and what I want to be q quote is executed rather than displayed. I have tried to surround it with block formatting HTML elements such as <blockquote> or <pre> but the PHP code surrounded by "<?" and "?>" always get executed and throws errors. How can I simply quote it and display it on the page? Thank yoy Georges Georges Trottier wrote [edited]: > How can I simply quote and display [HTML with PHP code] on the page? How do you get the contents you're trying to display? Try these: http://www.php.net/htmlentities http://www.php.net/highlight_file -- Mail to my "From:" address is readable by all at http://www.dodgeit.com/ == ** ## !! ------------------------------------------------ !! ## ** == TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>) may bypass my spam filter. If it does, I may reply from another address! Georges Trottier wrote: > <html> > <head><title>Connect Serve...

Getting an included PHP script to to include a file in the same directory.
Hi everyone. I am a little stumped at why when I try to include a file in same directory as the script being processed, it looks in the same directory as the script that included it to begin with. Is there any way I can get around this? Is there anyway to get the name and/or of the script being processed, rather than the name and/or path of the script that was first called? Many thanks. Daz. Daz wrote: > I am a little stumped at why when I try to include a file in same > directory as the script being processed, it looks in the same directory > as the script that included it to begin with. Is there any way I can > get around this? include dirname(__FILE__).'/myfile.php'; However, it's a good idea to have a specific "includes" directory, put all your included files into there and then just refer to them as: include 'myfile.php'; without including a directory path at all(!) but instead using the include_path setting to specify where include files will be found. http://www.php.net/manual/en/ini.core.php#ini.include-path -- Toby A Inkster BSc (Hons) ARCS Contact Me ~ http://tobyinkster.co.uk/contact On Tue, 09 Jan 2007 06:58:56 -0800, Daz wrote: > Hi everyone. > > I am a little stumped at why when I try to include a file in same > directory as the script being processed, it looks in the same directory > as the script that included it to begin with. Is there any way I can > get around this? Is there anyw...

Session ID in PHP
Hi everyone, New to PHP here (& Doing pretty well so far) I have one missing link in my small web app - how do i implemet session ID in PHP? For example, if I want to create a web-based mail app google style On 18 Dec 2006 10:03:31 -0800, 2good2b@gmail.com wrote: >I have one missing link in my small web app - how do i implemet session >ID in PHP? Usually you let PHP generate session IDs for you when you start a session. http://uk.php.net/session Unless you mean something different? -- Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool ...

Upgraded php, lost php file association
Hi, I just upgraded my php but ran into a problem. Never seen this before. Somehow it seems I lost php file association. When I do a http://localhost/something.php I get a prompt for dowload of a file. I went to folder options, and changed file associations so that ".php" is associated with php interpreter, but still get the same problem. I am missing someting obvious. Can someone help. Thanks. -- http://www.dbForumz.com/ This article was posted by author's request Articles individually checked for conformance to usenet standards Topic URL: http://www.dbForumz.com/PHP-Upgraded-lost-file-association-ftopict138694.html Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=463590 Upgraded PHP from what version to what version? What OS? What webserver? The fact that your web server (Apache, I presume) is trying to download your ..php files instead of interpreting them points to an Apache problem, not a file association problem in Windows (I assume). You must check your Apache httpd.conf file and check that the 'LoadModule' entry is pointing to the right place. For php 4 I use LoadModule php4_module f:/php4/sapi/php4apache2.dll For php 5 I use LoadModule php5_module f:/php5/php5apache2.dll HTH. -- Tony Marston http://www.tonymarston.net "steve" <UseLinkToEmail@dbForumz.com> wrote in message news:411a4b58$1_2@news.athenanews.com... > Hi, > I just upgraded my php b...

PHP Training Institute In Delhi, Live Projects on PHP. Short Term PHP Courses, PHP Scripts, PHP Training with Live Projects.
Vserve Global offers short term PHP: Hypertext Preprocessor Training Course, which is a widely used, general-purpose scripting language that was originally designed for web development, to produce dynamic web pages. It can be embedded into HTML and generally runs on a web server, which needs to be configured to process PHP code and create web page content from it. It can be deployed on most web servers and on almost every operating system and platform free of charge.PHP is installed on over 20 million websites and 1 million web servers. TOPICS:- >> Core PHP Language >> HTML, Cascad...

PHP within PHP...
I took over the support of a website that is set up something like this inside one of the pages: include_once("header.php"); <?php //to get the content of the page they do this: $content = mysql_query("select content etc...); echo $content; ?> include_once("footer.php"); I am having problems evaluating any php that is used in the mysql content. Is there a way to get the mysql withing the mysql to run? Thank you for your time, Mandragon On Sep 17, 12:56 pm, Mandrago...@gmail.com wrote: > I took over the support of a website that is set up something like > this inside one of the pages: > > include_once("header.php"); > > <?php > //to get the content of the page they do this: > $content = mysql_query("select content etc...); > > echo $content; > ?> > > include_once("footer.php"); > > I am having problems evaluating any php that is used in the mysql > content. Is there a way to get the mysql withing the mysql to run? > > Thank you for your time, > > Mandragon Sorry, The question should read: "Is there a way to get the php withing the echo $htmlcontent to run?" Of course you are, $content is a resource. The MySQL Query resource. try this: $content = mysql_query('bla bla bla'); while ($row = mysql_fetch_assoc($content)) { $result[] = $row; } $content = $result; Now you can use $content ;). In answer to your edit... eval($co...

php sessions and css file?
Is it possible to use a css file if you are using php sessions to login? Here is my code: valid.php ..... if($count==1){ $_SESSION['loggedin'] = 1;// Set session variable header("Location: protect.php");//header must be the first printed line! protect.php <?php session_start(); // Call this function so your page // can access session variables if($_SESSION['loggedin'] != 1) { // If the 'loggedin' session variable // is not equal to 1, then you must // not let the user see the page. // So, we'll redirect them to the // login page (login.php). header("Location: index.html"); exit; } ?> <html> <head> <title>DOLF Project Log In</title> <link rel="stylesheet" type="text/css" href="layout.css" media="screen" /> </head> <body> ..... On 4/26/2011 4:46 PM, Alex Pavluck wrote: > Is it possible to use a css file if you are using php sessions to > login? Yes, they are completely different concepts. So, unless you try to mix them somehow, they have nothing to do with each other. > > Here is my code: > > valid.php > .... > if($count==1){ > > $_SESSION['loggedin'] = 1;// Set session variable > header("Location: protect.php");//header must be the first printed > line! Did you add an: exit; after that header? ...

php to php obj
Hi All, Is there any tool to convert the .php files into its object files in deploying the files to other's server like java classes are deployed? Thanks in advance --AR John7481 <arjohn7481@hotmail.com> wrote or quoted: > Is there any tool to convert the .php files into its object files in > deploying the files to other's server like java classes are deployed? To what end? Do you want a PHP obfuscator? They tend not to be needed - since the code remains on the server. Do you want a PHP squeezer? Again - since PHP remains on the server that is of reduced importance. PHP obfuscators and squeezers are out there - but what exactly are you looking for? -- __________ |im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply. With total disregard for any kind of safety measures Tim Tyler <tim@tt1lock.org> leapt forth and uttered: > John7481 <arjohn7481@hotmail.com> wrote or quoted: > >> Is there any tool to convert the .php files into its object >> files in deploying the files to other's server like java >> classes are deployed? > > To what end? > > Do you want a PHP obfuscator? They tend not to be needed - > since the code remains on the server. > > Do you want a PHP squeezer? Again - since PHP remains on the > server that is of reduced importance. > > PHP obfuscators and squeezers are out there - but what exactly > are you looking for? I think he'...

Web resources about - Establishing PHP session ID in an included file - comp.lang.php

Treaty establishing a Constitution for Europe - Wikipedia, the free encyclopedia
The Treaty establishing a Constitution for Europe (TCE), (commonly referred to as the European Constitution or as the Constitutional Treaty ), ...

Establishing Shot: The 405 - Flickr - Photo Sharing!
Photo by Mrs. Newbie. Nearly 15,000 views! This is I-405 on the west side. This is Los Angeles, without a doubt. NOTE: I changed the rights to ...

Successfully Establishing and Representing DevOps in an Audit by James DeLuccia - YouTube
Presented at FlowCon San Francisco 2013 http://flowcon.org/flowcon-sanfran-2013/schedule/index.jsp Organizations and development teams are moving ...

Establishing sleep patterns early in life key to avoiding future problems
Children have just the first five years of life to develop good sleeping habits before they are at risk of adjusting poorly to school and developing ...

Why NRL should revisit idea of establishing its own TV channel
WAY back in 1994, pay television was but a twinkling in Australia's eye. But ARL head honchos John Quayle and Ken Arthurson had an idea:

Establishing sleep patterns early in life key to avoiding future problems
Children have just the first five years of life to develop good sleeping habits before they are at risk of adjusting poorly to school and developing ...

France releases case establishing chemical attack against Assad
A FRENCH intelligence report says forces loyal to Bashar al-Assad carried out a "massive" chemical attack last month, as the Syrian leader warned ...

Establishing sleep patterns early in life key to avoiding future problems
Children have just the first five years of life to develop good sleeping habits before they are at risk of adjusting poorly to school and developing ...

Trade union royal commission: Federal Government establishing police taskforce to investigate corruption ...
... a police taskforce to investigate evidence of criminal conduct uncovered by the trade union royal commission. The Federal Government is establishing ...

Boko Haram says it's establishing Islamic Caliphate in Nigeria
Boko Haram, Nigeria's Islamic extremist rebel group, said it controls the northeastern city of Gwoza and has added it to an Islamic state that ...

Resources last updated: 3/24/2016 3:54:43 AM