PHPilliterate Posted January 20, 2008 Share Posted January 20, 2008 Howdy, I used DataAssist to create a search and results page....but once I used the DW LOGIN behavior on my search page, my results page is not working Here is the code for the original search page: <div class="WADASearchContainer"> <form action="cwplayers_Results.php" method="get" name="WADASearchForm" id="WADASearchForm"> <div class="WADAHeader">Search</div> <div class="WADAHorizLine"><img src="WA_DataAssist/images/Pacifica/Refined_tx.gif" alt="" height="1" width="1" border="0" /></div> <table class="WADADataTable" cellpadding="0" cellspacing="0" border="0"> <tr> <th class="WADADataTableHeader">team:</th> <td class="WADADataTableCell"><select name="S_team" id="S_team"> </select></td> </tr> </table> <div class="WADAHorizLine"><img src="WA_DataAssist/images/Pacifica/Refined_tx.gif" alt="" height="1" width="1" border="0" /></div> <div class="WADAButtonRow"> <table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="WADADataNavButtonCell" nowrap="nowrap"><input type="image" hspace="0" vspace="0" border="0" name="Search" id="Search" value="Search" alt="Search" src="WA_DataAssist/images/Pacifica/Refined_search.gif" /></td> </tr> </table> </div> </form> </div> <!-- InstanceEndEditable --> </td> </tr> <tr> <td height="396" colspan="2" align="center" valign="top" bordercolor="#D3DCE6" bgcolor="#D3DCE6"><p class="style26 style16 style22"></p></td> </tr> <tr> <td colspan="2" bordercolor="#D3DCE6" bgcolor="#D3DCE6"> </td> <td width="230" align="center" valign="top" bordercolor="#D3DCE6" bgcolor="#26354A"> </td> </tr> </table></td> </tr> <tr> <td width="230" height="1"> </td> </tr> <tr> <td width="230" align="center" valign="top"></tr> <tr> <td width="230"> </td> </tr> <tr> <td width="230" align="center"> </td> </tr> </table> Once I added the login behavior this is what I got: <?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['S_team'])) { $loginUsername=$_POST['S_team']; $password=$_POST['password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "cwplayers_Results.php?<?php echo $_SESSION['WADA_Insert_cwplayers']; ?>="; $MM_redirectLoginFailed = "cwreg.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_alflregister, $alflregister); $LoginRS__query=sprintf("SELECT username, userpass FROM login WHERE username='%s' AND userpass='%s'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); $LoginRS = mysql_query($LoginRS__query, $alflregister) 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 ); } } ?> <div class="WADASearchContainer"> <form action="<?php echo $loginFormAction; ?>" method="POST" name="WADASearchForm" id="WADASearchForm"> <div class="WADAHeader"></div> <div class="WADAHorizLine"><img src="WA_DataAssist/images/Pacifica/Refined_tx.gif" alt="" height="1" width="1" border="0" /></div> <table class="WADADataTable" cellpadding="0" cellspacing="0" border="0"> <tr> <th class="WADADataTableHeader">Team:</th> <td class="WADADataTableCell"><select name="S_team" id="S_team"> <?php do { ?> <option value="<?php echo $row_Recordset1['team']?>"><?php echo $row_Recordset1['team']?></option> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); $rows = mysql_num_rows($Recordset1); if($rows > 0) { mysql_data_seek($Recordset1, 0); $row_Recordset1 = mysql_fetch_assoc($Recordset1); } ?> </select></td> </tr> <tr> <th class="WADADataTableHeader">Password:</th> <td class="WADADataTableCell"><input name="password" type="text" id="password" value="ENTER PASSWORD" /></td> </tr> </table> <div class="WADAHorizLine"><img src="WA_DataAssist/images/Pacifica/Refined_tx.gif" alt="" height="1" width="1" border="0" /></div> <div class="WADAButtonRow"> <table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="WADADataNavButtonCell" nowrap="nowrap"><input type="Submit" name="Search" id="Search" value="Search" /></td> </tr> </table> </div> </form> </div> And this is the the code for the results page: <?php if (isset($_GET['S_team']) && $_GET['S_team'] == "") { $_GET['S_team'] = "-1"; } ?> <?php if (!session_id()) session_start(); if (isset($_SESSION["cwplayers_Results_QueryString"]) && ($_SESSION["cwplayers_Results_QueryString"] != "") && !isset($_SERVER["QUERY_STRING"]) ){ header("Location: cwplayers_Results.php?".str_replace("&totalRows_","&old_totalRows_",$_SESSION["cwplayers_Results_QueryString"])); } else{$_SESSION["cwplayers_Results_QueryString"] = isset($_SERVER["QUERY_STRING"])?$_SERVER["QUERY_STRING"]:""; } ?> <?php $maxRows_WADAcwplayers = 1000; $pageNum_WADAcwplayers = 0; if (isset($_GET['pageNum_WADAcwplayers'])) { $pageNum_WADAcwplayers = $_GET['pageNum_WADAcwplayers']; } $startRow_WADAcwplayers = $pageNum_WADAcwplayers * $maxRows_WADAcwplayers; $Paramteam_WADAcwplayers = "-1"; if (isset($_GET['S_team'])) { $Paramteam_WADAcwplayers = (get_magic_quotes_gpc()) ? $_GET['S_team'] : addslashes($_GET['S_team']); } mysql_select_db($database_alflregister, $alflregister); $query_WADAcwplayers = sprintf("SELECT * FROM cwplayers WHERE (team LIKE '%s' OR '-1' = '%s') ORDER BY team ASC", $Paramteam_WADAcwplayers,$Paramteam_WADAcwplayers); $query_limit_WADAcwplayers = sprintf("%s LIMIT %d, %d", $query_WADAcwplayers, $startRow_WADAcwplayers, $maxRows_WADAcwplayers); $WADAcwplayers = mysql_query($query_limit_WADAcwplayers, $alflregister) or die(mysql_error()); $row_WADAcwplayers = mysql_fetch_assoc($WADAcwplayers); if (isset($_GET['totalRows_WADAcwplayers'])) { $totalRows_WADAcwplayers = $_GET['totalRows_WADAcwplayers']; } else { $all_WADAcwplayers = mysql_query($query_WADAcwplayers); $totalRows_WADAcwplayers = mysql_num_rows($all_WADAcwplayers); } $totalPages_WADAcwplayers = ceil($totalRows_WADAcwplayers/$maxRows_WADAcwplayers)-1; ?> <?php $queryString_WADAcwplayers = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_WADAcwplayers") == false && stristr($param, "totalRows_WADAcwplayers") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_WADAcwplayers = "&" . htmlentities(implode("&", $newParams)); } } $queryString_WADAcwplayers = sprintf("&totalRows_WADAcwplayers=%d%s", $totalRows_WADAcwplayers, $queryString_WADAcwplayers); ?> <?php //WA AltClass Iterator class WA_AltClassIterator { var $DisplayIndex; var $DisplayArray; function WA_AltClassIterator($theDisplayArray = array(1)) { $this->ClassCounter = 0; $this->ClassArray = $theDisplayArray; } function getClass($incrementClass) { if (sizeof($this->ClassArray) == 0) return ""; if ($incrementClass) { if ($this->ClassCounter >= sizeof($this->ClassArray)) $this->ClassCounter = 0; $this->ClassCounter++; } if ($this->ClassCounter > 0) return $this->ClassArray[$this->ClassCounter-1]; else return $this->ClassArray[0]; } } ?><?php I don't know if the problem is the form for the original code is method="get" and the login code is method="post"....or is the problem that a session is not passing....I'm lost and need to have this resolved fast........ Quote Link to comment https://forums.phpfreaks.com/topic/86868-dreamweaver-and-dataassist-problem/ 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.