f



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>
.....
0
apavluck (128)
4/26/2011 2:46:38 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

11 Replies
951 Views

Similar Articles

[PageSpeed] 7

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?

>
> 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>
> ....


You didn't describe your problem.

A wild suggestion: look into the source of the resulting webpage.
Possibly you will see a warning/notice that makes your HTML invalid 
enough for the browser to ignore the css.

Erwin Moller

-- 
"That which can be asserted without evidence, can be dismissed without 
evidence."
-- Christopher Hitchens
0
4/26/2011 3:03:47 PM
On 4/26/2011 10:46 AM, Alex Pavluck wrote:
> Is it possible to use a css file if you are using php sessions to
> login?

Why not? What has one thing to do with the other.  If you are chewing 
gum, can you write on a piece of paper?  See what I mean?

One thing you need to get clear in your mind:  PHP is _SERVER SIDE_ 
code.  It has absolutely _NOTHING_ to do with the display.  CSS is 
_CLIENT SIDE_ code and ONLY has to do with the display.  Yes, using PHP 
you can code print or echo statements of html code do display to the 
browser, and when done it will use the CSS that is included in the 
output, but ALL of that is done on the server.  It is only when it gets 
to the browser -- and has absolutely NO knowledge that PHP, ASP or 
anything else on the server generated it -- that it uses the CSS.

BTW, you are NOT using php sessions to log in.  You are using php 
sessions to remember and determine _IF_ you are logged in.

>
> 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>
> ....

Now, looking at your code I have no idea what $count comes from, nor 
what $valid is used for.  From appearances it looks like you will send 
the user to the index.html (NOT the login page, unless the index page IS 
the log in page) if that $count variable is somehow not equal to one.

Also, from the way you put it here, I thing you REALLY want protect.php 
to be terminated after the ?>.  You would then have a

<?php
require_once 'protect.php"
?>

at the top of every file you want to protect (before the <html> line). 
Remember that everything between the <?php and the ?> is processed on 
the server BEFORE it is delivered to the browser.

Oh, you also need an actual log in page for the user to put in a user 
name and a password.  That is where you would set the session variable.

-- 
Shelly
0
sheldonlg1 (120)
4/26/2011 3:09:19 PM
Thanks for the comments.  I guess I didn't explain my problem well.
The issue is in the protect.php file if I take the code and cut out
only the html and paste it into works.html then the css file works.
If I either name the file php then the css doesn't work.


