r2ks Posted March 24, 2009 Share Posted March 24, 2009 Hello everyone, I am trying to Create a Basic pledge website. This is where a user will login and they will be Given all there Pledges. my question is i have the Login page all done where would i put the sql select statment ?? if any one could help that would be Great <?php require_once('Connections/myserver.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } ?> <?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['username'])) { $loginUsername=$_POST['username']; $password=$_POST['password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "Customers.php"; $MM_redirectLoginFailed = "fail.html"; $MM_redirecttoReferrer = false; mysql_select_db($database_myserver, $myserver); $LoginRS__query=sprintf("SELECT username, password FROM login WHERE username=%s AND password=%s", GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); $LoginRS = mysql_query($LoginRS__query, $myserver) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } $mm ?> <!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=utf-8" /> <title>Untitled Document</title> </head> <body> <table width="743" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="122" rowspan="2" valign="top"><!--DWLayoutEmptyCell--> </td> <td width="621" height="60" valign="top"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td height="130" valign="top"><div align="center"> <p>Welcome to myserver</p> <p> </p> </div> <form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>"> <table width="300" border="0" cellspacing="1" cellpadding="0"> <tr> <td>User Name:</td> <td><input type="text" name="username" id="username" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password" id="password" /></td> </tr> <tr> <td> </td> <td><input type="submit" name="button" id="button" value="Submit" /> Please Sign Up</td> </tr> </table> <p> </p> </form> <p> </p></td> </tr> </table> </body> </html> Quote Link to comment Share on other sites More sharing options...
trq Posted March 24, 2009 Share Posted March 24, 2009 What sql statement would that be? Quote Link to comment Share on other sites More sharing options...
r2ks Posted March 24, 2009 Author Share Posted March 24, 2009 Select statment you see i have a login table with loginid,username,password, and pledge table cusid, fname,laname, and loginid so when the user logs in they will go the success page with there cusinfo. Quote Link to comment Share on other sites More sharing options...
trq Posted March 24, 2009 Share Posted March 24, 2009 Um, isn't that already covered int he code you posted? Quote Link to comment Share on other sites More sharing options...
r2ks Posted March 24, 2009 Author Share Posted March 24, 2009 Hmm yeah i guess you could say it is, I am really new at all this let try to simplefy it for ME Login in page and sucess page (BILL) logs in and he has ( mary and Joe ) as pledges on there fundraser i want the only ones to come up on the sucess page is ( Mary and Joe). (Mike) Logs in he has (Steve and Mark) as pledges i only want him to see them as it stands Know when (Bill) logs in he see's all pledges not just his I really am hopeing i am not makeing this to Complicated Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.