[PHP-DB] PHP in Database Fields..
Question: I want to put PHP code into database fields holding HTML text, how can I make it execute that PHP before sending to the browser?? Currently, I get the text from MySQL and print it The browser shows the PHP code mixed into the HTML. Matthew -- Anything that can be logically explained, can be programmed. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP in Database Fields..
On Monday 24 June 2002 09:21 pm, [EMAIL PROTECTED] wrote: exec() the query results. I can't seem to get that to work... Basically, I want to put my variables into the code in order to theme HTML code within data base fields. Consider the following for example: $glPageFG = #FF; $mystr = centerfont color=$glPageFGThemed Text!/font/center; print exec($mystr);// Doesn't work exec($mystr);// Doesn't work print $mystr; // Doesn't work after an exec(), either.. The only part of the PHP reference guide I can check online at the moment is not telling me much, either.. Matthew -Mike - Original Message - From: Matthew Tedder [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 24, 2002 2:31 PM Subject: [PHP-DB] PHP in Database Fields.. Question: I want to put PHP code into database fields holding HTML text, how can I make it execute that PHP before sending to the browser?? Currently, I get the text from MySQL and print it The browser shows the PHP code mixed into the HTML. Matthew -- Anything that can be logically explained, can be programmed. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anything that can be logically explained, can be programmed. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL Password Writes but Doesn't Read!@#%^
Can someone please explain this to me?! It's a real puzzle.. Using the password('abc') command in a MySQL insert statement works for me but using it again in a select statement does not. Well--it does in one MySQL database I have but doesn't in another one. I've done exactly the same thing in each... This one works (the next one does not): = mysql use medburg Database changed mysql explain Users; +--+--+--+-+-+---+ | Field| Type | Null | Key | Default | Extra | +--+--+--+-+-+---+ | username | char(16) | | PRI | | | | password | char(16) | YES | | NULL| | +--+--+--+-+-+---+ 2 rows in set (0.00 sec) mysql insert into Users (username,password) values ('joe',password('joe1')); Query OK, 1 row affected (0.04 sec) mysql select * from Users where password = password('joe1'); +--+--+ | username | password | +--+--+ | joe | 2ca5307d5156d8ce | +--+--+ 1 row in set (0.00 sec) mysql This example does NOT appear to Work: = mysql use OpenSIG Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql explain Users; +-+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +-+--+--+-+-+---+ | usrlogin| char(15) | | PRI | | | | usrpassword | char(15) | | | | | | usrsurname | char(15) | YES | | NULL| | | usrforname | char(15) | YES | | NULL| | | usremail| char(64) | YES | | NULL| | +-+--+--+-+-+---+ 5 rows in set (0.00 sec) mysql insert into Users (usrlogin,usrpassword) values ('joe',password('joe1'));Query OK, 1 row affected (0.00 sec) mysql select * from Users where usrpassword = password('joe1'); Empty set (0.00 sec) mysql So what on earth went wrong?? What was the difference besides field names? I am totally lost here... Help... --Matthew -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Array/List Session Variables
Does anyone know if there is a way to include Arrays and/or Lists as session variables? I'd really like to be able to add variable lists of variables to a session. --Matthew -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Execution of non-PHP code from within PHP
Using PHP, how can I spawn a process and execute non-PHP code off the console? --Matthew -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] or { blah blah blah }
Inside a function, I am reading data from MySQL. In case any of these calls fail I follow them with something like: or echo Can't make query to database!; The problem is, I want to do more things than just this... and then I want to return out of the function rather than continuing to execute statements. However, the following doesn't work... I get a parsing error.. How can it be done? or { echo Can't make query to database!; return; } .. other statements .. I could have it call another function to do more things, but then how would I have it return out of it's current function when done doing those things? This is a pretty disasterous inability, not recognizing code blocks. --Matthew -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Learning PHP Sessions
?php /* Hi, I'm new to PHP and am having trouble understanding how to use PHP sessions. My book tells in near the beginning how to start them and register session variables, but I can't figure out how to destroy a session or later read those session variables. I'm also trying to do this across frames, but can't even get it to work within a single page. Here's what I've learned so far and what my problems are: */ /* To start a session */ session_start(); /* To register a session variable */ session_register(myvar); $myvar = some value; /* PROBLEM #1: From the above commands, I get a $PHPSESSID that seems to be globally available for use, but I cannot seem to read my values back out of the registered session variable from anywhere... I tried: */ print $myvar\n; /* and absolutely nothing is printed */ /* To destroy a session */ session_destroy(); /* PROBLEM #2: This says there is no session to destroy. It's rather strange because I can still print the $PHPSESSID value.. I've attached my code... */ ? ?php /*= Check for New User Session =*/ if(!isset($PHPSESSID)) { session_start(); session_register(UserName); session_register(UserPage); $UserName = guest; $UserPage = Home; }; /*= Main Switchboard for Pages =*/ include includes/bodyhead.html; switch($action) { case Home: ShowHome(); break; case Login: ShowLogin(); break; case AuthUser: AuthUser($UserName, $UserPassword); break; case Logout: ShowLogout(); break; default: ShowMessage(Service Not Yet Implemented); break; } include includes/bodyfoot.html; /*= Function To Show Home Page =*/ function ShowHome() { include includes/home.html; } /*= Function To Show Login Page =*/ function ShowLogin() { print form type=put action=right.php\n; print input type=hidden name=action value=AuthUser\n; print table border=1 width=100%\n; print trtd bgcolor=yellow align=centerUSER AUTHORIZATION/td/tr\n; print /table\n; print table align=center\n; print tr\n; print tdfont color=yellowbUser Name:/b/font/td\n; print td align=centerinput type=text name=UserName length=16 maxlength=16/td\n; print /tr\n; print tr\n; print tdfont color=yellowbPassword:/b/font/td\n; print td align=centerinput type=password name=UserPassword length=16 maxlength=16/td\n; print /tr\n; print tr\n; print td align=center /td\n; print td align=centerinput type=submit name=UserLogin value='USER LOGIN'/td\n; print /tr\n; print /table\n; print table border=1 width=100%\n; print trtd bgcolor=yellow align=centerUNAUTHORIZED ENTRY IS PUNISHABLE BY LAW/td/tr\n; print /table\n; print /form\n; } /*= Function Authenticate User (from Login Page) =*/ function AuthUser($User, $User) { if($User == guest) { ShowMessage(For guest users, authorization is not required. However, priviledges are limited.); } else { ShowMessage(Authorization Feature Not Yet Implemented); } } /*= Function To Logout User =*/ function ShowLogout() { ShowMessage(Your Session Has Been Terminated.\nThank You for Properly Logging Out, $UserName!); session_destroy(); } /*= Function To Show Generic Messages =*/ function ShowMessage($message) { print br\n; print table border=2 align=center\n; print trtd align=centerfont color=yellow$message/font/td/tr\n; print /table\n; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]