I wound up going with a new table in the current database.
Now I'm trying to figure out how once a user is logged in, I can pull their information automatically without them needing to fill in another form. I'm still using the PHP User Class script. Definitely mind boggling
296 Replies - 9155 Views - Last Post: 19 March 2009 - 01:32 PM
#286
Re: Need help getting started - PHP, MySQL, Item/Part Configurator
Posted 17 March 2009 - 08:00 AM
#287
Re: Need help getting started - PHP, MySQL, Item/Part Configurator
Posted 17 March 2009 - 08:33 AM
Ah ha! Got it. 
I may not know this stuff right off the bat, but I will not stop until I figure it out via trial and error.
Onto emailing the quotes!
I may not know this stuff right off the bat, but I will not stop until I figure it out via trial and error.
Onto emailing the quotes!
#288
Re: Need help getting started - PHP, MySQL, Item/Part Configurator
Posted 17 March 2009 - 10:25 AM
#289
Re: Need help getting started - PHP, MySQL, Item/Part Configurator
Posted 17 March 2009 - 10:52 AM
Maybe you can help me with this.
In the calling php I have this;
It echo's the user name logged in and a logout link. Once the link is clicked, it brings the user back to the login page. Works great.
What I also want it to do is reset/destroy/erase that user's session. I only found this out when I signed in one person, added a few items to RFQ, logged out, signed in as another person, and saw the same items in the RFQ. I know the chances of two different people who use this configurator being on the same computer is slim to none, but I'd like to reset their session anyways upon logging out.
Any ideas?
In the calling php I have this;
if ($user->is_loaded()) {
if ( $_GET['logout'] == 1 )
$user->logout('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
echo '<p class="logout"><font size=-1>Welcome: <b>'.$uname.'</b><br><a href="'.$_SERVER['PHP_SELF'].'?logout=1">Logout</a></font></p>';
...
It echo's the user name logged in and a logout link. Once the link is clicked, it brings the user back to the login page. Works great.
What I also want it to do is reset/destroy/erase that user's session. I only found this out when I signed in one person, added a few items to RFQ, logged out, signed in as another person, and saw the same items in the RFQ. I know the chances of two different people who use this configurator being on the same computer is slim to none, but I'd like to reset their session anyways upon logging out.
Any ideas?
#290
Re: Need help getting started - PHP, MySQL, Item/Part Configurator
Posted 17 March 2009 - 11:04 AM
Use session_destroy:
if ($user->is_loaded()) {
if ( $_GET['logout'] == 1 ) {
$user->logout('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
echo '<p class="logout"><font size=-1>Welcome: <b>'.$uname.'</b><br><a href="'.$_SERVER['PHP_SELF'].'?logout=1">Logout</a></font></p>';
$session_destroy();
...
#291
Re: Need help getting started - PHP, MySQL, Item/Part Configurator
Posted 17 March 2009 - 11:08 AM
As you were typing the response, I also did that but I put the session_destroy(); in the logout function of another php.
Thanks!
Thanks!
#292
Re: Need help getting started - PHP, MySQL, Item/Part Configurator
Posted 17 March 2009 - 12:51 PM
noboost4you, on 17 Mar, 2009 - 01:08 PM, said:
...in the logout function of another php.
There's really only one reason to split things up, and that's to make everything easier for humans to keep straight, since the computer doesn't care. I don't know how much you've got so far, but I'd have class definitions, the controlling code, and css file(s). So far, that would be something like:
index.php // has controlling code which includes the (2) classes
myoptions.class.php // my code - handles parts.
user.class.php // the user login code you got elsewhere
somecssfile.css // contains formatting
If you have another php file, then you may be scrambling your code so that later you'll find it difficult to follow. Try to keep it simple and concise.
#293
Re: Need help getting started - PHP, MySQL, Item/Part Configurator
Posted 17 March 2009 - 01:44 PM
CTphpnwb, on 17 Mar, 2009 - 02:51 PM, said:
noboost4you, on 17 Mar, 2009 - 01:08 PM, said:
...in the logout function of another php.
There's really only one reason to split things up, and that's to make everything easier for humans to keep straight, since the computer doesn't care. I don't know how much you've got so far, but I'd have class definitions, the controlling code, and css file(s). So far, that would be something like:
index.php // has controlling code which includes the (2) classes
myoptions.class.php // my code - handles parts.
user.class.php // the user login code you got elsewhere
somecssfile.css // contains formatting
If you have another php file, then you may be scrambling your code so that later you'll find it difficult to follow. Try to keep it simple and concise.
oh yea, I've got some dirty code. I have php after php after php. I just want to make sure things work before I create various functions to throw into one class.
#294
Re: Need help getting started - PHP, MySQL, Item/Part Configurator
Posted 17 March 2009 - 02:09 PM
But that's the point of functions! They don't do anything until they're called, so you can insert one and test it before calling it from your controlling code. You can write an entire site by building one function at time, and you never have to worry about keeping track of anything but the functions. In an effort to make it almost obscenely easy, most decent text editors will keep track of functions for you!
#295
Re: Need help getting started - PHP, MySQL, Item/Part Configurator
Posted 19 March 2009 - 12:44 PM
Is there a special way to format mail sent via mail()? Possible to add html (tables, <p>, <b>, etc.) to the code? It's a minor detail, but it just looks plain/boring.
#296
Re: Need help getting started - PHP, MySQL, Item/Part Configurator
Posted 19 March 2009 - 01:30 PM
#297
Re: Need help getting started - PHP, MySQL, Item/Part Configurator
Posted 19 March 2009 - 01:32 PM
I always seem to be one step behind you because I just came across that as well.
Thanks
Thanks
|
|

New Topic/Question
Reply





MultiQuote




|