TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-28-2008, 11:10 PM   #1 (permalink)
The Wanderer
 
frosty's Avatar
 
Join Date: Aug 2008
Location: texas
Posts: 13
Thanks: 3
frosty is on a distinguished road
Confused New Issue (more of a question)....

and it seams soo simple to do...

First thanks for the outsanding help I have received here!

My issue/question is this...

If I am using something like..

PHP Code:
function StripSpecChar($val) {
    return (
preg_replace('/[^a-zA-Z0-9" "-.@]/',''$val));
    }

    foreach (
$_POST as $key => $val) { 
     
$_SESSION[$key] = StripSpecChar($val);  
     } 
to handle my session information. Why can I not do something similar to it to pull values from a MySql db and convert them in to the same thing where I end up with something like this...

PHP Code:
$_SESSION[$coloum_name] = $val_of_cell
to put it back into a session array...

or am I just wishing that it could be that simple

Thanks
frosty is offline  
Reply With Quote
Old 08-29-2008, 12:09 AM   #2 (permalink)
The Wanderer
 
frosty's Avatar
 
Join Date: Aug 2008
Location: texas
Posts: 13
Thanks: 3
frosty is on a distinguished road
Default

Thinking on this would this work?

PHP Code:
$query "...."
$res mysql_query($query); 
if(
$res){ 
   while(
$row mysql_fetch_assoc($res)){ 
      foreach(
$row as $key => $val){ 
         
$_SESSION[$key] = StripSpecChar($val);           
      } 
   } 

frosty is offline  
Reply With Quote
Old 08-29-2008, 02:04 AM   #3 (permalink)
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default

People...PHP: array_map - Manual. Read up on it, seriously. Well aside from that quasi-condescending comment, I don't really understand what your trying to do? Even less on your second example.
Enfernikus is offline  
Reply With Quote
Old 08-29-2008, 03:42 AM   #4 (permalink)
The Wanderer
 
frosty's Avatar
 
Join Date: Aug 2008
Location: texas
Posts: 13
Thanks: 3
frosty is on a distinguished road
Default

Sorry, about no explanation...

Right now I have a project where I am gathering information from about 20 forms, 1000+ fields and it’s all being stored in the session.

Moving forward I must take this information and dump into a temp db and no longer store or pass in session for multi pages.

Then pull the data put into a very long xml string and send the string to a middleware app to parse and commit to a central db.

Since the xml generator works like a champ and some of the complexities of the string, conditions on the data (required, not required, required when other data present etc.) makes using most standard read, turn into xml and so on not very friendly or useful. One reason is that one data filed in the db may have to go into 4 or 5 tags in several nodes.

I figure that since I can not use the session to hold the information as I do now, why can I just not call it out in the above example populate my xml generator then destroy the session when I send the xml. I empty the db when I get conformation that the data has been accepted.

Btw not a developer or programmer really. I am the Art Director for the company that I work for.

(I don't speak developer very well, and I have gone over the section that you directed me to, understood some, did not understand other parts of it. With 90 developers in the company NONE of them do web period. They are all C++, C#, TCL programers...)

I just happen to know a (1 to 10 scale a 5) bit about php. When the developer that spent 2 years, and could not get a properly formatted xml string to the middleware he was canned; The CEO told me that this is my new project...

In two months I have cleaned up a train wreck of code, and completed the first milestone of getting good data to the middleware and to the core db via this bloated xml schema that the business rule people came up with...
frosty is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 08:01 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design