Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. Oh i forgot to say.. another option would be to update the action via a javascript
  2. also turn on error reporting as your sprintf will fail you accept 7 parameters and only pass 6 your missing name //let's create the query $query = sprintf("INSERT INTO subscriptions ( name, email_address, membership_type, terms_and_conditions, name_on_card, credit_card_number, credit_card_expiration_data) VALUES ('%s','%s','%s','%s','%s','%s','%s')", $_SESSION['name'], ///<-----MAYBE ??? $_SESSION['email_address'], $_SESSION['membership_type'], $_SESSION['terms_and_conditions'], $_POST['name_on_card'], $_POST['credit_card_number'], $_POST['credit_card_expiration_data']);
  3. if your using one form for each "open page" button then you could put it in the action ie this is the correct way to pass the # in a form <form action="<?php echo '../showSql.php?file='.$rgn.'/' . $pageId . $idx; ?>" I assume you wish to use the # to jump down to a anchor on the next page, a possible third option would be to create a middle page that you can use get or post to and that would process the form and redirect to the next page with an anchor, it really depends on what your goal is. Hope that helps
  4. Do you have a list of actions you wish to perform via an API ?
  5. while that's true the default set-up for sessions uses a cookie to store the session id, if cookies are disabled then your need to pass the session id via the URL, which seams pointless on a page that redirects! and also when you leave the site and re-enter the link to the session id would be lost, so if cookies are disabled then sessions won't provide much of a solution either!
  6. Well said, Namtip this is the actual reason i suggested cookies
  7. Okay first of all their no need to be condescending, The reason you didn't pick another may of been you don't know another, (considering this actual problem) I was giving you an alternative as your form was pretty basic!, if your form was more complex then i would of given you the you the answer your looking for and in fact I have partly given you the answer.. good day!
  8. you can't get a REST tutorial for an API that doesn't exist! the fact is your attempting to write something that's going to be unique to your site, with the info above, I'm not sure what else your need, other then working out what you need to access via the API and what inputs and outputs your going to be using
  9. That's because the form encodes the hash, why not just uses an anchor tag ? eg echo '<a href="../showSql.php?file='.$rgn.'/' . $pageId . $idx.'">Open Page</a>';
  10. might as well use a cookie!
  11. Sounds about right to me
  12. REST is a concept REpresentational State Transfer
  13. change $orderBy = " ORDER BY `Date Added` ASC"; to $orderBy = " ORDER BY `Date Added` DESC";
  14. try this <?php $result = @mysql_query("select distinct school from table ORDER BY school ASC"); if (mysql_num_rows($result) > 0) { print "<select>"; ?> <option <?php if(empty($_GET['school'])){ echo "selected=\"selected\""; } ?> value="<? echo "$page_name" ?>">DISPLAY ALL SCHOOLS</option> <?php while ($row = mysql_fetch_array($result)) { if(empty($row['school'])) continue; //added print "<option "; if($_GET['school'] == $row['school'] ){ echo "selected=\"selected\""; } print " value=\"$page_name&start=0&school=" . $row['school'] . "\">" . $row['school'] . "</option>\n"; } print "</select>"; } ?>
  15. erm... really hard to say without some code but if your query string was stored in a variable called $query the you could (for debugging) try die($query);
  16. also as its a remote server you may want to consider caching the file, but it depends on your needs
  17. Humm maybe it would be better to post all the code that around the problem
  18. Do a mysql_error and post the error
  19. No the position is absolute and 40% from the top that is putting on top of the button, the form is fine, the code look okay as well
  20. Well done neil.johnson great job..
  21. like everyone else i cleaned up the code, a few error i noticed, However $stats only seems to be set by being passed to playerstats.php, is this correct ? <?php include('../functions.php'); echo dbconnect(); include ('logincheck.php'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Fife Flyers - Admin Area</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0" bgcolor="#ffffff"> <table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%"> <tr valign="top"> <td width="50%" background="images/bg.gif"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td> <td valign="bottom" background="images/bg_left.gif"><img src="images/bg_left.gif" alt="" width="17" height="16" border="0"></td> <td> <table border="0" cellpadding="0" cellspacing="0" width="780" height="107"> <tr valign="bottom"> <td background="images/fon_top.gif"> </td> <td width="673" background="images/fon_top.gif"> <table border="0" cellpadding="0" cellspacing="0" background=""> <tr valign="bottom"> <td> <!-- but act --> <table border="0" cellpadding="0" cellspacing="0"> <tr valign="bottom"> <td><img src="images/b_left_a.gif" width="9" height="37" alt="" border="0"></td> <td background="images/b_fon_a.gif"><p class="menu01"><a href="index2.php">ADMIN </a></p></td> <td><img src="images/b_right_a.gif" width="9" height="37" alt="" border="0"></td> </tr> </table> <!-- /but act --> </td> </tr> </table> </td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="780" height="107"> <tr valign="top"> <td bgcolor="#E7BD1D"><table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td bgcolor="#E7BD1D"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> </table></td> </tr> </table> <div align="center"></div> <div align="center"><img src="images/title01.gif" width="183" height="35" alt="" border="0"></div> <nobr class="right"> <div style="padding-top: 10px; padding-left: 20px;"><span class="right"><?php echo("<form action=\"auth.php\" method=\"post\" name=\"login\" id=\"login\"> Username: <input name=\"PHP_AUTH_USER\" type=\"text\" id=\"PHP_AUTH_USER\" value=\"username\"><br><br> Password: <input name=\"PHP_AUTH_PW\" type=\"password\" id=\"PHP_AUTH_PW\" value=\"\"><br> <input type=\"submit\" name=\"Submit\" value=\"Login\"> </form>"); ?></span></div> </nobr> <p class="left"> </p> <br> <br> </td> <td rowspan="2"> <div align="center"><img src="images/top01.gif" width="597" height="24" alt="" border="0"></div> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td> </td> <td> <p style="color: #1F269D; font-size: 20px; margin-left: 0px;"><b>Edit Player Stats:</b></p> <p style="color: #1F269D; font-size: 20px; margin-left: 0px;"><span style="color: #1F269D; font-size: 16px; margin-left: 0px;">Powerplay Goals & Shorthanded Goals are not to be added to points total - all goals scored should be added to goals column and these are added to total points. </span></p> <?php session_start(); if( isset($_SESSION['msg']) ) echo $_SESSION['msg']; error_reporting(E_ALL); ini_set("display_errors", 1); if (isset($_REQUEST['act'])) { $act = $_REQUEST['act']; } if (isset($_REQUEST['stat'])) { $stat = $_REQUEST['stat']; } if ($stat==1) { // normal players $table = "players"; } else { // snl_players $table ="snl_players"; } if (strcmp($act, 'edit')==0) { $query11 = "SELECT * FROM `$table` WHERE `PlayerID` = '$PlayerID'"; $result11 = mysql_query($query11) or die (mysql_error()); $rows = mysql_fetch_array($result11); $PlayerID = $rows['PlayerID']; $TeamID = $rows['TeamID']; $Team = $rows['Team']; $Player = $rows['Player']; $Games = $rows['Games']; $Goals = $rows['Goals']; $PPGoals = $rows['PPGoals']; $SHGoals = $rows['SHGoals']; $Assists = $rows['Assists']; $PIM = $rows['PIM']; $Points = $rows['Points']; $GamesCup = $rows['GamesCup']; $GoalsCup = $rows['GoalsCup']; $PPGoalsCup = $rows['PPGoalsCup']; $SHGoalsCup = $rows['SHGoalsCup']; $AssistsCup = $rows['AssistsCup']; $PIMCup = $rows['PIMCup']; $PointsCup = $rows['PointsCup']; /* $GamesNPL = $rows['GamesNPL']; $GoalsNPL = $rows['GoalsNPL']; $PPGoalsNPL = $rows['PPGoalsNPL']; $SHGoalsNPL = $rows['SHGoalsNPL']; $AssistsNPL = $rows['AssistsNPL']; $PIMNPL = $rows['PIMNPL']; $PointsNPL = $rows['PointsNPL']; */ $GamesPO = $rows['GamesPO']; $GoalsPO = $rows['GoalsPO']; $PPGoalsPO = $rows['PPGoalsPO']; $SHGoalsPO = $rows['SHGoalsPO']; $AssistsPO = $rows['AssistsPO']; $PIMPO = $rows['PIMPO']; $PointsPO = $rows['PointsPO']; $Nationality = $rows['Nationality']; $query11 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'"; $result11 = mysql_query($query11) or die (mysql_error()); $rows = mysql_fetch_array($result11); $TeamName = $rows['TeamName']; echo ("<form name=\"form1\" method=\"post\" action=\"playerstats.php?act=edit&PlayerID=$PlayerID&stat=$stat\"> <table width=\"80%\" border=\"0\"> <tr> <td width=\"30%\" class=\"data\">Player Name </td> <td width=\"70%\"><input name=\"Player\" type=\"text\" id=\"Player\" value=\"$Player\"></td> </tr> <tr> <td class=\"data\">Associated Team ID </td> <td class=\"data\"> <select name=\"TeamID\">"); $query11 = "SELECT * FROM `teams`"; $result11 = mysql_query($query11) or die (mysql_error()); while ( $rows = mysql_fetch_array($result11) ) { $TeamName = $rows['TeamName']; $TeamID2 = $rows['TeamID']; if (strcmp($TeamID,$TeamID2)==0) { echo(" <option value=\"$TeamID2\" selected>$TeamName</option>"); } else { echo(" <option value=\"$TeamID2\">$TeamName</option>"); } } echo("</select></td> </tr> <tr> <td class=\"data\">Games</td> <td><input name=\"Games\" type=\"text\" id=\"Games\" size=\"6\" value=\"$Games\"></td> </tr> <tr> <td class=\"data\">Goals</td> <td><input name=\"Goals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$Goals\"></td> </tr> <tr> <td class=\"data\">PPGoals</td> <td><input name=\"PPGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$PPGoals\"></td> </tr> <tr> <td class=\"data\">SHGoals</td> <td><input name=\"SHGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$SHGoals\"></td> </tr> <tr> <td class=\"data\">Assists</td> <td><input name=\"Assists\" type=\"text\" id=\"Assists\" size=\"6\" value=\"$Assists\"></td> </tr> <tr> <td class=\"data\">PIM</td> <td><input name=\"PIM\" type=\"text\" id=\"PIM\" size=\"6\" value=\"$PIM\"></td> </tr> <tr> <td class=\"data\">Points</td> <td><input name=\"Points\" type=\"text\" id=\"Points\" size=\"6\" value=\"$Points\"></td> </tr> <tr> <td class=\"data\">GamesCup</td> <td><input name=\"GamesCup\" type=\"text\" id=\"GamesCup\" size=\"6\" value=\"$GamesCup\"></td> </tr> <tr> <td class=\"data\">GoalsCup</td> <td><input name=\"GoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$GoalsCup\"></td> </tr> <tr> <td class=\"data\">PPGoalsCup</td> <td><input name=\"PPGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$PPGoalsCup\"></td> </tr><tr> <td class=\"data\">SHGoalsCup</td> <td><input name=\"SHGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$SHGoalsCup\"></td> </tr> <tr> <td class=\"data\">AssistsCup</td> <td><input name=\"AssistsCup\" type=\"text\" id=\"AssistsCup\" size=\"6\" value=\"$AssistsCup\"></td> </tr> <tr> <td class=\"data\">PIMCup</td> <td><input name=\"PIMCup\" type=\"text\" id=\"PIMCup\" size=\"6\" value=\"$PIMCup\"></td> </tr> <tr> <td class=\"data\">PointsCup</td> <td><input name=\"PointsCup\" type=\"text\" id=\"PointsCup\" size=\"6\" value=\"$PointsCup\"></td> </tr> "); if ($stat==1) { }else{ echo(" <tr><td class=\"data\">GamesPO</td> <td><input name=\"GamesPO\" type=\"text\" id=\"GamesPO\" size=\"6\" value=\"$GamesPO\"></td> </tr> <tr> <td class=\"data\">GoalsPO</td> <td><input name=\"GoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$GoalsPO\"></td> </tr> <tr> <td class=\"data\">PPGoalsPO</td> <td><input name=\"PPGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$PPGoalsPO\"></td> </tr> <tr> <td class=\"data\">SHGoalsPO</td> <td><input name=\"SHGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$SHGoalsPO\"></td> </tr><tr> <td class=\"data\">AssistsPO</td> <td><input name=\"AssistsPO\" type=\"text\" id=\"AssistsPO\" size=\"6\" value=\"$AssistsPO\"></td> </tr><tr> <td class=\"data\">PIMPO</td> <td><input name=\"PIMPO\" type=\"text\" id=\"PIMPO\" size=\"6\" value=\"$PIMPO\"></td> </tr><tr> <td class=\"data\">PointsPO</td> <td><input name=\"PointsPO\" type=\"text\" id=\"PointsPO\" size=\"6\" value=\"$PointsPO\"></td> </tr><tr> <td class=\"data\">Nationality</td> <td><input name=\"Nationality\" type=\"text\" id=\"Nationality\" value=\"$Nationality\"></td> </tr> <td class=\"data\"> </td> <td> </td> </tr> <tr> <td class=\"data\"> </td> <td><input type=\"submit\" name=\"Submit\" value=\"Edit\"></td> </tr> </table> </form>"); } if ($stat!=0) { $query = "UPDATE `players` SET `Nationality` = '{$_POST['Nationality']}', `GamesPO` = '{$_POST['GamesPO']}', `AssistsPO` = '{$_POST['AssistsPO']}', `GoalsPO` = '{$_POST['GoalsPO']}', `PPGoalsPO` = '{$_POST['PPGoalsPO']}', `SHGoalsPO` = '{$_POST['SHGoalsPO']}', `PointsPO` = '{$_POST['PointsPO']}', `PIMPO` = '{$_POST['PIMPO']}' , `PIM` = '{$_POST['PIM']}' , `PointsCup` = '{$_POST['PointsCup']}' , `PIMCup` = '{$_POST['PIMCup']}' , `AssistsCup` = '{$_POST['AssistsCup']}' , `GoalsCup` = '{$_POST['GoalsCup']}' , `PPGoalsCup` = '{$_POST['PPGoalsCup']}' , `SHGoalsCup` = '{$_POST['SHGoalsCup']}' , `GamesCup` = '{$_POST['GamesCup']}' , `Points` = '{$_POST['Points']}' , `Assists` = '{$_POST['Assists']}' , `Goals` = '{$_POST['Goals']}' , `PPGoals` = '{$_POST['PPGoals']}' , `SHGoals` = '{$_POST['SHGoals']}' , `TeamID` = '{$_POST['TeamID']}' , `Player` = '{$_POST['Player']}' , `Games` = '{$_POST['Games' ]}' WHERE `PlayerID` = '{$_GET['PlayerID']}'"; $result = mysql_query($query) or die (mysql_error()); $_SESSION['msg'] = "The player has been updated. No. of records updated, ". mysql_affected_rows(); echo ("The player has been updated. No. of records updated, ".mysql_affected_rows()."<br><br><a href=\"playerstats.php\"> Go back to the player List</a>"); } else { $query = "UPDATE `snl_players` SET `Nationality` = '{$_POST['Nationality']}', `GamesPO` = '{$_POST['GamesPO']}', `AssistsPO` = '{$_POST['AssistsPO']}', `GoalsPO` = '{$_POST['GoalsPO']}', `PPGoalsPO` = '{$_POST['PPGoalsPO']}', `SHGoalsPO` = '{$_POST['SHGoalsPO']}', `PointsPO` = '{$_POST['PointsPO']}', `PIMPO` = '{$_POST['PIMPO']}' , `PIM` = '{$_POST['PIM']}' , `PointsCup` = '{$_POST['PointsCup']}' , `PIMCup` = '{$_POST['PIMCup']}' , `AssistsCup` = '{$_POST['AssistsCup']}' , `GoalsCup` = '{$_POST['GoalsCup']}' , `PPGoalsCup` = '{$_POST['PPGoalsCup']}' , `SHGoalsCup` = '{$_POST['SHGoalsCup']}' , `GamesCup` = '{$_POST['GamesCup']}' , `Points` = '{$_POST['Points']}' , `Assists` = '{$_POST['Assists']}' , `Goals` = '{$_POST['Goals']}' , `PPGoals` = '{$_POST['PPGoals']}' , `SHGoals` = '{$_POST['SHGoals']}' , `TeamID` = '{$_POST['TeamID']}' , `Player` = '{$_POST['Player']}' , `Games` = '{$_POST['Games' ]}' WHERE `PlayerID` = '{$_GET['PlayerID']}'"; $result = mysql_query($query) or die (mysql_error()); $_SESSION['msg'] = "The player has been updated. No. of records updated, ". mysql_affected_rows(); echo ("The player has been updated. No. of records updated, ". mysql_affected_rows()."<br><br><a href=\"playerstats.php\"> Go back to the player List</a>"); } } elseif (strcmp($act,'teamlist')==0) { $query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'"; $result112 = mysql_query($query112) or die (mysql_error()); $rows2 = mysql_fetch_array($result112); $TeamName = $rows2['TeamName']; $Logo = $rows2['Logo']; if ($Logo!="") { echo("<img src=\"../Images/$Logo\" /><br><br>"); } else { } echo ("<strong>Edit $TeamName Players</strong><br><br>Click Player Names to edit details<br><br>"); $query11 = "SELECT * FROM `players` WHERE `TeamID` = '$TeamID'"; $result11 = mysql_query($query11) or die (mysql_error()); while ( $rows = mysql_fetch_array($result11) ) { $Player = $rows['Player']; $PlayerID = $rows['PlayerID']; $TeamID = $rows['TeamID']; echo ("<span class=\"style1\"><a href=\"playerstats.php?act=edit&PlayerID=$PlayerID&stat=1\">$Player</a><br>"); } } else { echo ("Click Team Names to view players<br><br>"); $query11 = "SELECT distinct TeamID FROM `players` ORDER BY `TeamID`"; $result11 = mysql_query($query11) or die (mysql_error()); $TeamID_in = ""; while ( $rows = mysql_fetch_array($result11) ) { //$TeamID = $rows['TeamID']; $TeamID_in .= "'".$rows['TeamID']."',"; } (substr($TeamID_in,-1) == ",") ? substr($TeamID_in, 0, -1) : $TeamID_in; // $query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'"; $query112 = "SELECT * FROM `teams` WHERE `TeamID` IN ($TeamID_in)"; $result112 = mysql_query($query112) or die (mysql_error()); $rows2 = mysql_fetch_array($result112); $TeamName = $rows2['TeamName']; echo ("<span class=\"style1\"><a href=\"playerstats.php?act=teamlist&TeamID=$TeamID&stat=1\">$TeamName</a><br>"); } echo ("<a name=\"snl\"></a><br><strong><a href=\"snlplayerstats.php\">SNL Teams</a></strong><br><br>"); ?> <p> </p> <p> </p> <p> <label> </label> </p> <p> <label></label> </p> <p></p> <p> </p> <p> </p> <p><a href=""></a></p> </td> </tr> </table> <div align="center"><img src="images/hr01.gif" width="556" height="11" alt="" border="0"></div> </td> </tr> <tr valign="bottom" bgcolor="#D0E0ED"> <td bgcolor="#E7BD1D"><img src="images/bot_left.gif" width="183" height="21" alt="" border="0"></td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="780" height="64" background="images/fon_bot.gif"> <tr valign="top"> <td> <table border="0" cellpadding="0" cellspacing="0" width="780" background=""> <tr> <td width="300"><p class="menu02">Designed by Steven McLean</p></td> <td> <p class="menu02"><a href="">FifeFlyers.co.uk Admin Home</a></p> </td> </tr> </table> </td> </tr> </table> </td> <td valign="bottom" background="images/bg_right.gif"><img src="images/bg_right.gif" alt="" width="17" height="16" border="0"></td> <td width="50%" background="images/bg.gif"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td> </tr> </table> </body> </html> EDIT: updated the code.. i noticed your not using $_POST to update your fields.. so i updated that
  22. $black = imagecolorallocate($im, 0, 0, 0); imagecolortransparent($im, $black); Resize example <?php function setTransparency($new_image,$image_source){ $transparencyIndex = imagecolortransparent($image_source); $transparencyColor = array('red' => 255, 'green' => 255, 'blue' => 255); if ($transparencyIndex >= 0) { $transparencyColor = imagecolorsforindex($image_source, $transparencyIndex); } $transparencyIndex = imagecolorallocate($new_image, $transparencyColor['red'], $transparencyColor['green'], $transparencyColor['blue']); imagefill($new_image, 0, 0, $transparencyIndex); imagecolortransparent($new_image, $transparencyIndex); } ?> Sample Usage: (resizing) <?php $image_source = imagecreatefrompng('test.png'); $new_image = imagecreatetruecolor($width, $height); setTransparency($new_image,$image_source); imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $old_width, $old_height);
  23. did it work ? if so please mark as solved (bottom left)
  24. This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=307745.0
  25. this HTML is over the top of it, so you can't click on the button (in FF) <div style="position: absolute; left: 4%; top: 40%; width: 100%; height: 500px;" id="mainbody2" class="bodytext"><br></div> remove that html and it should be fine
×
×
  • 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.