Jump to content

chrisidas

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Everything posted by chrisidas

  1. I've been trying to add a little quick form box to the top of my page. The login system that i used is not my script and i do find it quite confusing, but i've managed to work with it so far. I actually have a seperate log in page all together which works fine, but i wanted to add a little quick log in box to the top of my pages. The trouble i'm having though, is i cant seem to get it to go away once the user is logged in. Here's my code <?php if($session->logged_in){ echo "[<a href=\"members_system/process.php\">Logout</a>]"; } else{ } ?> <form method="POST" action="members_system/process.php"> <input type="text" name="user" class="quick-login-form" value="<?php echo $form->value("user"); ?>" /> <input type="password" name="pass" class="quick-login-form" value="<?php echo $form->value("pass"); ?>" /> <input type="hidden" name="sublogin" value="1"> <input type="submit" name="login" value="Login" class="quick-login-button" /><br /> </form> If i put the fom inside the <?php tags i get all kind of syntax errors, even if i change the "s for 's. Also, the form on my main log in page isnt inside the <?php tags anyway, but it still doesnt show when the user is logged in. Here's my code on the main log in page. <php if($session->logged_in){ echo "<h3>Logged In</h3>"; echo "Welcome <b>$session->username</b>, you are logged in. <br><br>" ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] " ."[<a href=\"useredit.php\">Edit Account</a>] "; if($session->isAdmin()){ echo "[<a href=\"admin/admin.php\">Admin Center</a>] "; } echo "[<a href=\"process.php\">Logout</a>]"; } else{ ?> <h1>Login</h1> <?php /** * User not logged in, display the login form. * If user has already tried to login, but errors were * found, display the total number of errors. * If errors occurred, they will be displayed. */ if($form->num_errors > 0){ echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>"; } ?> <form action="process.php" method="POST" class="table"> <table border="0" align="left" cellpadding="3" cellspacing="0" class="table"> <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<?php echo $form->value("user"); ?>"></td><td><?php echo $form->error("user"); ?></td></tr> <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<?php echo $form->value("pass"); ?>"></td><td><?php echo $form->error("pass"); ?></td></tr> <tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>> <font size="2">Remember me next time <input type="hidden" name="sublogin" value="1"> <input type="submit" value="Login"></td></tr> <tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr> <tr><td colspan="2" align="left"><br>Not registered? <a href="register.php">Sign-Up!</a></td></tr> </table> </form> Is it something to do with it being in a table, or am i just missing something really simple? Help would be greatly appreciated
  2. Hey, Here's what i have on my stylesheet #header { width: 1000px; height: 112px; background-image: url("../images/bgheader.gif"); background-repeat: repeat-x; margin-bottom: 6px; margin-right: auto; margin-left: auto; } #header-left { float: left; height: 112px; background-image: url("../images/bgheader-left.png"); background-position: left; background-repeat: no-repeat; } #header-right { float: right; height: 112px; padding-right: 15px; background-image: url("../images/bgheader-right.png"); background-position: right; background-repeat: no-repeat; } And here's my actual code <div id="header"> <div id="header-right"> </div> <div is="header-left"> <img src="../images/logo.png" width="416" height="112" alt="Site Logo" /> </div> </div> It supposed to give the whole header like a gradient effect, then they bgheader-right and bgheader-left are supposed to give it like rounded corners. For some reason though, no matter what image i use for header-left, it doesnt show up. So i'm stuck with sharp edges on one side of my header. I've moved the divs around and that didnt change anything. I had to put the header-right div before the header-left div because i couldnt get the positioning right otherwise. I copied the code from the stylesheets used for my forums, and it works fine on there. here's my site address so you can get some idea what it looks like now - www.fifaworldlive.com here's my forum address so you can get some idea what it should look like - www.fifaworldlive.com/forums Any ideas? Cheers
  3. Yeah that works. Nice one mate
  4. Hey, I have a table on my site which takes data from my database, 'playername' and 'goalsscored'. I have the table sorted by 'goalsscored' descending. Currently i have another table at the side of it for position. I was wondering, would it be possible to add a column to the same table for position, but make it so the colum stays constant from 1-20 when the table is updated and changes order. Here is my code <?php $result = mysql_query("SELECT * FROM players ORDER BY goalsscored DESC LIMIT 10"); echo "<table class='topscorers-table' cellspacing='0'> <tr> <th class='topscorers-name'>Name</th> <th class='topscorers-goals'>Goals</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td class='topscorers-name'>" . $row['playername'] . "</td>"; echo "<td ' class='topscorers-goals'>" . $row['goalsscored'] . "</td>"; } echo "</table>"; ?> Cheers
  5. Not sure if this should be in the PHP section or here, but as i think its a positioning problem i put it here. How come when i display results from a MySQL query in a table, the table doesnt stay inside the div tag, it just overlaps the border and doesnt expand the div? Is there a way to stop this? Thanks
  6. Finally got it sorted. Ended up using mysql_fetch_array() to create the variable i wanted, then sent that in the hidden field. Thanks for the help
  7. Confused now lol I cant just put the player name in the hidden field because its a result from a query, well thats probs possible i just dont know how to do it On my script page i have these variables, so i can just put them straight into the query <?php $playername = mysql_real_escape_string($_POST['playername']); $transfertype = mysql_real_escape_string($_POST['transfertype']); $amount = mysql_real_escape_string($_POST['amount']); ?> If i added <?php session_start(); $playername = $_SESSION['playerName']; ?> to the end of that, would that be correct, or am i way off?
  8. Ahhh, nice one! So I would just need to put that into the hidden field, then i'd be able to grab it on my script page, yeah?
  9. Ah right, helps a little yeah. Which part of this would go in the $_SESSION part then? <?php $pid=$_GET['pid']; $result = mysql_query("SELECT * FROM transferlist WHERE playerID= '$pid'"); while($row = mysql_fetch_array($result)) { echo $row['playername']; } ?>
  10. One more newbie question. How would i go about putting it in a $_SESSION variable, i've read some other threads and tutorials but cant get my head around it at all
  11. Nice one, will give it a bash now
  12. Cheers, how do i go about making a hidden input field?
  13. Ok, so my form looks like this (the form will be on the page transferform.php?pid=(playerID from a previous page) <div id="transferrequestform"> <form action="transferrequest-script.php" method="post"> <table width="600" border="0" cellspacing="10" cellpadding="5"> <tr> <td width='200' align='centre'> <?php $pid=$_GET['pid']; $result = mysql_query("SELECT * FROM transferlist WHERE playerID= '$pid'"); while($row = mysql_fetch_array($result)) { echo $row['playername']; } ?> </td> <td width='200' align='centre'><p><input type="text" name="amount" value="Amount (millions)" /></p> </td> <td width='200' align='centre'> <select name="transfertype" id="transfertype"> <option value="sale" selected="selected">Sale</option> <option value="loan">Loan</option> </select> </td> <td width='200' align='centre'><input type="submit" value="Submit" /></td> </tr> </table> </form> </div> And my script currently looks like this. <?php include("members_system/include/constants.php"); include("members_system/include/session.php"); $con = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error()); mysql_select_db(DB_NAME, $con) or die(mysql_error()); ?> <?php if($session->isManchesterUnited()){ $userTeam = (('Manchester United')); } if($session->isChelsea()){ $userTeam = (('Chelsea')); } $playername = mysql_real_escape_string($_POST['playername']); $transfertype = mysql_real_escape_string($_POST['transfertype']); $amount = mysql_real_escape_string($_POST['amount']); mysql_query("INSERT INTO transferbids (playername, offer, transfertype, biddingteam) VALUES ('$playername', '$amount', '$transfertype', '$userTeam')"); mysql_close($con); ?> How would i go about getting the 'playername' from the page with the form on, so i can insert it into the database. Thanks
  14. Hey, I have a transfer list of players on one page, showing all the players that are set to transfer listed in my database. I want it so when a player clicks the "make offer" link next to the player, it takes them to a page where they can fill in a form making an offer for that player. I only want to have one transfer form page, but with a different display for each player using variables. I have this code to display a list of results from my database. <?php ]if (isset($_GET['transfer'])) { $transfer=$_GET['transfer']; mysql_query("SELECT * FROM transferlist WHERE playerID='$transfer'"); } $result = mysql_query("SELECT * FROM players WHERE transferstatus='sale' or transferstatus='loan' ORDER BY transferstatus"); echo "<table border='1' width='500' bordercolor='black' align='left'> <tr> <th width='150' align='center'>Name</th> <th width='25' align='center'>Position</th> <th width='25' align='center'>Rating</th> <th width='25' align='center'>Value</th> <th width='25' align='center'>Transfer Type</th> <th width='25' align='center'>Offer</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td width='25' align='centre'>" . $row['playername'] . "</td>"; echo "<td width='25' align='center'>" . $row['playerposition'] . "</td>"; echo "<td width='25' align='center'>" . $row['playerrating'] . "</td>"; echo "<td width='25' align='center'>" . $row['playervalue'] . "</td>"; echo "<td width='25' align='center'>" . $row['transferstatus'] . "</td>"; echo "<td width='25' align='center'><a href=\"transferrequest.php?". $row['playerID'] . "\">Make Offer</a></td>"; echo "</tr>"; } echo "</table>"; ?> I'm using this part of the code so that the page i go to will be specific to the row in the table <?php echo "<td width='25' align='center'><a href=\"transferrequest.php?". $row['playerID'] . "\">Make Offer</a></td>"; ?> On the page it links to the address will be "...transferrequest.php?(the playerID number) Now i was wondering, is it possible to take the playerID number from the address and use it as a variable. So i can make a form specific to the player the person selects? Not sure if that makes sense , any ideas how i could do this though, or any other possible ways i could acchieve the same results.
  15. Can't get that to work Any other ideas?
  16. Think thats what i wanted yeah, nice one. I have a seperate file called session.php which has <?php function isManchesterUnited(){ return ($this->userlevel == MANCHESTER_UNITED_USER_LEVEL); } function isChelsea(){ return ($this->userlevel == CHELSAE_USER_LEVEL); } ?> Then i just include that file at the top. If that makes sense lol
  17. Hey, Here is my code atm thanks to dragon_sa <div id="content"> <div id="playerlistform"> <h2>Add player to transfer list</h2> <form action="transfers-script.php" method="post"> <table width="500" border="0" cellspacing="10" cellpadding="5"> <tr> <td>Player <?php $sql = mysql_query("SELECT * FROM players WHERE teamname='Arsenal'"); echo '<select name="playername" id="playername">'; while($row = mysql_fetch_array($sql)){ $playername = $row['playername']; ?> <option value="<?php echo $playername; ?>"><?php echo $playername; ?></option> <?php } ?> </td> <td>Asking Price </td> <td>Type <select name="transfertype" id="transfertype"> <option value="sale" selected="selected">Sale</option> <option value="loan">Loan</option> </select> </td> <td><input type="submit" value="Submit" /></td> </tr> </table> </form> </div> <div id="listedplayers"> <h2>Listed Players</h2> <?php //check for update request if (isset($_GET['transfer'])) { $transfer=$_GET['transfer']; mysql_query("UPDATE players SET transferstatus='' WHERE playerID='$transfer'"); } $result = mysql_query("SELECT * FROM players WHERE teamname='Arsenal' and transferstatus='sale' or teamname='Arsenal' and transferstatus='loan' ORDER BY transferstatus"); echo "<table border='1' width='500' bordercolor='black' align='left'> <tr> <th width='150' align='center'>Name</th> <th width='25' align='center'>Position</th> <th width='25' align='center'>Rating</th> <th width='25' align='center'>Value</th> <th width='25' align='center'>Transfer Type</th> <th width='25' align='center'>Remove</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td width='25' align='centre'>" . $row['playername'] . "</td>"; echo "<td width='25' align='center'>" . $row['playerposition'] . "</td>"; echo "<td width='25' align='center'>" . $row['playerrating'] . "</td>"; echo "<td width='25' align='center'>" . $row['playervalue'] . "</td>"; echo "<td width='25' align='center'>" . $row['transferstatus'] . "</td>"; echo "<td width='25' align='center'><a href=\"arsenal.php?transfer=". $row['playerID'] . "\">Change Status</a></td>"; echo "</tr>"; } echo "</table>"; ?> </div> <p> </p> </div> Would I be able to make it so it displays different results based on who is logged in. For example, if the user is 'ManchesterUnited' it shows the results for 'Manchester United' and if the user is 'Arsenal' it shows the results for 'Arsenal' I can get it to work when wanting different links to be displayed, though i get syntax errors galore when i try using if statements on the above lol My if statements for links <?php if($session->logged_in){ if($session->isManchesterUnited()){ echo "<a href=\"../squad/manchester-united.php\">Players</a>"; } if($session->isArsenal()){ echo "<a href=\"../squad/arsenal.php\">Players</a>"; } ?> I have all my user levels created using my constants.php and session.php pages, and the page the above code is displayed on is called transfers.php Anyone know how to go about doing this, or is there a better method i should be using? A little idea of how the code should look would be greatly appreciated! Thanks
  18. How would i go about doing that? Still pretty new to this lol Any good examples you know of or anything? Cheers
  19. Back again with another newbie question. Is it possible for me to have a submit button next to each result, so that i can change the transfer status for that particualr player to "unavailable" For Example i would like the table to look like: Name Status Remove Button Player one sale button to change status Player two loan button to change status <?php $result = mysql_query("SELECT * FROM players WHERE teamname='Arsenal' and transferstatus='sale' or teamname='Arsenal' and transferstatus='loan' ORDER BY transferstatus"); echo "<table border='1' width='500' bordercolor='black' align='left'> <tr> <th width='150' align='center'>Name</th> <th width='25' align='center'>Position</th> <th width='25' align='center'>Rating</th> <th width='25' align='center'>Value</th> <th width='25' align='center'>Transfer Type</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td width='25' align='centre'>" . $row['playername'] . "</td>"; echo "<td width='25' align='center'>" . $row['playerposition'] . "</td>"; echo "<td width='25' align='center'>" . $row['playerrating'] . "</td>"; echo "<td width='25' align='center'>" . $row['playervalue'] . "</td>"; echo "<td width='25' align='center'>" . $row['transferstatus'] . "</td>"; echo "</tr>"; echo "</tr>"; echo "</tr>"; echo "</tr>"; echo "</tr>"; } echo "</table>"; ?> Any ideas?
  20. will have a look, cheers
  21. It worked Thanks, really appreciate it! Pretty new with web design and still trying to get my head around it, getting there though haha
  22. Hey, I am having trouble updating a table in my database. The collum in the table i want to update is called 'transferstatus' Here is my form <form action="transfers-script.php" method="post"> <table width="500" border="0" cellspacing="10" cellpadding="5"> <tr> <td>Player <?php $sql = mysql_query("SELECT * FROM players WHERE teamname='Arsenal'"); echo '<select name="playername" id="playername">'; while($row = mysql_fetch_array($sql)){ $playername = $row['playername']; ?> <option value="<?php echo $playername; ?>"><?php echo $playername; ?></option> <?php } ?> </td> <td>Asking Price </td> <td>Type <select name="transfertype" id="transfertype"> <option value="sale" selected="selected">Sale</option> <option value="loan">Loan</option> </select> </td> <td><input type="submit" value="Submit" /></td> </tr> </table> </form> and here is the script <?php include("../../members_system/include/constants.php"); $con = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error()); mysql_select_db(DB_NAME, $con) or die(mysql_error()); ?> <?php $playername = mysql_real_escape_string($_POST['playername']); $transfertype = mysql_real_escape_string($_POST['transfertype']); if("$transfertype='sale'") { $sql = "UPDATE players WHERE 'playername'=".$playername." SET 'transferstatus'=sale"; $res = mysql_query($sql); } mysql_close($con); ?> Any ideas where i'm going wrong?
×
×
  • 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.