Jump to content

jworisek

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jworisek's Achievements

Member

Member (2/5)

0

Reputation

  1. I dont think you read my post... the first attempt at login the authentication sets one session id and then the index page tries to use the session id from the last successful connection (not the one the auth page just used) by that user. as I said: the session isnt being transferred properly between pages and I was just trying to show that. Besides which, checking the session variable wouldn't be acceptable if it was trying to use an old session id.
  2. I've been messing around with this on and off for a while now and I just cant figure it out... I have three pages. login.php authentication.php index.php you type your user/pass on login and it takes you to the auth page. On auth I verify the user/pass and if they are correct I start the session, register session variable names, and set the variables. Then I use header() to send the user to index.php. Index then checks to make sure the user is authorized. When I do this, I get a new session id from the auth page, and then the index page tries to use the session id from the last successful login from that user. The variance in session ids causes my script to kick the user back to the login page. The second time the user tries to login the auth page has another new session id but this time the index page also uses the same id and it works fine. To logout I have a link that takes the user to a page that uses session_destroy(); here is the basic code: auth <?php //verify login credentials if (mysqli_num_rows($result)==1){//verified session_start(); //CHECKPOINT#1 session_register('curr_sess_id'); $_SESSION[curr_sess_id]=session_id(); //CHECKPOINT#2 header('http://mydomain.com/protected/index.php') exit; } else{ //return back to login with error } ?> index <?php session_start(); //CHECKPOINT#3 if ($_SESSION[curr_sess_id]==session_id()){//this is not the check that I do, I am just trying to simplify it // good} } else{ // kick user back to login } ?> On the first attempt you would get CHECKPOINT#1 session id=g20i9aj6j78f61ceq4ecj8vj65 curr_sess_id= CHECKPOINT#2 session id=g20i9aj6j78f61ceq4ecj8vj65 curr_sess_id=g20i9aj6j78f61ceq4ecj8vj65 CHECKPOINT#3 session id=kcne7s5fbfcpeukuq2mrselgg4 curr_sess_id=kcne7s5fbfcpeukuq2mrselgg4 On the second attempt I get: CHECKPOINT#1 session id=c30fi9pfctt2i18mn68822skm3 curr_sess_id= CHECKPOINT#2 session id=c30fi9pfctt2i18mn68822skm3 curr_sess_id=c30fi9pfctt2i18mn68822skm3 CHECKPOINT#3 session id=c30fi9pfctt2i18mn68822skm3 curr_sess_id=c30fi9pfctt2i18mn68822skm3 Anyone have an idea? It happens on multiple browsers and PCs. could it be something with settings in php.ini?
  3. well its really hard to know what you are expecting.... post the rows of data that you should be getting... you weren't getting 3 repeated rows of the same data to begin with.
  4. I'm confused by what is so difficult here... all you need are if/else statements on the next page to determine which query to apply...
  5. I think its you query... try this: SELECT * FROM smf_messages, smf_topics WHERE smf_messages.ID_BOARD = smf_topics.ID_BOARD AND smf_topics.ID_BOARD = ' . $BoardID; You are never specifying how to join the tables so the query doesn't join them... it looks for results in one table then pulls results for the next (I think).
  6. what is being echoed 3 times? are you pulling 3 results from your query?
  7. check these out... http://www.databasejournal.com/sqletc/article.php/1428511 http://databases.about.com/od/specificproducts/a/normalization.htm
  8. actually, I would move the $customer_id clause to the where...like SELECT orders.order_date, orders.received_date, orders.updated_date,orders.received_by,orders.destroyed_by,orders.model_number, orders.serial_number, orders.capacity, orders.confirmation_id, customers.contact_name, customers.contact_phone, manufacturers.manufacture_name FROM orders LEFT JOIN customers on orders.customer_id = customers.customer_id LEFT JOIN manufacturers on orders.manufacturer_id=manufacturers.manufacturer_id WHERE orders.confirmation_id ='$confirmation_id' AND orders.customer_id = '$customer_id'
  9. LEFT JOIN customers on orders.customer_id = $customer_id you arent stating how customers should be joined... should probably be: LEFT JOIN customers on (orders.customer_id = customers.customer_id and customers.customer_id = $customer_id)
  10. the exact table structure is irrelevant... only that there is a unique identifier in table1 and a unique identifier in table2. in this case you could use ID as the table1 id short as the table2 id if table1 only stores ID and SERVICES, then you can restructure table1 and you have no need for table 3. I'm just saying if you make them all on their own rows with the same ID, then it is very easy to write the query since you have established a direct relation.
  11. let me know if I am understanding you correctly.... table1 t1_id short other ------------------ 1 a,b,e,f ........ 2 a,f ......... etc. table2 t2_id short long --------------------- 1 A Apple 2 B Ball 3 E Egg 4 F Fly etc... what I am saying is remove the short column from table1 and make a tabl3 that would look like: table3 t1_id t2_id ----------------- 1 1 1 2 1 3 1 4 2 1 2 4 The same data is stored, table3 just allows you to relate the data in an easier fashion.
  12. the simplest way to do it with mysql would be to make it relational... table 1 (t1_id, other_data) table2 (t2_id, short, long) table3 (t1_id, t2_id) Then you don't have to mess around with breaking up strings to make joins. SELECT long from table1 t1 INNER JOIN table3 t3 ON (t1.t1_id=t3.t1_id) INNER JOIN table2 t2 ON (t3.t2_id=t2.t2_id)
  13. are you pulling many records at the same time for this? it would be easy to make into an array after you pull it out and just do it with a second query.
  14. SELECT long FROM table1 t1 INNER JOIN table2 t2 ON (t1.short=t2.short)
  15. have you checked that you have update privileges for that user? I'm assuming you verified that the variables are actually being put in the query by echoing it back?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.