Jump to content

tamumech

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tamumech's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry about that. Here is a clearer version: table name = players player_idposition1position2 00352 00431 00523 table name = positions position_idposition 11B 22B 33B 4SS 5OF The result I want is: player_idposition1position2 003OF2B 0043B1B 0052B3B kirk112, Can you explain what p1, p2, and py represent? I have also tried to do two LEFT JOINs but have gotten an error message because you can't join the same table twice. I haven't used the AS statement yet though...
  2. Well I guess what I'll have to do is just make another position table (a duplicate of the first) and just do a regular LEFT JOIN for the three tables. If anyone knows a better way to do it please post.
  3. Hi I am making a database of baseball players and their positions. Each player usually has at least two positions. I have two tables like this (simplified): Players: position1position2 31 23 12 Positions: Position IDPosition 1First Base 2Second Base 3Third Base I need to do a joins so that I can print both positions and not the position IDs, but I don't know how to do that when there are 3 columns? I have had no luck so far. Thanks! -Tim
  4. Hi php freaks. I am having a problem with passing values to my include files. Here's the deal. In one of my files I might write: (saving this as http://www.mysite.com/file.php) $variable = 'value'; include("http://www.mysite.com/include.php"); Where include.php is: echo "$variable"; And everything would work fine. However, if include.php was saved in a different location such as: http://www.mysite.com/subdirectory/include.php, nothing would echo. I would write: $variable = 'value'; include("http://www.mysite.com/subdirectory/include.php"); I don't understand this because I am writing out the full URL. Thanks in advance for your help!
  5. Hi all. I am inserting a lot of data into a MySQL integer column via an html form. When a field in the form is left blank, I want the value in MySQL to be NULL, but it keeps inputting '0'. The default value for my column is NULL. I don't really think there is a simple way to do this on the php side (using a hidden form to set blank entries equal to NULL would require an extra page), so I was wondering if MySQL had some sort of capability. Here's a snippet. UPDATE table SET column1 = '$_POST[$value1]', column2 = '$_POST[$value2]' WHERE id = '$_POST[$id]'
  6. When the user logs in, set $_SESSION['auth'] to TRUE or whatever. Then on each page check it like this: <?php session_start(); if ( @$_SESSION['auth'] != "TRUE" ) { header("Location: login.php"); die(); } ?>
  7. whew! I didn't even think of data checking here. For some reason I thought I took care of all that during registration. Thanks for the heads up!
  8. OK. So I'm assuming I handled the tokens correctly?
  9. Hi all. I wanted to run this by you guys to make sure I'm not making any huge security mistakes. As suggested before, each page generates a random token that is required by the next page. My Login page: <?php // If it hasn't been submitted if ( !$_POST[login_submit] ) { include ("login_form.inc"); die(); } // Check for blanks foreach ($_POST as $input ) { if ( $input == "" ) { echo "You must enter a Username and Password."; include ("login_form.inc"); die(); } } // Encrypt password $crypt_pass = md5($_POST[password]); // Verify user include("today.inc"); $connect = mysql_connect($host, $user, $pass) or die('Failure to connect to Database. Please contact us at customer support'); $db_connect = mysql_select_db($db) or die ('Failure to select Database. Please contact us at customer support'); $select = "SELECT email FROM schools WHERE email = '$_POST[email]' AND password = '$crypt_pass'"; $result = mysql_query($select) or die('Could not execute query'); $num_rows = mysql_num_rows($result); // Start session and redirect if ( $num_rows > '0' ) { session_start(); session_regenerate_id(); $_SESSION['auth'] = TRUE; $token = md5(uniqid(rand(),TRUE)); $_SESSION['token'] = $token; header("Location: http://www.website.com?token=$token"); } // get outta my house else { echo "Invalid Username or Password."; include ("login_form.inc"); die(); } ?> And the includes file at the top of every restricted page: <?php session_start(); if ( $_SESSION['auth'] != "TRUE" || $_SESSION['token'] != $_GET['token'] ) { header('Location: login.php'); die(); } $token = md5(uniqid(rand(),TRUE)); $_SESSION['token'] = $token; ?> An example page: <?php include("top.inc"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <a href="player_counter.php<?php echo "?token=$token" ?>">Click Here</a> <p>Members Only</p> </body> </html>
  10. Alright, do I have to do that on every hyper link on the page. Good times. Thanks fellas.
  11. I understand how to store session data, but how do I use it in GET or POST requests? I am actually trying to store something in the URL, and something in a session cookie. Is there a way to do that without a form appearing on the page? Thanks
  12. Hi, I am trying to implement a token identifier with a session. Can anyone explain to me how store it in the session data and use in get or post requests? Thanks -Tim
  13. stoker- Would I just put the POST and GET data in a form to transfer it from page to page? Or is there another way? Why would I pass it in the URL if I can use POST? ie: <?php <form action = "$_SERVER['PHP_SELF']" method = "GET"> <input type = "hidden" value = "$_GET['key']"> </form> ?> Hypnos- Do you recommend a place to get SSL? Is the open source any good? Thanks for all your help.
×
×
  • 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.