Jump to content

allyant

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Contact Methods

  • AIM
    allisteraa
  • MSN
    allistera@gmail.com
  • ICQ
    425379923

Profile Information

  • Gender
    Male
  • Location
    Scotland

allyant's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You can get your hands on the free MSSQL express version to test on your development computer.
  2. Ok, finily got it working I have no idea what was wrong with it. Here was my final code: <?PHP $dbHost = "localhost"; $dbUser = "root"; $dbPass = "******"; $dbDatabase = "users"; $db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database."); mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database."); $user = addslashes($_POST['username']); $pass = sha1($_POST['password']); $result = mysql_query("SELECT * FROM `simple` WHERE `username` = '{$user}' AND `password`='{$pass}'"); if(mysql_num_rows($result)==1){ session_start(); session_register('username'); //successful login code will go here... echo 'Success!'; }else { echo 'Incorrect login name or password. Please try again.'; } ?>
  3. When I enter allyant and a password that is not correct the $username gets hashed but the database output stays the same, example: username: allyant password: 1234: User: allyant Pass: 7110eda4d09e062aa5e4a390b0a572ac0d2c0220 Array ( [id] => 1 [username] => allyant [password] => 206c80413b9a96c1312cc346b7d2517b84463edd ) When I change the username to aa and the password to aaa I get: User: aa Pass: 7e240de74fb1ed08fa08d38063f6a6a91462a815 (note that I only currently have one field on the database: Username: allyant Password: 206c80413b9a96c1312cc346b7d2517b84463edd )
  4. Sure, output: User: allyant Pass: 206c80413b9a96c1312cc346b7d2517b84463edd Array ( [id] => 1 [username] => allyant [password] => 206c80413b9a96c1312cc346b7d2517b84463edd )
  5. Ok this is the output: User: allyant Pass: 206c80413b9a96c1312cc346b7d2517b84463edd Resource id #3 The encryption matched the password field in the database(sha1, pass: testpass)
  6. Ok so I made a new database (ID, username, password) added a user to it, but now it just says that the password is incorrect... Here is the coad now: <?PHP session_start(); $dbHost = "localhost"; $dbUser = "root"; $dbPass = "*******"; $dbDatabase = "users"; $db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database."); mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database."); $user = addslashes($_POST['username']); $pass = sha1($_POST['password']); $result=mysql_query("SELECT * FROM `simple` WHERE `username`='$user' AND `password`='$pass' LIMIT 1"); if(mysql_num_rows($result)==1){ $_SESSION[user]=mysql_fetch_assoc($query); echo 'Success!'; header( "Location: searchlogin.php" ); }else { echo 'Incorrect login name or password. Please try again.'; } ?>
  7. Thanks, I tried it but it still comes back as logged in(redirects me to "searchlogin.php") when I enter a correct username but a wrong password...
  8. Hey there, I am making a simple login script, the only problem is that I only need the username to login, if I enter any password but the correct username I can still log in using that username without knowing the password. Here is the script: <?PHP //convert the field values to simple variables //add slashes to the username and md5() the password $user = addslashes($_POST['username']); $pass = sha1($_POST['password']); //set the database connection variables $dbHost = "localhost"; $dbUser = "root"; $dbPass = "******"; $dbDatabase = "users"; //connet to the database $db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database."); mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database."); $result=mysql_query("select * from main where username='$user' AND password='$pass'", $db); //check that at least one row was returned $rowCheck = mysql_num_rows($result); if($rowCheck > 0){ while($row = mysql_fetch_array($result)){ //start the session and register a variable session_start(); session_register('username'); //successful login code will go here... echo 'Success!'; //we will redirect the user to another page where we will make sure they're logged in header( "Location: searchlogin.php" ); } } else { //if nothing is returned by the query, unsuccessful login code goes here... echo 'Incorrect login name or password. Please try again.'; } ?> Thanks for any assistance.
  9. Beginning ASP.NET 2.0 with C# http://www.wrox.com/WileyCDA/WroxTitle/productCd-0470042583.html
  10. thanks! that done it, I downloaded a nice app named BatChmod that allows me to change the folders permission.
  11. Hey, I compiled Apache + PHP on Mac OSX, Everything is fine except I get 404 - Forbidden every time I go to a directory other than / (localhost). I had a look at my httpd.conf file and edited it but I still get the same result, here it is (without the comments): ServerRoot "/apache2" Listen 80 LoadModule php5_module modules/libphp5.so <IfModule !mpm_netware_module> User daemon Group daemon </IfModule> ServerAdmin you@example.com DocumentRoot "/apache2/htdocs" <Directory /> AllowOverride None Order deny,allow Deny from all Satisfy all Options Indexes </Directory> <Directory /> Options Indexes AllowOverride all Order Deny,Allow </Directory> <IfModule dir_module> DirectoryIndex index.php index.php3 index.html index.htm index.html.var </IfModule> <FilesMatch "^\.ht"> Order allow,deny Deny from all Satisfy All </FilesMatch> ErrorLog logs/error_log LogLevel warn <IfModule log_config_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common <IfModule logio_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </IfModule> CustomLog logs/access_log common </IfModule> <IfModule alias_module> ScriptAlias /cgi-bin/ "/apache2/cgi-bin/" </IfModule> <IfModule cgid_module> </IfModule> <Directory "/apache2/cgi-bin"> AllowOverride None Options Indexes Order allow,deny Allow from all </Directory> DefaultType text/plain <IfModule mime_module> TypesConfig conf/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps </IfModule> <IfModule ssl_module> SSLRandomSeed startup builtin SSLRandomSeed connect builtin </IfModule>
  12. Thanks for that I have a lot of coding to do Looks like someone took it down too, can that person PM me and tell me what they done?
  13. Hey, Just want users to test out my school site that I helped program: http://www.deanschs.co.uk/controller.php?do=get&mode=embedded&id=1 Any feedback is welcome.
  14. Thanks Darren! Thats It working fine now, I must have forgot to change the form action when I copied it from the newcontact.php script. Once again thanks!
  15. Hey, new guy to here and PHP, Im having a problem updating a database, I ask the database to update but it inserts a new field insted, here is the update.php: <?php $connection = mysql_connect("localhost","root","********"); $db_select = mysql_select_db("address",$connection); $id = $_GET['id']; $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; if (intval($_GET['id']) == NULL) { header("Location: mysql.php"); } if ($name && $email && $phone != NULL) { $query = "UPDATE table SET `name` = '$name' WHERE `id` = '$id' LIMIT 1"; $result = mysql_query($query, $connection); } if (isset($id)) { $result = mysql_query("SELECT * FROM simple WHERE id = '{$id}'", $connection); $row = mysql_fetch_array($result); } ?> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <title>Edit A Contact</title> </head> <body > <h1>Edit A Contact</h1> <br /> <form action="newcontact.php" method="post"> Name: <input type="text" name="name" value="<?php echo $row["name"] ?>" /><br /> Email: <input type="text" name="email"value="<?php echo $row["email"] ?>" /><br /> Phone: <input type="text" name="phone"value="<?php echo $row["phone"] ?>" /><br /> <input type="submit"> </form> </body> <?php mysql_close($connection); ?> When I submit the updated information rather than updating the information it adds a new row with the information. I am using PHP with MySQL. Thanks.
×
×
  • 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.