Jump to content

lee2010

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Everything posted by lee2010

  1. Hi all, i'm working on a script which will allow staff members or "admins" to move users on a html table. Basically a user clicks on a cell within a table and there username is stored in a mysql database and there username also appears in that cell and its reserved for them and other users cant take there slot. I use this for a seating plan for events. I have made an identical table which pulls the same data from the database but is only availible to staff members but i want it so when a staff member clicks on a cell or "seat" it will ask them if they want to move themselves there or another user. Here is my code i have so far: <?php require ("./auth.php");?> <?php require ("../secure/connect.php");?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>SouthWest LAN's</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="../css/styles.css" /> </head> <body> <!-- Begin Wrapper --> <div id="wrapper"> <!-- Begin Header --> <div id="header"><h1><br />SouthWest LAN's</h1></div> <!-- End Header --> <!-- Begin Navigation --> <div id="navigation"><ul> <li style="margin-right:15px; display:inline;"><a href="../index.php">Home</a></li> <li style="margin-right:15px; display:inline;"><a href="../gallery/">Photo Gallery</a></li> <li style="margin-right:15px; display:inline;"><a href="../events.php">Events</a></li> <li style="margin-right:15px; display:inline;"><a href="../account.php">My Account</a></li> <li style="margin-right:15px; display:inline;"><a href="../forum.php">Forums</a></li> <li style="margin-right:15px; display:inline;"><a href="../faq.php">FAQ</a></li> </ul></div> <!-- End Navigation --> <!-- Begin Content Column --> <div id="content"> <h1>Staff Seating</h1><br /> <p>Below shows where users are currently seated and you can edit where users are sitting and place users that havent yet choosen a seat.</p><br /> <p>Click a seat for options:</p><br /> <?php session_start(); $user_id = array(); $query = "SELECT * from seats_table"; $result = mysql_query($query); while($row = mysql_fetch_array($result)){ $seat_status[] = $row['taken']; } $query5 = "SELECT * from seats_table"; $result5 = mysql_query($query5); while($row5 = mysql_fetch_array($result5)){ $user_id[] = $row5['user_id']; } $get2 = mysql_query("SELECT * FROM users WHERE username='".$_SESSION['username']."'")or die(mysql_error()); ?> <fieldset> <br /> <table width="100%" border="0" align="center"> <tr> <td><b>Seat 01</b></td> <td><b>Seat 02</b></td> <td><b>Seat 03</b></td> <td><b>Seat 04</b></td> <td><b>Seat 05</b></td> <td><b>Seat 06</b></td> <td><b>Seat 07</b></td> <td><b>Seat 08</b></td> <td><b>Seat 09</b></td> <td><b>Seat 10</b></td> <td><b>Seat 11</b></td> <td><b>Seat 12</b></td> </tr> <tr> <td>Servers</td> <td>Servers</td> <td><?php if($seat_status[2]) { echo '<font color="red"><a href="admin_seat.php?seat=3">'.$user_id[2];} else { ?> <a href="admin_seat.php?seat=3"><font color="green">Availible</a></font><?php } ?></td> <td><?php if($seat_status[3]) { echo '<font color="red"><a href="admin_seat.php?seat=4">'.$user_id[3];} else { ?> <a href="admin_seat.php?seat=4"><font color="green">Availible</a></font><?php } ?></td> <td><?php if($seat_status[4]) { echo '<font color="red"><a href="admin_seat.php?seat=5">'.$user_id[4];} else { ?> <a href="admin_seat.php?seat=5"><font color="green">Availible</a></font><?php } ?></td> <td><?php if($seat_status[5]) { echo '<font color="red"><a href="admin_seat.php?seat=6">'.$user_id[5];} else { ?> <a href="admin_seat.php?seat=6"><font color="green">Availible</a></font><?php } ?></td> <td><?php if($seat_status[6]) { echo '<font color="red"><a href="admin_seat.php?seat=7">'.$user_id[6];} else { ?> <a href="admin_seat.php?seat=7"><font color="green">Availible</a></font><?php } ?></td> <td><?php if($seat_status[7]) { echo '<font color="red"><a href="admin_seat.php?seat=8">'.$user_id[7];} else { ?> <a href="admin_seat.php?seat=8"><font color="green">Availible</a></font><?php } ?></td> <td><?php if($seat_status[8]) { echo '<font color="red"><a href="admin_seat.php?seat=9">'.$user_id[8];} else { ?> <a href="admin_seat.php?seat=9"><font color="green">Availible</a></font><?php } ?></td> <td><?php if($seat_status[9]) { echo '<font color="red"><a href="admin_seat.php?seat=10">'.$user_id[9];} else { ?> <a href="admin_seat.php?seat=10"><font color="green">Availible</a></font><?php } ?></td> <td><?php if($seat_status[10]) { echo '<font color="red"><a href="admin_seat.php?seat=11">'.$user_id[10];} else { ?> <a href="admin_seat.php?seat=11"><font color="green">Availible</a></font><?php } ?></td> <td><?php if($seat_status[11]) { echo '<font color="red"><a href="admin_seat.php?seat=12">'.$user_id[11];} else { ?> <a href="admin_seat.php?seat=12"><font color="green">Availible</a></font><?php } ?></td> </tr> </table> <br /> </fieldset> <br /> <SCRIPT LANGUAGE="JavaScript"> if (window.print) { document.write('<form><input type=button name=print value="Print this page" onClick="window.print()"></form>'); } </script> <br /> <hr /><br /> Above has been edited down to just show the first 12 seats. And heres my admin_seat.php so far: <?php session_start(); /* connect to data base */ require ('../secure/connect.php'); /* get the seat number */ $seat_id = mysql_real_escape_string(trim($_GET['seat'])); ?> I want this script so that when i click on a seat it will ask me if i want to seat myself there, in which case it will place my username into that "seat" and remove anyone currently in that seat and reset them. If i dont want to seat myself there i want the script to give me the option to place a user there, so i would need to list all of my registered users, ideally in a dropdown box (i will only have around 80 users tops) and then submit that and it will move that user to that seat and wipe there current seat if applicable. something like this: $query = "UPDATE seats_table set taken = FALSE, user_id = '0' WHERE user_id = '$user_id'"; $result = mysql_query($query) or die (mysql_error()); $query = "UPDATE seats_table set taken = TRUE, user_id = '$user_id' WHERE id = '$seat_id'"; $result = mysql_query($query) or die (mysql_error()); the top line resets the seat back to default and availible for a user. the third line is when a user selects a seat, it sets that seats "taken" to equal true stores there user ID and the seat ID. any help with this would be great and also im not sure if its possible to list all of my registered users inside a dropdown box. Lee
  2. cool thanks, i will look into it
  3. hi all, im looking at a countdown timer and when a user places a bid it resets the timer, exactly like the one used at madbid.com, is this a mixture of javascript and php or just php? if you could point me in the right direction of what to look into that would be very helpful Lee
  4. hi all, i have a page which lists all of my registered users from the mysql database but i want the ability to edit an account, here is my list users code (just shown the appropiate code and not the rest): <?php require ('../secure/connect.php'); $sql = "SELECT * FROM users ORDER BY user_level ASC"; $result=mysql_query($sql); echo '<table width="80%" border="0" cellspacing="5" cellpadding="0">'; echo ' <tr> <th><p align="left">User ID:</th> <th><p align="left">User Level:</th> <th><p align="left">Username:</th> <th><p align="left">User Title:</th> <th><p align="left">Email:</th> <th><p align="left">Actions:</th> </tr>'; while($rows=mysql_fetch_array($result)){ ?> <tr> <td><?php echo $rows['userid']; ?></td> <td><?php echo $rows['user_level']; ?></td> <td><?php echo $rows['username']; ?></td> <td><?php echo $rows['user_title']; ?></td> <td><?php echo $rows['email']; ?></td> <td><a href="edit_account.php?id=">Edit Account</a></td> </tr> <?php } ?> this lists my users nicely, as you can see i put it a edit account action at the end with a empty id= because that may be a way of doing it but im not sure what else to do or if there is a better way of doing it. any help would be great!
  5. Hi all, im having problems with my tables not lining up on my website. Heres a screenshot of a table on my website: heres the tables code: <table width="50%" border="1" cellspacing="5" cellpadding="0"> <tr> <td width="90px"><?php echo $rows['username']; ?></td> <td width="90px"><?php echo $rows['payment_status']; ?></td> <td width="90px"><?php echo $rows['payment_amount']; ?></td> <td width="90px"><?php echo $rows['payment_currency']; ?></td> <td width="90px"><?php echo $rows['transaction_id']; ?></td> <td width="90px"><?php echo $rows['payer_email']; ?></td> </tr> </table> and heres my CSS: * { padding: 0; margin: 0; } body { font-family: Arial, Helvetica, sans-serif; font-size: 13px; } #wrapper { margin: 0 auto; width: 922px; } #faux { background: url(faux-3-2-col.gif); margin-bottom: 0px; overflow: auto; width: 100%; } #header { text-align:center; height: 210px; margin: 5px; background-image:url('../images/header.jpg'); background-repeat:no-repeat; background-position: center center; } #navigation { width: 100%; font-weight: bold; text-align:center; background: #FFA824; padding-top: 10px; padding-bottom: 10px; background: #f5b847; } #content { color: #333; padding: 0px; width: 900px; height: 100%; font-size: 14px; margin:10px; clear: both; } #footer { text-align:center; width: 100%; clear: both; background: #FFA824; padding-top: 10px; padding-bottom: 10px; font-weight: bold; } a:link { COLOR: #000000; } a:visited { COLOR: #000000; } a:hover { COLOR: #000000; } a:active { COLOR: #000000; } .clear { clear: both; background: none; } I really don't understand why it isnt lining up. I want all of my columns to line up neatly down the page. Is there anything i need to add to my CSS to fix this problem? Thanks
  6. hi all, i have written a seating plan page for my website which allows users to click on a seat and that seat is then allocated to there username, however theres nothing stopping a user changing the URL to a seat thats been taken and "taking" that seat from someone else. heres my code for my reserve_seat.php <?PHP session_start(); /* get user id */ $user_id = $_SESSION['username']; /* get the seat number */ $seat_id = $_GET['seat']; /* connect to data base */ require ('./secure/connect.php'); /* create query */ $query = "UPDATE seats_table set taken = FALSE, user_id = '0' WHERE user_id = '$user_id'"; $query2 = "UPDATE seats_table set taken = TRUE, user_id = '$user_id' WHERE id = '$seat_id'"; /* $query3 = "UPDATE users set signed_up = '3' WHERE username = '$user_id'"; */ /* execute the query */ $result = mysql_query($query); $result2 = mysql_query($query2); /* $result3 = mysql_query($query3); */ /* advise user their seat has been reserved */ include 'seating.php'; ?> so if a user reserves seat 28 the url is http://localhost/reserve_seat.php?seat=26, but theres nothing stopping another user typing this url and "stealing" this seat i need some kind of IF statement before the sql queries that checks to see if the seats "taken" column is 1 or 0 bearing in mind there is 49 seats but im lost at how to write it. any help would be great Lee
  7. ah i saw you missed a } so i have added that in and had a play around with the code and its working fine. i knew there had to be a more efficient way of doing it opposed to having the same code 49 times but just incrementing the seat number and array etc, thank you very much
  8. hi thanks for your reply, i just wanted to get it working before i got down to tidying it up etc, so no there wasnt a real reason for it just tried your code and im getting this error: Parse error: syntax error, unexpected $end in C:\xampp\htdocs\seating.php on line 87 heres my code: <?php require ("admin/seating-auth.php");?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>SouthWest LAN's</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="css/styles.css" /> </head> <body> <!-- Begin Wrapper --> <div id="wrapper"> <!-- Begin Header --> <div id="header"><h1><br />SouthWest LAN's</h1></div> <!-- End Header --> <!-- Begin Navigation --> <div id="navigation"><ul> <li style="margin-right:15px; display:inline;"><a href="index.php">Home</a></li> <li style="margin-right:15px; display:inline;"><a href="gallery/">Photo Gallery</a></li> <li style="margin-right:15px; display:inline;"><a href="events.php">Events</a></li> <li style="margin-right:15px; display:inline;"><a href="account.php">My Account</a></li> <li style="margin-right:15px; display:inline;"><a href="forum.php">Forums</a></li> <li style="margin-right:15px; display:inline;"><a href="faq.php">FAQ</a></li> </ul></div> <!-- End Navigation --> <!-- Begin Content Column --> <div id="content"> <h1>Seating</h1><br /> <p> Please choose a seat. </p><br /> <?php /* connect to data base */ require ('./secure/connect.php'); echo "<table>\n<tr>\n"; $no = 1; $query = "SELECT * from seats_table"; $result = mysql_query($query); while($row = mysql_fetch_array($result)){ $status = ($row['taken']) ? "Taken by $row[user_id]" : '<a href="reserve_seat.php?seat='.$no.'">Available</a>'; echo "<td>Seat $no<br/>$status</td>\n"; $no++; echo "</tr>\n<\table>\n"; ?> <br /> <hr /><br /> <?php $result = mysql_query("SELECT user_level FROM users WHERE username='".$_SESSION['username']."'")or die(mysql_error()); $row = mysql_fetch_array($result); if ($row['user_level'] ==1) { echo '<a href="./admin/admin-panel.php">Admin Panel</a> -'; } ?> <a href="signup.php">Events Signup</a> - <a href="password.php">Change Password</a> - <a href="editprofile.php">Edit Profile</a> - <a href="logout.php">Logout</a> <div class="clear"> </div> </div> <div class="clear"> </div> <!-- End content Columns --> <!-- Begin Footer --> <div id="footer">Lee Brenchley - University of Plymouth © 2011 </div> <!-- End Footer --> </div> <!-- End Wrapper --> </body> </html> i tried the page without the code that you just gave me and it displays fine so there must be something missing from there thanks, Lee
  9. ok after a bit of work i have the second part i listed above working, users can swap between seats all they like and there previous seats are wiped clean with this code: $query2 = "UPDATE seats_table set taken = FALSE, user_id = '0' WHERE user_id = '$user_id'"; before updating there new seat still need a bit of help shhowing the username opposed to just "seat taken"
  10. ok i have it working now but theres a few problems. i would like it so next to the seat a user picks it displays the username of the person that has taken it, opposed to just seat taken. my current code for this is: <?php if ($seat_status[0]){ echo "Seat Taken"; } else{ ?> <a href="reserve_seat.php?seat=1">Availible</a> <?php } ?> I would like for it to echo out the username, so it would say "Seat taken by <there username>" Also if a user choses a seat then decides to choose another seat the old one is still marked as taken with there username shown for it in the database, i need a script that will check if the user already has a seat and clears it before showing them on another seat. Thanks alot if you can help me on this, but apart from these 2 points its working fine
  11. hi, im getting this error: Parse error: syntax error, unexpected '[' in C:\xampp\htdocs\seating.php on line 60 heres my code: <?php $user_id = $_SESSION['username']; /* connect to data base */ require ('./secure/connect.php'); /* proposed seats_table structure */ /* id, user_id (INT) , taken (TRUE/FALSE) */ /* table has 49 rows - row 1 represents seat 1, row 2 seat 2 etc etc */ /* initially user_id = 0 and taken = FALSE */ $query = "SELECT * from seats_table"; $result = mysql_query($query); while($row = mysql_fetch_array($result)){ $seat_status[] = $row['taken']; } /* display the data in a table */ ?> <table> <tr> <td >Seat 1 - </td><br/> <?PHP if(!seat_status[0]){ echo "Seat Taken"; } else{ ?> <a href="reserve_seat.php?seat=1">Availible</a> <?PHP } ?> </tr> <tr> </table> line 60 is this particluar line: if(!seat_status[0]){
  12. thanks a lot litebearer, i will have a play about with it now
  13. so your saying like this@ Seat 1 - Availible <hyperlink to seat_1.php> Seat 2 - <users username that has taken it> Seat 3 - Availible <hyperlink to seat_3.php> seat_1.php updates my seating database with seat number 1 with the username of the user that clicked it. Im thinking of getting it to pull the username from each seat with a echo row and if its empty (eg. no user has chosen that seat) then it shows the link to select it for yourself. does this seem right or is there a better way of doing it? Lee
  14. you also will want to hash the users password using md5 or better still sha1 sha1($_POST['password']) if you do this remember on your login script to also hash the password otherwise they won't match and protect your site from sql injection with this $_POST = array_map('strip_tags', $_POST); $_POST = array_map('mysql_real_escape_string', $_POST);
  15. hi, so i could have the seat number as a hyperlink to the script which stores the number they have selected with there username, so if i had 49 seats would this mean i would need 49 different process scripts (process_1.php -> process_49.php for example) or would there be a simplier way of doing this?
  16. Hi all, i want to write seating plan page, i want it to work by having the logged in user click on a link or image and the system will mark that users username into that seat. I have everything working in terms of the log in but as far as this page goes i really have no idea how i would start with it. If your not sure what i mean i can put it this way to make it much more understandable. If my page had the numbers 1 through to 49 listed down the side and next to each number it says as default "availible", but if the user click on that number the text next to that number changes from "availible" to the users username and no one others can click on that number as its "seat" or "number" has been taken. My users are stored within a mysql database and my site uses sessions like so: $_SESSION[username] = $row[username]; Many thanks for your help
  17. hi all, i have a register page with some basic validation but its throwing out this error: Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\process_r.php on line 84 heres my code: register.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Author: Reality Software Website: http://www.realitysoftware.ca Note: This is a free template released under the Creative Commons Attribution 3.0 license, which means you can use it in any way you want provided you keep the link to the author intact. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#username_input").keyup(function(){ txt=$("#username_input").val(); $.post("check.php",{username:txt},function(result){ $("#feedback").html(result); }); }); }); </script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link href="style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> .auto-style2 { font-size: 25px; } .auto-style3 { font-size: small; } </style> </head> <body> <div id="container"> <!-- header --> <div id="header"> <div id="logo"><a href="#"><span class="orange">SouthWest</span> LAN's</a></div> <div id="menu"> <ul> <li><a href="index.php">Home</a></li> <li><a href="events.php">Events</a></li> <li><a href="account.php">My Account</a></li> <li><a href="forum.php">Forums</a></li> <li><a href="faq.php">FAQ</a></li> </ul> </div> </div> <!--end header --> <!-- main --> <div id="main"> <div id="content"> <div id="head_image"> <div id="slogan"><strong><span class="auto-style2">Organising LAN Parties in the SouthWest</span></strong><br /></div> <div id="under_slogan_text"></div> </div> <div id="text"> <h1>Registration:</h1> <br /> <p class="auto-style3">Don't forget your login details as you will need them everytime you wish to login.</p> <form name="register" method="post" action="process_r.php"> <table border="0" width="225" align="center"> <tr> <td width="219" bgcolor="#999999"> <p align="center"><font color="white"><span style="font-size:12pt;"> All fields are required</span></font></p> </td> </tr> <tr> <td width="219"> <table border="0" width="282" align="center"> <tr> <td width="116"><span style="font-size:10pt;">Username:</span></td> <td width="156"><input type="text" id="username_input" name="username" maxlength="100" value="<?php echo $username; ?>"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;"></span></td> <td width="116"><div id="feedback"></div></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Email:</span></td> <td width="156"><input type="text" name="email" maxlength="100" value="<?php echo $email; ?>"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Password</span></td> <td width="156"><input type="password" name="password"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Confirm Password:</span></td> <td width="156"><input type="password" name="c_password"></td> </tr> <tr> <td width="116"> </td> <td width="156"> <p align="right"><input type="submit" name="register" value="Register"></p> </td> </tr> </table> </td> </tr> </table> </form> </div> </div> </div> </div> <!-- end main --> <!-- footer --> <div id="footer"> <div id="left_footer"><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a><br />© Copyright 2008 Clicker design </div> <div id="right_footer"> <!-- Please do not change or delete this link. Read the license! Thanks. :-) --> Design by <a href="http://www.realitysoftware.ca" title="Website Design">Reality Software</a> </div> </div> <!-- end footer --> </body> </html> process_r.php <?PHP //Database Information $dbhost = "localhost"; $dbname = "lee"; $dbuser = "lee"; $dbpass = "leecopter"; //Connect to database mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); //Clean data $_POST = array_map('strip_tags', $_POST); $_POST = array_map('mysql_real_escape_string', $_POST); $username = $_POST['username']; $email = $_POST['email']; $password = md5($_POST['password']); $c_password = $_POST['c_password']; $errorstring = ""; if(!$username){ $errorstring = $errorstring."Username<br>"; } if(!$email){ $errorstring = $errorstring."Email<br>"; } if(!$password){ $errorstring = $errorstring."Password<br>"; } if(!$c_password){ $errorstring = $errorstring."Confirm Password<br>"; } if ($errorstring!=""){ echo "Please full out the following fields:<br>$errorstring"; } else{ //Check to see if the username already exists $checkuser = mysql_query("SELECT username FROM users WHERE username='$username'"); $username_exist = mysql_num_rows($checkuser); if($username_exist > 0){ echo 'Im sorry but the username you specified has already been taken. Please pick another one.'; unset($username); include 'register.php'; exit(); } $query = "INSERT INTO users (username, email, password) VALUES('$username', '$email', '$password')"; mysql_query($query) or die(mysql_error()); mysql_close(); include 'thank-you.php' // mail user their information //$yoursite = ‘www.blahblah.com’; //$webmaster = ‘yourname’; //$youremail = ‘youremail’; //$subject = "You have successfully registered at $yoursite..."; //$message = "Dear $name, you are now registered at our web site. // To login, simply go to our web page and enter in the following details in the login form: // Username: $username // Password: $password // Please print this information out and store it for future reference. // Thanks, // $webmaster"; //mail($email, $subject, $message, "From: $yoursite <$youremail>\nX-Mailer:PHP/" . phpversion()); } ?> pretty sure the problem is within the process_r.php file
  18. nope afraid not, i dont even think the problem is with the check.php, i think the problem is in the script or form on the register.php page
  19. still no difference im afraid
  20. sure, here we go check.php: <?php mysql_connect("localhost", "lee", "leecopter"); mysql_select_db("lee"); $username = mysql_real_escape_string($_POST['username']); $check = mysql_query("SELECT username FROM users WHERE username='$username'"); $check_num_rows = mysql_num_rows($check); if ($username==NULL) echo "Choose a username"; else if (strlen($username)<=3) echo "Username is too short"; else { if ($check_num_rows==0) echo "Username is availible!"; else if ($check_num_rows==1) echo "Username has already been taken"; } ?> register.php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Author: Reality Software Website: http://www.realitysoftware.ca Note: This is a free template released under the Creative Commons Attribution 3.0 license, which means you can use it in any way you want provided you keep the link to the author intact. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#feedback').load('check.php').show(); $('#username_input').keyup(function(){ $.post('check.php', { username: register.username.value}, function(result) { $('#feedback').html(result).show(); }); }); }); </script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link href="style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> .auto-style2 { font-size: 25px; } .auto-style3 { font-size: small; } </style> </head> <body> <div id="container"> <!-- header --> <div id="header"> <div id="logo"><a href="#"><span class="orange">SouthWest</span> LAN's</a></div> <div id="menu"> <ul> <li><a href="index.php">Home</a></li> <li><a href="events.php">Events</a></li> <li><a href="account.php">My Account</a></li> <li><a href="forum.php">Forums</a></li> <li><a href="faq.php">FAQ</a></li> </ul> </div> </div> <!--end header --> <!-- main --> <div id="main"> <div id="content"> <div id="head_image"> <div id="slogan"><strong><span class="auto-style2">Organising LAN Parties in the SouthWest</span></strong><br /></div> <div id="under_slogan_text"></div> </div> <div id="text"> <h1>Registration:</h1> <br /> <p class="auto-style3">Don't forget your login details as you will need them everytime you wish to login.</p> <form name="register" method="post" action="process_r.php"> <table border="0" width="225" align="center"> <tr> <td width="219" bgcolor="#999999"> <p align="center"><font color="white"><span style="font-size:12pt;"> All fields are required</span></font></p> </td> </tr> <tr> <td width="219"> <table border="0" width="282" align="center"> <tr> <td width="116"><span style="font-size:10pt;">Username:</span></td> <td width="156"><input type="text" id="username_input" name="username" maxlength="100"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;"></span></td> <td width="116"><div id="feedback"></div></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Email:</span></td> <td width="156"><input type="text" name="email" maxlength="100"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Password</span></td> <td width="156"><input type="password" name="password"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Confirm Password:</span></td> <td width="156"><input type="password" name="c_password"></td> </tr> <tr> <td width="116"> </td> <td width="156"> <p align="right"><input type="submit" name="register" value="Register"></p> </td> </tr> </table> </td> </tr> </table> </form> </div> </div> </div> </div> <!-- end main --> <!-- footer --> <div id="footer"> <div id="left_footer"><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a><br />© Copyright 2008 Clicker design </div> <div id="right_footer"> <!-- Please do not change or delete this link. Read the license! Thanks. :-) --> Design by <a href="http://www.realitysoftware.ca" title="Website Design">Reality Software</a> </div> </div> <!-- end footer --> </body> </html>
  21. Hi all, i have a script which checks the username field of my register form as the user types it and checks to see if the username is either taken, is too short or availible using jquery, however it isn't working and i've been staring at it for ages trying to work out why. Due to the length of my code ive put it on codepad. Here is my register.php: http://codepad.org/8REOfI8q and here is my check.php: http://codepad.org/gXSkbnsf My form is just displaying "Choose a username" and not changing depending on my input etc... Any help would be great
  22. thanks for your replies, doddsey_65 your a star
  23. Hi all, i have written a fairly simple profile page that users can see once they have logged in and i have a password change feature. the user is asked to enter there current password and then enter there desired new password, then confirm there new password to make sure they match. However the users current password isn't checked as im not sure how to code it. Heres my code so far: <?PHP session_start(); //Database Information $dbhost = "localhost"; $dbname = "test"; $dbuser = "test"; $dbpass = "test"; //Connect to database $conn = mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname, $conn) or die(mysql_error()); //Clean data $_POST = array_map('strip_tags', $_POST); $_POST = array_map('mysql_real_escape_string', $_POST); $currentpassword = $_POST['currentpassword']; $newpassword = $_POST['newpassword']; $cnewpassword = $_POST['cnewpassword']; if($newpassword == $cnewpassword) { $query = "UPDATE `users` SET `password` = '".$newpassword."' WHERE `username` = '".$_SESSION['username']."' LIMIT 1"; $run = mysql_query($query); if($run) { echo "Congratulations You have successfully changed your password"; include 'success.php'; exit(); } else { include 'password.php'; exit; } } else { echo "The new password and confirm new password fields must be the same"; include 'password.php'; exit(); } ?> I'm guessing i need a && within the if statement to check the currentpassword with what is supplied within my database, but im not sure how to code this. Lee
  24. users are assigned a user_id which is auto_incremented and is the primary key within my database however i would prefer to use the session username rather than there user_id, also speed isn't as issue at the moment so if i wanted to use there username as the search variable was i correct in my above post on how to write the table showing the data?
×
×
  • 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.