Need help getting started - PHP, MySQL, Item/Part Configurator

  • (20 Pages)
  • +
  • « First
  • 18
  • 19
  • 20

296 Replies - 10529 Views - Last Post: 19 March 2009 - 01:32 PM Rate Topic: -----

#286 noboost4you  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 171
  • Joined: 28-January 09

Re: Need help getting started - PHP, MySQL, Item/Part Configurator

Posted 17 March 2009 - 08:00 AM

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
Was This Post Helpful? 0
  • +
  • -

#287 noboost4you  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 171
  • Joined: 28-January 09

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!
Was This Post Helpful? 0
  • +
  • -

#288 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2834
  • View blog
  • Posts: 9,740
  • Joined: 08-August 08

Re: Need help getting started - PHP, MySQL, Item/Part Configurator

Posted 17 March 2009 - 10:25 AM

View Postnoboost4you, on 17 Mar, 2009 - 10:33 AM, said:

Onto emailing the quotes!

That should like very similar to emailparts(). Post your function if you have trouble.
Was This Post Helpful? 0
  • +
  • -

#289 noboost4you  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 171
  • Joined: 28-January 09

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;
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?
Was This Post Helpful? 0
  • +
  • -

#290 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2834
  • View blog
  • Posts: 9,740
  • Joined: 08-August 08

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();
...

Was This Post Helpful? 0
  • +
  • -

#291 noboost4you  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 171
  • Joined: 28-January 09

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!
Was This Post Helpful? 0
  • +
  • -

#292 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2834
  • View blog
  • Posts: 9,740
  • Joined: 08-August 08

Re: Need help getting started - PHP, MySQL, Item/Part Configurator

Posted 17 March 2009 - 12:51 PM

View Postnoboost4you, 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.

;)
Was This Post Helpful? 0
  • +
  • -

#293 noboost4you  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 171
  • Joined: 28-January 09

Re: Need help getting started - PHP, MySQL, Item/Part Configurator

Posted 17 March 2009 - 01:44 PM

View PostCTphpnwb, on 17 Mar, 2009 - 02:51 PM, said:

View Postnoboost4you, 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.
Was This Post Helpful? 0
  • +
  • -

#294 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2834
  • View blog
  • Posts: 9,740
  • Joined: 08-August 08

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!
Was This Post Helpful? 0
  • +
  • -

#295 noboost4you  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 171
  • Joined: 28-January 09

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.
Was This Post Helpful? 0
  • +
  • -

#296 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2834
  • View blog
  • Posts: 9,740
  • Joined: 08-August 08

Re: Need help getting started - PHP, MySQL, Item/Part Configurator

Posted 19 March 2009 - 01:30 PM

Look at example #4:

http://www.php.net/function.mail
Was This Post Helpful? 0
  • +
  • -

#297 noboost4you  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 171
  • Joined: 28-January 09

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
Was This Post Helpful? 0
  • +
  • -

  • (20 Pages)
  • +
  • « First
  • 18
  • 19
  • 20