SWEET!!! thanx goatThe Ninja Space Goat wrote:As for a PHP editor... syntax highlighting will prevent 99% of parse errors... here's a free one that's pretty decent:
http://crimsoneditor.com/
help with understanding sessions and practical/correct usage
Moderator: General Moderators
done in the beginning of my new code i have
and i took your advice on cleaning it up and so i tried both this
with this i get the error message
and i get this error
Code: Select all
session_start();
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);Code: Select all
<div style=\"padding-left:17px; padding-top:20px;\"><?php echo "$_SESSION['logname']welcome to the
secret page!"; ?></div>and then this wayParse error: parse error, unexpected T_VARIABLE in C:\Program Files\xampp\htdocs\Log_In\agent\index_new.php on line 43
Code: Select all
<div style=\"padding-left:17px; padding-top:20px;\">$_SESSION['logname']welcome to the secret
page!</div>is there a different way of going about this that i should be using?Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\xampp\htdocs\Log_In\agent\index_new.php on line 43
within double-quoted strings you can either leave the ' out or encapsulate the whole term with { }
Do you have plans on using $display_block in a more ...complex context than?
If not then there's no reason that variable at all.
Code: Select all
echo $_SESSION['logname'];
// but
echo "... $_SESSION[logname] ...";
// or
echo "... {$_SESSION['logname']} ...";
// or
$tmp = $_SESSION['logname'];
echo <<< eot
yadda yadda
yadda $tmp yadda
eot;You never open another php block within another php block.Obadiah wrote:Code: Select all
<div style="padding-left:17px; padding-top:20px;"><?php echo "$_SESSION['logname']welcome to the secret page!"; ?></div>
Do you have plans on using $display_block in a more ...complex context than
Code: Select all
<html>
<head>
<title>Secret Page</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php echo $display_block; ?>
</body>
</html>If not then there's no reason that variable at all.
i thought that was the reason one would use display block....to send blocks of html in a php script for viewing in the browser....should i have used just echo? right now all im doing is referencing what i learn here, to what i have read and the examples ive tried in my books...was there another way of going about it? eventually what im going to need to do is have a page of links that will link the user to a certain folder that will only have his information...
besides posting the info in the database on the pages based on the user_id or the logname....can i use something like what i did here for that
and say if the users logname is joe when he clicks on the link it will automatically take him to his folder that
has that file
besides posting the info in the database on the pages based on the user_id or the logname....can i use something like what i did here for that
Code: Select all
//i hate trying to wing this stuff but its the only way i know how to explain what im tryna do
$next_program = ($sql = "SELECT user_name FROM $table_name
WHERE user_name='$_POST[fusername]' ==_SESSION['logname']";"/Credit_Info.php";)has that file
I don't understand; you're mixing php and html alreadyObadiah wrote:i thought that was the reason one would use display block....to send blocks of html in a php script for viewing in the browser....should i have used just echo?
Code: Select all
<html>
<head>
<title>Secret Page</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php echo $display_block; ?>
</body>
</html>Code: Select all
<?php session_start(); ?>
<html>
<head>
<title>Secret Page</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
[... html code ...]
<td valign="top" width="208" height="302">
<div style="padding-left:17px; padding-top:20px">
<?php echo $_SESSION['logname']; ?>welcome to the secret page!
</div>
<div style="padding-left:22px; padding-top:19px">
<img src="images/2_p1.gif" alt="">
</div>
[... html code ...]
</body>
</html>ok...imagin you were a independent sales contracter and you wanted to login to this site to see yourThe Ninja Space Goat wrote:why take him to his own folder... why not just take him to a template that gets filled in with is data from a database?
information....now, heres the thing....my boss is not wanting them to be able to change amounts and figures
since that would really suck....so he says to me when they log in, and they click on a link, it will bring them to a page that will have something like a drop down of months where their able to view a report of all their personal sales for that month...the report will be a pdf...basically a image
will something like this work?
Code: Select all
<a href="{$_SESSION['logname']}"report.pdf">holy <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> .....lol...it does work!!!! it takes me to the path but not the file
it ignores report.pdf....why?
Code: Select all
<a href=\"{$_SESSION['logname']}\"report.pdf\">Sending a "static file" or the output of a script doesn't make any difference for the client.
e.g. a php script can create a pdf document on the fly and vice versa can a "static" pdf file be altered on the client-side. I put static in quotes because there is no such thing in terms of a http connection; the output of a php script is sent exactly the same way as the contents of e.g. report.pdf or report.tif or whatever. Everything you send to the client can be altered there - you have no control over the raw data the client receives.
Depending on the importance of the data you might want to consider http://en.wikipedia.org/wiki/Digital_si ... entication
e.g. a php script can create a pdf document on the fly and vice versa can a "static" pdf file be altered on the client-side. I put static in quotes because there is no such thing in terms of a http connection; the output of a php script is sent exactly the same way as the contents of e.g. report.pdf or report.tif or whatever. Everything you send to the client can be altered there - you have no control over the raw data the client receives.
Depending on the importance of the data you might want to consider http://en.wikipedia.org/wiki/Digital_si ... entication
ok....what if im wanting to log a user out...i was reading and came across something like
but how do i put that into a link like something we have here on the boards?
Code: Select all
session_destroy();