On Apr 26, 10:46=A0am, Alex Pavluck <apavl...@gmail.com> wrote:
> Is it possible to use a css file if you are using php sessions to
> login?
>
> Here is my code:
>
> valid.php
> ....
> if($count=3D=3D1){
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $_SESSION['loggedin'] =3D 1;// Set sessio=
n variable
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 header("Location: protect.php");//header =
must be the first printed
> line!
>
> protect.php
> <?php
> =A0 =A0 session_start();
> =A0 =A0 // Call this function so your page
> =A0 =A0 // can access session variables
> =A0 =A0 =A0 =A0 if($_SESSION['loggedin'] !=3D 1) {
> =A0 =A0 =A0 =A0 // If the 'loggedin' session variable
> =A0 =A0 =A0 =A0 // is not equal to 1, then you must
> =A0 =A0 =A0 =A0 // not let the user see the page.
> =A0 =A0 =A0 =A0 // So, we'll redirect them to the
> =A0 =A0 =A0 =A0 // login page (login.php).
> =A0 =A0 =A0 =A0 header("Location: index.html");
> =A0 =A0 =A0 =A0 exit;
> =A0 =A0 }
> ?>
>
> <html>
> <head>
> <title>DOLF Project Log In</title>
> <link rel=3D"stylesheet" type=3D"text/css" href=3D"layout.css"
> media=3D"screen" />
>
> </head>
> <body>
> ....

0
apavluck (128)
4/26/2011 5:08:29 PM
On 4/26/2011 1:08 PM, Alex Pavluck wrote:
> Thanks for the comments.  I guess I didn't explain my problem well.
> The issue is in the protect.php file if I take the code and cut out
> only the html and paste it into works.html then the css file works.
> If I either name the file php then the css doesn't work.
>
>
> On Apr 26, 10:46 am, Alex Pavluck<apavl...@gmail.com>  wrote:
>> 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>
>> ....
>

Look at your page source in the browser.  Is it what you expected?

File names have nothing to do with css.   Your problem is elsewhere.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
0
jstucklex (14659)
4/26/2011 5:50:18 PM
On 4/26/2011 1:08 PM, Alex Pavluck wrote:
> Thanks for the comments.  I guess I didn't explain my problem well.
> The issue is in the protect.php file if I take the code and cut out
> only the html and paste it into works.html then the css file works.
> If I either name the file php then the css doesn't work.

You still didn't explain it well.  What I _THINK_ you are saying is:
(a) if you remove the <?php ...  ?> from protect.php and run 
protect.php, then it doesn't show the effect of layout.css

and

(b) If you then rename that file that no longer contains php and call it 
works.html then it does show the effects of layout.css.

Is that what you are saying?  If you are, then it makes no sense since 
file names are irrelevant (can be either htm, html or php).

>
>
> On Apr 26, 10:46 am, Alex Pavluck<apavl...@gmail.com>  wrote:
>> 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

There is no "function" being called here

>>      // can access session variables
>>          if($_SESSION['loggedin'] != 1) {

You indentation is improper.

>>          // 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>
>> ....
>
Does you source code from the BROWSER (the result -- view page source) 
indicate items in the css for different elements?  How is it being 
improperly displayed?

-- 
Shelly
0
sheldonlg1 (120)
4/26/2011 7:29:05 PM
I found the answer by using Google as usual.  The answer is a simple
absolute vs relative path for the css file for those who care.  Here
is the site: http://www.tek-tips.com/viewthread.cfm?qid=3D1448368&page=3D67

Special thanks to the people who made sarcastic rather helpful posts.
Next time don't post on questions if you aren't going to be helpful -
it isn't as impressive or cool as you think.





On Apr 26, 10:46=A0am, Alex Pavluck <apavl...@gmail.com> wrote:
> Is it possible to use a css file if you are using php sessions to
> login?
>
> Here is my code:
>
> valid.php
> ....
> if($count=3D=3D1){
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $_SESSION['loggedin'] =3D 1;// Set sessio=
n variable
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 header("Location: protect.php");//header =
must be the first printed
> line!
>
> protect.php
> <?php
> =A0 =A0 session_start();
> =A0 =A0 // Call this function so your page
> =A0 =A0 // can access session variables
> =A0 =A0 =A0 =A0 if($_SESSION['loggedin'] !=3D 1) {
> =A0 =A0 =A0 =A0 // If the 'loggedin' session variable
> =A0 =A0 =A0 =A0 // is not equal to 1, then you must
> =A0 =A0 =A0 =A0 // not let the user see the page.
> =A0 =A0 =A0 =A0 // So, we'll redirect them to the
> =A0 =A0 =A0 =A0 // login page (login.php).
> =A0 =A0 =A0 =A0 header("Location: index.html");
> =A0 =A0 =A0 =A0 exit;
> =A0 =A0 }
> ?>
>
> <html>
> <head>
> <title>DOLF Project Log In</title>
> <link rel=3D"stylesheet" type=3D"text/css" href=3D"layout.css"
> media=3D"screen" />
>
> </head>
> <body>
> ....

0
apavluck (128)
4/26/2011 7:53:27 PM
On 4/26/2011 3:53 PM, Alex Pavluck wrote:
> I found the answer by using Google as usual.  The answer is a simple
> absolute vs relative path for the css file for those who care.  Here
> is the site: http://www.tek-tips.com/viewthread.cfm?qid=1448368&page=67
>
> Special thanks to the people who made sarcastic rather helpful posts.
> Next time don't post on questions if you aren't going to be helpful -
> it isn't as impressive or cool as you think.

Next time:
a - Properly and completely describe the problem the first time
b - Explain just what the error is that you are getting
c - Detail what you have tried and the research you have done.
d - Don't make it sound like you don't know the difference between 
server side code and client side (browser) code

IOW, do your homework first and properly show where you are being 
stumped.  You will then find many people willing to help.

 From the way you wrote your post I took you to be a student trying to 
learn php -- and still do, and that this was a homework assignment.

What you are saying above about relative paths and absolute paths has 
absolutely _NO_ relation to the problem you described.  If it can find 
the css with the php section removed using a relative path, then it can 
find it with the php section still in there using a relative path.  So, 
you did obviously did something completely different - like having the 
one with the php section and the one without it in two separate 
directories -- something you totally failed to mention when you 
described your problem or, rather, tried to.

Oh, BTW, you're welcome.

-- 
Shelly
0
sheldonlg1 (120)
4/26/2011 8:05:53 PM
On 4/26/2011 9:53 PM, Alex Pavluck wrote:
> I found the answer by using Google as usual.  The answer is a simple
> absolute vs relative path for the css file for those who care.  Here
> is the site: http://www.tek-tips.com/viewthread.cfm?qid=1448368&page=67


Nonsense.

I am sure you didn't solve your problem.
I suspect there are errors (notices/warnings) in your source-html.

Did you check it, as everybody suggested so far?
Did you check your HTML?



>
> Special thanks to the people who made sarcastic rather helpful posts.
> Next time don't post on questions if you aren't going to be helpful -
> it isn't as impressive or cool as you think.

You are screwing up here by being vague and more (See sheldongs reply).
Nobody is trying to beat you up or something, we are all helping, but 
you make it difficult for yourself.


Now, do yourself a favor and check that sourcecode.

Erwin Moller

-- 
"That which can be asserted without evidence, can be dismissed without 
evidence."
-- Christopher Hitchens
0
4/27/2011 5:58:57 AM
sheldonlg wrote:

> On 4/26/2011 1:08 PM, Alex Pavluck wrote:
>> On Apr 26, 10:46 am, Alex Pavluck<apavl...@gmail.com>  wrote:
>>> protect.php
>>> <?php
>>>      session_start();
>>>      // Call this function so your page
> 
> There is no "function" being called here
> 
>>>      // can access session variables

With emphasis on *here* (session_start()) *is* a function).  Documentation 
comments should be pre-comments (and multiline comments, to distinguish them 
from disabling comments), not post-comments.


PointedEars
-- 
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
  -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
0
PointedEars (2489)
4/28/2011 12:24:05 AM
On 4/27/2011 8:24 PM, Thomas 'PointedEars' Lahn wrote:
> sheldonlg wrote:
>
>> On 4/26/2011 1:08 PM, Alex Pavluck wrote:
>>> On Apr 26, 10:46 am, Alex Pavluck<apavl...@gmail.com>   wrote:
>>>> protect.php
>>>> <?php
>>>>       session_start();
>>>>       // Call this function so your page
>>
>> There is no "function" being called here
>>
>>>>       // can access session variables
>
> With emphasis on *here* (session_start()) *is* a function).  Documentation
> comments should be pre-comments (and multiline comments, to distinguish them
> from disabling comments), not post-comments.

Yes, session_start() is, indeed, a function.  However, I have never 
encountered a comment set such as the above that was talking about prior 
code (other than something like //end while loop).  So, I looked for a 
function below the commenting, found none, and made the appropriate 
remark that no function is being called here.

(Furthermore, common practice is to use /* */  or /** */ for multiline 
comments rather than a bunch of //.)

-- 
Shelly
0
sheldonlg1 (120)
4/28/2011 12:30:16 AM
sheldonlg wrote:

> On 4/27/2011 8:24 PM, Thomas 'PointedEars' Lahn wrote:
>> sheldonlg wrote:
>>> On 4/26/2011 1:08 PM, Alex Pavluck wrote:
>>>> On Apr 26, 10:46 am, Alex Pavluck<apavl...@gmail.com>   wrote:
>>>>> protect.php
>>>>> <?php
>>>>>       session_start();
>>>>>       // Call this function so your page
>>>
>>> There is no "function" being called here
>>>
>>>>>       // can access session variables
>>
>> With emphasis on *here* (session_start()) *is* a function). 
>> Documentation comments should be pre-comments (and multiline comments, to
>> distinguish them from disabling comments), not post-comments.
> 
> Yes, session_start() is, indeed, a function.  However, I have never
> encountered a comment set such as the above that was talking about prior
> code (other than something like //end while loop).  So, I looked for a
> function below the commenting, found none, and made the appropriate
> remark that no function is being called here.
> 
> (Furthermore, common practice is to use /* */  or /** */ for multiline
> comments rather than a bunch of //.)

I think I just said that.


PointedEars
-- 
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
  -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
0
PointedEars (2489)
4/28/2011 7:15:05 PM
Reply:

Similar Artilces:

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 ....

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...

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...

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 ...

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. ...

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> .... /*EXA...

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&qu...

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...

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'...

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 fi...

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 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'...

php outside php (?)
Sounds weird, i know. What i want/wonder is the following: PHP can do the next: <?php if($foo == 'bar') { ?> Ow yeah, foo is bar! <?php }; ?> But how can i do the following: <?php $foo= ?> this is what foo looks like. <?php }; ?> This way i could edit the content of $foo in DW's design-view. I hope it's clear enough for you all to understand... Greetings frizzle. frizzle wrote: > But how can i do the following: > > <?php > > $foo= > > ?> > this is what foo looks like. > <?php > > }; > > ?> > > This way i could edit the content of $foo in DW's design-view. > I hope it's clear enough for you all to understand... <?php ob_start(); ?> this is what foo looks like. <?php $foo=ob_get_clean(); ?> -- Justin Koivisto - justin@koivi.com http://koivi.com Wow, little late on the reply, but i still wanted to thank you for your help. This is exactly what i meant, and it works great! :D Thanks again. ...

Why are my PHP files are not being executed (PHP keywords/syntax being ignored)
I have been hosting a website on the same server for roughly 2 years. The entire site is based on a group of PHP scripts. Today, without changing a thing, the server stopped recognizing all PHP keywords and syntax. When I use firefox, the page simply displays a text/plain version of my source code. When I use IE, the page loads as text/html, however, all lines of PHP code (between "<?" and "?>") are displayed as text. My assumption is that my host has stopped providing PHP extensions. Can anybody confirm this or give me another explanation? All help is greatly ap...

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...

testing PHP 5 with Apache 2 and php info file
When I go to look for php info file in the browser all i get is the actually words. <?php phpinfo(); ?> any obvious problems? thanks ...

Free PHP Template with External CSS (server must have php)
SSI / PHP Template For Websites PHP Template with External CSS browse down the page, and there are the four files, and then get the graphics from the base link. This one works like a charm. Free Template: http://www.ibdhost.com/help/templates/ Free Software: http://wholives.com/tools/freestuff.htm Hats wrote: > SSI / PHP Template For Websites > PHP Template with External CSS > browse down the page, and there are the four files, and then get the > graphics from the base link. This one works like a charm. > > Free Template: http://www.ibdhost.com/help/templates/ > >...

how to mark php document as cachable (expires only when php file changes)
Hi, I'm new to cahce control, so I hope my question makes sense. let's assume a small php file like <html><body> <?php $max=10; for($i=0;$i<$max;$i++){ print("$i<br>\n"); } ?> </body></html> Obviously the output of this file is predictably constant as it would be for any html file. I assume, that apache would allow a foreign browser to detect, that a html file (creation date or expire) does not have to be reloaded except it has been updated on the server. On the other hand I assume, that php will set the expire attributes f...

testing PHP 5 with Apache 2 and php info file
When I go to look for php info file in the browser all i get is the actually words. <?php phpinfo(); ?> any obvious problems? thanks ...

Parsing .css files with php: Cons?
given: I know about @import and cascading styles, etc etc. Is is cool to parse .css files with php? Like I may want to include() sections into an overall .css. Or i may want to do like color:#<?php echo $thecolor; ?>. That kind of stuff. I guess there might be a little more overhead, but what's a few .css files within a whole cms like wordpress? I'm just looking for gotchas and unforseen problems. thanks, j On 1/16/2012 10:36 PM, J. Frank Parnell wrote: > given: I know about @import and cascading styles, etc etc. > > Is is cool to parse .css files with php? Like I may want to include() > sections into an overall .css. Or i may want to do like color:#<?php > echo $thecolor; ?>. That kind of stuff. > > I guess there might be a little more overhead, but what's a few .css > files within a whole cms like wordpress? I'm just looking for gotchas > and unforseen problems. > > thanks, > j Hi, It is possible, but I prefer making multiple stylesheets. Make the included stylesheet conditional. eg: <?php $usedstylesheet = ($test?"mycss/ver_abc.css":"mycss/ver_123.css"); $> <link type="text/css" rel="stylesheet" media="screen" charset="utf-8" href="http://www.example.com/<?php echo $usedstylesheet; ?>"> That way you have no PHP defining your stylesheet. That will make webdesigners who have to modify it later happy. ;-) R...

PHP/Perl/Unix Virus: delete config.php files asap
There were some strange requests to my server asking for config.php file (which I do not have in the requested location). I did some investigation. Seems to be a virus written in perl, exploiting a vulnerability in php code. The requests are like this 216.120.231.252 - - [30/Aug/2006:13:28:03 -0500] "GET /algebra/about/history/config.php?returnpath=http://domates.1gig.biz/spread.txt? HTTP/1.1" 404 561 "-" "libwww-perl/5.805" File spread.txt contains this: <? passthru('cd /tmp;wget http://domates.1gig.biz/tmr;perl tmr;rm -f tmr*'); pas...

configure apache to recognize php in css files
Hi folks, I have a website with linked CSS files controlling layout, via LINK tags. In these linked CSS files, I need to create dynamic styles. This is a website of articles, and for every article type in the MySQL database, I need another style. ..article-type-0{color:red;} ..article-type-1{color:red;} etc. I could use PHP in the HTML head to write styles, but I'm using the media attribute of the LINK tag to control which styles go to which output devices. Therefore, I'd like to use PHP to author a linked CSS file. Being an idiot, I had figured I could update my httpd.conf file ...

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 t...

Web resources about - php sessions and css file? - comp.lang.php

Barack Obama speech to joint session of Congress, February 2009 - Wikipedia, the free encyclopedia
Obama's first State of the Union Address was the 2010 State of the Union Address . The speech was delivered on the floor of the chamber of the ...

Nasdaq advances for fifth straight session
The Nasdaq Composite Index edged higher in light trading, giving the index a fifth straight gain and its longest advance in 11 months.

Justin Timberlake Shares Photo of Studio Session with Pharrell - Billboard
While fatherhood has kept him from bringing sexy back on-wax (he and wife Jessica Biel welcomed a baby boy last April), the pop phenom shared ...

No, the GOP won't confirm a Supreme Court justice in the lameduck session
No, the GOP won't confirm a Supreme Court justice in the lameduck session by digby I wrote about the GOP's history of being unimpressed and ...

Busy bees, a horse in tweed and a secret training session
Horse wins best dressed at Cheltenham One of Britain’s biggest horse racing events happened this week so I think it’s only fair that we start ...

Jeff Sessions to GOP: Time to Unite Behind Trump, Beat Hillary
Jeff Sessions to GOP: Time to Unite Behind Trump, Beat Hillary

Steep Leans filmed a live session for "Colombia," touring
Last year, Steep Leans toured with Wavves and put out their debut album Grips on Heat on Wavves' Ghost Ramp label. They've since filmed a 'Spare ...

How a newborn photo session works - Business Insider
For example, the room's temperature is kept similar to the 98.6 degree womb the babies are accustomed to.

Saturday Sessions: Trixie Whitley performs the single “Soft Spoken Words" - Videos - CBS News
The daughter of singer Chris Whitley, Trixie released her first EP in 2008. She was born in Belgium, but has roots in Texas and blues in her ...

Nemaska Lithium Inc Has Another Very Strong Trading Session
The stock of Nemaska Lithium Inc (CVE:NMX) is a huge mover today! The move comes after 9 months positive chart setup for the $142.63

Resources last updated: 3/23/2016 4:13:28 PM