Jump to content

PHPilliterate

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

PHPilliterate's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks for the help I will give it a try.
  2. I have an issue with a schedule. In one line of my table for "time", but being new to phpmysql, I made the mistake of having my data as "9:00AM" or "6:30PM".The problem is that my sort for "time" shows as 6:00PM is earlier than 9:00AM. Here is script for the sorting: SELECT * FROM ALFL WHERE (visitorTeam LIKE '%ParamvisitorTeam%' OR '-1' = 'ParamvisitorTeam') OR (homeTeam LIKE '%ParamhomeTeam%' OR '-1' = 'ParamhomeTeam') ORDER BY MONTH ASC, day, time, diamond Is there a "php for idiots" type of solution for this?
  3. Thanks IsmAvatar 1) Currently, it is the INSERT function that is used. But the problem is that once the score is inserted into the DB, it is still able to be changed. How do I make it so that once a score is entered, the record can not be edited through the web page?
  4. Howdy! I have a site for a baseball league. Currently, users can login to enter their scores after games. This is OK, but need some help. 1) How can I set mysql to disallow editing a score after it has been submitted? Do i do that through php script or mysql? 2) Teams have 14 days to enter their score....how do I lock down records that are more than 14 days past the date the game was played? Any and all help is welcome And in "simple as possible" terms.....my name says it all
  5. Would it be easier if I posted my code for my pages? Then you can see what I have and be able to better direct me as to how I can make it work... From my login page... <?php mysql_select_db($database_alflregister, $alflregister); $query_Login = "SELECT username, userpass FROM login"; $Login = mysql_query($query_Login, $alflregister) or die(mysql_error()); $row_Login = mysql_fetch_assoc($Login); $totalRows_Login = mysql_num_rows($Login); ?><?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['select'])) { $loginUsername=$_POST['select']; $password=$_POST['textfield']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "ALFL_Score.php"; $MM_redirectLoginFailed = "../../About us.html"; $MM_redirecttoReferrer = true; 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']) && true) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> From the page that they enter their score... <?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = ""; $MM_donotCheckaccess = "true"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && true) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "ALFL_Schedule.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?>
  6. ok...now i'm confused... :'( I created a login page, then set the restriction on the UPDATE page. So once a user clicks on my ENTER SCORE link, it gives them an URL like schedule/alfl/ALFL_Score.php?ID=25 (or whichever ID=XX for that line item)...and redirects to the LOGIN page... But once they login, the URL is schedule/alfl/ALFL_Score.php...so it does not show any info from ID=25. How do I have a successful login go to the proper page? Sorry if I'm not making much sense. I'm very new to php. I should also mention that I am using DW8 and it's "easy to use" features.
  7. So do I make that session in the header of the update page before the script that checks for access rights?
  8. I already have the login page set-up and the DB of names/passwords. My problem (so far) is that my login page does not direct a succesfull login properly. Say the item they are updating is line 25 from my DB, they should have an URL that is something like schedule/alfl/ALFL_Score.php?ID=25....but after a successfull login they are directed to schedule/alfl/ALFL_Score.php which shows no information.
  9. Howdy! I have a page that shows the schedule for a baseball league. All the info is drawn from my DB. For each line of the schedule, I have a link to update that item so users can enter their score after each game. What I want to do is password protect the UPDATE page so that only someone from the visitor or home team can enter the score. How can this be done? ??? I am not very php skilled. ANy and all help is greatly appreciated.
  10. Thanks MAXUDASKIN That worked ...sort of... Still one minor glitch...The search only pulls results if BOTH the textfield is entered and the checkbox selected. I would like it to search as EITHER the textfield or the checkbox are used...or BOTH are used... eg..search for YANKEES to get their schedule or search for YANKEES and <rainouts> for their raindelayed games or search for just <rainouts> for the entire league. Is that possible to do?
  11. OK...the DB is valid and the page on first load shows all records (like it is supposed to), but the SEARCH form does not work. Can anyone explain why? <?php if (isset($_GET['S_homeTeam']) && $_GET['S_homeTeam'] == "") { $_GET['S_homeTeam'] = "-1"; } ?> <?php if (isset($_GET['S_rainout'])) { $_GET['S_rainout'] = "1"; } ?> <?php if (!session_id()) session_start(); if (isset($_SESSION["ALFL_Results_QueryString"]) && ($_SESSION["ALFL_Results_QueryString"] != "") && !isset($_SERVER["QUERY_STRING"]) ){ header("Location: ALFL_Schedule.php?".str_replace("&totalRows_","&old_totalRows_",$_SESSION["ALFL_Results_QueryString"])); } else{$_SESSION["ALFL_Results_QueryString"] = isset($_SERVER["QUERY_STRING"])?$_SERVER["QUERY_STRING"]:""; } ?> <?php $maxRows_WADAALFL = 20; $pageNum_WADAALFL = 0; if (isset($_GET['pageNum_WADAALFL'])) { $pageNum_WADAALFL = $_GET['pageNum_WADAALFL']; } $startRow_WADAALFL = $pageNum_WADAALFL * $maxRows_WADAALFL; $ParamvisitorTeam_WADAALFL = "-1"; if (isset($ParamvisitorTeam_WADAALFL)) { $ParamvisitorTeam_WADAALFL = (get_magic_quotes_gpc()) ? $_GET['S_homeTeam'] : addslashes($_GET['S_homeTeam']); } $ParamhomeTeam_WADAALFL = "-1"; if (isset($_GET['S_homeTeam'])) { $ParamhomeTeam_WADAALFL = (get_magic_quotes_gpc()) ? $_GET['S_homeTeam'] : addslashes($_GET['S_homeTeam']); } $Paramrainout_WADAALFL = "0"; if (isset($_GET['S_rainout'])) { $Paramrainout_WADAALFL = (get_magic_quotes_gpc()) ? $_GET['S_rainout'] : addslashes($_GET['S_rainout']); } mysql_select_db($database_schedule, $schedule); $query_WADAALFL = sprintf("SELECT * FROM ALFL WHERE (visitorTeam LIKE '%%%s%%' OR '-1' = '%s') OR (homeTeam LIKE '%%%s%%' OR '-1' = '%s') OR (rainout = %s OR '0' = '%s') ORDER BY ID ASC", $ParamvisitorTeam_WADAALFL,$ParamvisitorTeam_WADAALFL,$ParamhomeTeam_WADAALFL,$ParamhomeTeam_WADAALFL,$Paramrainout_WADAALFL,$Paramrainout_WADAALFL); $query_limit_WADAALFL = sprintf("%s LIMIT %d, %d", $query_WADAALFL, $startRow_WADAALFL, $maxRows_WADAALFL); $WADAALFL = mysql_query($query_limit_WADAALFL, $schedule) or die(mysql_error()); $row_WADAALFL = mysql_fetch_assoc($WADAALFL); if (isset($_GET['totalRows_WADAALFL'])) { $totalRows_WADAALFL = $_GET['totalRows_WADAALFL']; } else { $all_WADAALFL = mysql_query($query_WADAALFL); $totalRows_WADAALFL = mysql_num_rows($all_WADAALFL); } $totalPages_WADAALFL = ceil($totalRows_WADAALFL/$maxRows_WADAALFL)-1; ?> <?php $queryString_WADAALFL = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_WADAALFL") == false && stristr($param, "totalRows_WADAALFL") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_WADAALFL = "&" . htmlentities(implode("&", $newParams)); } } $queryString_WADAALFL = sprintf("&totalRows_WADAALFL=%d%s", $totalRows_WADAALFL, $queryString_WADAALFL); ?> <?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 //WA Alternating Class $WARRT_AltClass1 = new WA_AltClassIterator(explode("|", "WADAResultsRowDark|")); ?> <head> <!-- Copyright 2005 Macromedia, Inc. All rights reserved. --> <!-- InstanceBeginEditable name="doctitle" --> <title>Results ALFL</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="mm_training.css" type="text/css" /> <style type="text/css"> <!-- .style1 { color: #FF0000; font-style: italic; font-weight: bold; font-size: 36px; } .style2 {font-size: 28px} .style9 { font-size: large; font-weight: bold; } .style21 {color: #FFCC00; font-size: 24px;} .style22 {color: #D3DCE6} .style24 {color: #FF0000} --> </style> <!-- InstanceEndEditable --> <meta name="keywords" content="airdrie,slo-pitch,fastball,alberta, SPN, NSA,easton bats, worth bats,slo-pitch bats,baseball bats,slopitch,softball,baseball,sports,chinook winds," /> <meta name="description" content="mixed slopitch, men's slopitch, ladies fastball leagues,Slopitch in airdrie,airdrie slopitch, airdrie sports, recreation in airdrie,alberta slopitch,alberta fastball" /> <!-- InstanceBeginEditable name="head" --> <link href="WA_DataAssist/styles/Refined_Pacifica.css" rel="stylesheet" type="text/css" /> <link href="WA_DataAssist/styles/Arial.css" rel="stylesheet" type="text/css" /> <!-- InstanceEndEditable --> </head> <body bgcolor="#26354A"> <table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#26354A"> <tr bgcolor="#26354A"> <td width="20" nowrap="nowrap"><img src="mm_spacer.gif" alt="" width="20" height="1" border="0" /></td> <td width="100%" height="70" align="left" nowrap="nowrap" bgcolor="#26354A" class="logo"><span class="style2">CHINOOK WINDS</span> <span class="style1">XTRA</span> <span class="tagline">| online community for CHINOOK WINDS supporters <img src="images/leaf.gif" width="48" height="42" /></span></td> </tr> <tr bgcolor="#FF6600"> <td colspan="4"><img src="mm_spacer.gif" alt="" width="1" height="4" border="0" /></td> </tr> <tr bgcolor="#D3DCE6"> <td colspan="4"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td> </tr> <tr bgcolor="#FFCC00"> <td width="20" nowrap="nowrap"> </td> <td height="24" colspan="3" bgcolor="#FFCC00"> <table border="0" cellpadding="0" cellspacing="0" id="navigation"> <tr> <td class="navText" align="center" nowrap="nowrap"><a href="history.html">OUR HISTORY </a></td> <td class="navText" align="center" nowrap="nowrap"><a href="facility.html">THE FACILITY </a></td> <td class="navText" align="center" nowrap="nowrap"><a href="leagues.html">LEAGUES</a></td> <td class="navText" align="center" nowrap="nowrap"><a href="http://www.chinookwindsxtra.org/forum/index.php" target="_blank">XTRA FORUM</a><a href="javascript:;"></a></td> <td class="navText" align="center" nowrap="nowrap"><a href="sponsors.html">SPONSORS</a></td> <td class="navText" align="center" nowrap="nowrap"><a href="index.html">HOME</a></td> </tr> </table> </td> </tr> <tr bgcolor="#D3DCE6"> <td colspan="4"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td> </tr> <tr bgcolor="#FF6600"> <td colspan="4"><img src="mm_spacer.gif" alt="" width="1" height="4" border="0" /></td> </tr> <tr bgcolor="#D3DCE6"> <td colspan="4"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td> </tr> <tr bgcolor="#26354A"> <td colspan="4"> </td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="230" height="286" valign="top"><img src="images/index%20logo.gif" alt="CWXlogo" width="230" height="286" /></td> <td width="5" rowspan="5"> </td> <td rowspan="5" align="left" valign="top" bgcolor="#D3DCE6"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#96007B"> <tr> <td height="1" colspan="2" align="center" bordercolor="#D3DCE6" bgcolor="#FFFFFF"><img src="images/mm_spacer.gif" width="1" height="1" /></td> <td width="230" rowspan="6" align="left" valign="top" bgcolor="#26354A"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" bordercolor="#26354A" bgcolor="#26354A"></td> </tr> </table> <p class="sidebarText style8 style9"> </p></td> </tr> <tr> <td height="39" colspan="2" align="center" bordercolor="#D3DCE6" bgcolor="#96007B" class="style21"><!-- InstanceBeginEditable name="EditRegion4" --> <p>Select Your Team </p> <!-- InstanceEndEditable --></td> </tr> <tr> <td height="1" colspan="2" align="center" bordercolor="#D3DCE6" bgcolor="#FFFFFF"><img src="images/mm_spacer.gif" width="1" height="1" /></td> </tr> <tr> <td width="141" bordercolor="#D3DCE6" bgcolor="#D3DCE6"> </td> <td width="399" bordercolor="#D3DCE6" bgcolor="#D3DCE6"> </td> </tr> <tr> **body** <div class="WADASearchContainer"> <form action="ALFL_Schedule.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">homeTeam:</th> <td class="WADADataTableCell"><input type="text" name="S_homeTeam" id="S_homeTeam" value="" size="32" /></td> </tr> <tr> <th class="WADADataTableHeader">rainout:</th> <td class="WADADataTableCell"><input type="checkbox" name="S_rainout" id="S_rainout" value="1" /></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>
  12. :'( That didn't work. I restarted the whole thing again... Here is my code. By entering a term in my search field, nothing happens.
  13. I created a DB that has a column visitorTeam and a column homeTeam. I am trying to create a search that will find all records that contain the search. I can easily have it pull the recordset for homeTeam, but I need help with how to make it search and display both $colname_WADAALFL = "-1"; if (isset($_GET['searchTeam'])) { $colname_WADAALFL = (get_magic_quotes_gpc()) ? $_GET['searchTeam'] : addslashes($_GET['searchTeam']); } mysql_select_db($database_schedule, $schedule); $query_WADAALFL = sprintf("SELECT * FROM ALFL WHERE homeTeam = '%s' ORDER BY ID ASC", $colname_WADAALFL);
  14. Can anyone help me with this one line?? $MM_redirectLoginSuccess = "cwplayers_Results.php?query=".$_SESSION['query']"";
×
×
  • 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.