Jump to content

ciaran1987

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ciaran1987's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have replaced sha1/sha_pw with "password" as it was confusing with various different names,hopefully this will make it easier to spot any mistakes,many thanks again. <form method="post" action="insert.php"> Full Name: (Example: Michael R Maguire) <br /> <input type="text" name="user_name" size="50" maxlength="50"/> (50 Characters Max) <br /> <br /> User Name: <br /> <input type="text" name="password" size="20" maxlength="20"/> (20 Characters Max) <br /> <br /> <input type="submit" value="Create User" /> </form> <?php $user_name = $_POST['user_name']; $password = $_POST['password']; $dbname = "heskdb"; $conn = mysql_connect ("localhost","root","password") or die ('cannot connect to database error: '.mysql_error()); mysql_select_db ($dbname); if(empty($user_name) || empty($password)) { echo "<h2>Please fill in all fields</h2>\n"; echo "Please use the back button in your browsers and fill in all required fields.\n"; die (); } $sql="insert into teamtutorials_test (`User_ID` , `user_name` , `password`) values ('NULL','$user_name','$password')"; mysql_query($sql) or die (mysql_error()." $sql"); echo "user_name: $user_name"; echo "Password: ".($password); ?> <form method="post" action="session.php"> Full Name: (Example: Michael R Maguire) <br /> <input type="text" name="user_name" size="50" maxlength="50"/> (50 Characters Max) <br /> <br /> User Name: <br /> <input type="text" name="password" size="20" maxlength="20"/> <br /> <br /> <input type="submit" value="Create User" /> </form> <?php session_start(); if (isset($_POST['user_name']) && isset($_POST['password'])) { $user_name = $_POST['user_name']; $password = $_POST['password']; $dbname = "heskdb"; $conn = mysql_connect ("localhost","root","password") or die ('cannot connect to database error: '.mysql_error()); mysql_select_db ($dbname); $sql = mysql_query("select * from teamtutorials_test where user_name = '$user_name' and password = '$password'") or die(mysql_error()); $results = mysql_result($sql, 0); if ($results == 0){ header( 'Location:http://www.yahoo.com'); } else { $_SESSION['valid_user'] = $user_name; header( 'Location:http://www.google.ie'); } } ?>
  2. I`ve echoed the query string and when I enter in the Username :Ciaran and pass: password it returns user_Name: CiaranPassword: password user_Name: ciaranSha Password: 4c0dffd9ee85b2520acaa4a2b2722450d583b30e But when I look at what is entered in my DB through php my admin it is as I entered.Theres something obviously going wrong somehwere.
  3. Thanks I`ve made a few changes including the changes you re comended <form method="post" action="insert.php"> Full Name: (Example: Michael R Maguire) <br /> <input type="text" name="user_name" size="50" maxlength="50"/> (50 Characters Max) <br /> <br /> User Name: <br /> <input type="text" name="sha_pw" size="20" maxlength="20"/> (20 Characters Max) <br /> <br /> <input type="submit" value="Create User" /> </form> <?php $user_name = $_POST['user_name']; $SHA_PW = $_POST['sha_pw']; $dbname = "heskdb"; $conn = mysql_connect ("localhost","root","password") or die ('cannot connect to database error: '.mysql_error()); mysql_select_db ($dbname); if(empty($user_name) || empty($sha_pw)) { echo "<h2>Please fill in all fields</h2>\n"; echo "Please use the back button in your browsers and fill in all required fields.\n"; die (); } $sql="insert into teamtutorials_test (`User_ID` , `user_name` , `sha_pw`) values ('NULL','$user_name','sha1($sha_pw)')"; mysql_query($sql) or die (mysql_error()." $sql"); ?> <form method="post" action="session.php"> Full Name: (Example: Michael R Maguire) <br /> <input type="text" name="user_name" size="50" maxlength="50"/> (50 Characters Max) <br /> <br /> User Name: <br /> <input type="text" name="password" size="20" maxlength="20"/> <br /> <br /> <input type="submit" value="Create User" /> </form> <?php session_start(); if (isset($_POST['user_name']) && isset($_POST['password'])) { $user_name = $_POST['user_name']; $password = $_POST['password']; $dbname = "heskdb"; $conn = mysql_connect ("localhost","root","password") or die ('cannot connect to database error: '.mysql_error()); mysql_select_db ($dbname); $sql = mysql_query("select count(*) from teamtutorials_test where user_name = '$user_name' and sha_pw = sha1('$password')") or die(mysql_error()); $results = mysql_result($sql, "0"); if ($results == 0){ header( 'Location:http://www.yahoo.com'); } else { $_SESSION['valid_user'] = $user_name; header( 'Location:http://www.google.ie'); } } ?> When I enter in a name and password whether they are authorised or unauthorized both are brought to yahoo IE saying they are unauthorized
  4. Exellent,Thanks MT.Now I am getting just a blank white page when I enter in a username and and pass,whther that username is correct or not.Any ideas?(I`m a PHP newbie)Thanks
  5. Hi Guys I am trying to create an authentication system using a tutorial where a user enters there username and pass,it is saved in an SQL DB ,they then gain access to the system when they enter a username and pass that is saved in the DB but I am having trouble. <form method="post" action="insert.php"> Full Name: (Example: Michael R Maguire) <br /> <input type="text" name="user_name" size="50" maxlength="50"/> (50 Characters Max) <br /> <br /> User Name: <br /> <input type="text" name="SHA_PW" size="20" maxlength="20"/> (20 Characters Max) <br /> <br /> <input type="submit" value="Create User" /> </form> <?php $user_name = $_POST['user_name']; $SHA_PW = $_POST['SHA_PW']; $dbname = "heskdb"; $conn = mysql_connect ("localhost","root","password") or die ('cannot connect to database error: '.mysql_error()); mysql_select_db ($dbname); if(empty($user_name) || empty($SHA_PW)) { echo "<h2>Please fill in all fields</h2>\n"; echo "Please use the back button in your browsers and fill in all required fields.\n"; die (); } $sql="insert into teamtutorials_test ,users (`User_ID` , `user_name` , `sha_pw`) values ('NULL','$user_name','sha1($SHA_PW)')"; mysql_query($sql) or die (mysql_error()." $sql"); ?> <form method="post" action="session.php"> Full Name: (Example: Michael R Maguire) <br /> <input type="text" name="user_name" size="50" maxlength="50"/> (50 Characters Max) <br /> <br /> User Name: <br /> <input type="text" name="password" size="20" maxlength="20"/> <br /> <br /> <input type="submit" value="Create User" /> </form> <?php session_start(); if (isset($_POST['username']) && isset($_POST['password'])) { $username = $_POST['username']; $password = $_POST['password']; $conn = mysql_connect ("localhost","root","password") or die ('cannot connect to database error: '.mysql_error()); $sql = mysql_query("select count(*) from teamtutorials_test where user_name = '$username' and sha_pw = sha1('$password')") or die(mysql_error()); $results = mysql_result($sql, "0"); if ($results == 0){ header( 'Location:http:/www.yahoo.com'); } else { $_SESSION['valid_user'] = $username header( 'Location:http://wwww.google.ie'); } } ?> The error that I am receiving says parse error line 24(where the google URL is entered). Does anybody have any idea where I am going wrong? Many thanks in advance
  6. what include files do you have on that script ?, and is that the whole script ? There are another main file which uses the file I pasted initially. admin_main.php define('IN_SCRIPT',1); /* Get all the required files and functions */ require_once('hesk_settings.inc.php'); require_once('language/'.$hesk_settings['language'].'.inc.php'); require_once('inc/common.inc.php'); hesk_session_start(); hesk_isLoggedIn(); require_once('inc/database.inc.php'); hesk_dbConnect() or hesk_error("$hesklang[cant_connect_db] $hesklang[contact_webmsater] $hesk_settings[webmaster_mail]!"); /* Print header */ require_once('inc/header.inc.php'); /* Print admin navigation */ require_once('inc/show_admin_nav.inc.php'); ?> </td> </tr> <tr> <td> <h3 align="center"><?php echo $hesklang['open_tickets']; ?></h3> <?php require_once('inc/print_tickets.inc.php'); ?> <hr> <?php require_once('inc/show_search_form.inc.php'); show_admin_nav.inc.php /* Check if this is a valid include */ if (!defined('IN_SCRIPT')) {die($hesklang['attempt']);} ?> <div align="center"> <center> <table border="0" width="750" cellspacing="1" cellpadding="3" class="white"> <tr> <td align="center" class="admin_white"> <a href="admin_main.php"><?php echo $hesklang['main_page']; ?></a> | <a href="manage_users.php"><?php echo $hesklang['manage_users']; ?></a> | <a href="manage_categories.php"><?php echo $hesklang['manage_cat']; ?></a> | <a href="form.html.php"><?php echo $hesklang['form']; ?></a> | <a href="profile.php"><?php echo $hesklang['profile']; ?></a> | <a href="admin_settings.php"><?php echo $hesklang['settings']; ?></a> | <a href="form.html"><?php echo $hesklang['form']; ?></a> <a href="admin.php?a=logout"><?php echo $hesklang['logout']; ?></a> | </td> </tr> </table> </center> </div> Does this give you any more of the info you need?
  7. I`m sorry but I am not used to PHP,could you give me an idea on how I would go about doing this,when you say array do you mean $hesklang['form']? Thanks
  8. Hi Guys I am using an open source helpdesk and want to add in a few links to files that I have created but I am having trouble as they do not appear when I run the helpdesk. /* Check if this is a valid include */ if (!defined('IN_SCRIPT')) {die($hesklang['attempt']);} ?> <div align="center"> <center> <table border="0" width="750" cellspacing="1" cellpadding="3" class="white"> <tr> <td align="center" class="admin_white"> <a href="admin_main.php"><?php echo $hesklang['main_page']; ?></a> | <a href="manage_users.php"><?php echo $hesklang['manage_users']; ?></a> | <a href="manage_categories.php"><?php echo $hesklang['manage_cat']; ?></a> | <a href="form.html.php"><?php echo $hesklang['form']; ?></a> | <a href="profile.php"><?php echo $hesklang['profile']; ?></a> | <a href="admin_settings.php"><?php echo $hesklang['settings']; ?></a> <a href="admin.php?a=logout"><?php echo $hesklang['logout']; ?></a> | </td> </tr> </table> </center> </div> This is the code that originally came with the helpdesk.I try and add inn a link to my files by adding | <a href="form.html"><?php echo $hesklang['form']; ?></a> but nothing happens when I run the program.If I delete one of the links shown above then the link will be deleted when I run the program so I am sure I am editing the correct file.Anybody any ideas?
  9. Thanks ,the error is Column count doesn't match value count at row 1 insert into hesk_std_replies(category,problem,solution) values ('hardware''Broken Mouse''Connection')
  10. Its the "die" message -error updating database mysql_query($query) or die ('error updating database');
  11. Thanks for the reply but I am still having the same error IE error updating database
  12. Hi Guys I was wondering if you could help me with a problem I am having.I`m trying to create a PHP file that enters information into 3 separate fields into a table row when the user enters information into a HTML form. at the moment I have created this <html> <head> <title>update database</title> </head> <body> <form method="post" action="update.php"> Please state the category of problem that has occurred<br/> <input type="text" name="category" size="70"/></br> Please give a desription of the problem</br> <input type="text" name="problem" size="70"/></br> Please give a solution to the problem<br/> <input type="text" name="solution" size="70"/></br> <input type="submit" value="Submit the problem and solution"/> </form> </body> </html> <?php $category = $_POST['category']; mysql_connect ("localhost", "root","password") or die (mysql_error()); mysql_select_db ("heskdb"); $query="insert into hesk_std_replies (category) values ('$category')"; mysql_query($query) or die ('error updating database'); echo"database updated with:".$category; $solution = $_POST['solution']; mysql_connect ("localhost", "root","password") or die (mysql_error()); mysql_select_db ("heskdb"); $query="insert into hesk_std_replies (solution) values ('$solution')"; mysql_query($query) or die ('error updating database'); echo"database updated with:".$solution; $problem = $_POST['problem']; mysql_connect ("localhost", "root","password") or die (mysql_error()); mysql_select_db ("heskdb"); $query="insert into hesk_std_replies (problem) values ('$problem')"; mysql_query($query) or die ('error updating database'); echo"database updated with:".$problem; ?> The problem with this is thatit enters the inormation into 3 incremental rows where I want it to be entered into the same row. I have created this file which I thaught would work but it is giving me errors. gdds <?php $category = $_POST['category']; $problem = $_POST['problem']; $solution = $_POST['solution']; mysql_connect ("localhost", "root","password") or die (mysql_error()); mysql_select_db ("heskdb"); $query="insert into hesk_std_replies(category,problem,solution) values ('.$category.''.$problem.''.$solution.')"; mysql_query($query) or die ('error updating database'); echo"database updated with:".$category ,$problem,$solution; ?> Any help would be much appreciated
  13. Something that builds GUI`S ,I`m not too familiar with them but I have been told that they are good because I am not used to code or building GUI,there a drag and drop type application I believe.I think that their also known as GUI widgets,I`ve tried googling and open source sites but none seem to be very reliable or are not written for PHP.
  14. Hi guys,I`m editing an open source PHP IT support helpdesk at the moment by adding in some extra functionalists through HTML/PHP/SQL ,I was wondering could anyone recommend any(free) GUI builders to help me with the design of the files that I create and add to the helpdesk.Would it be feasible to use a GUI builder/widget written for a different language? Thanks alot
×
×
  • 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.