Jump to content

fonecave

Members
  • Posts

    61
  • Joined

  • Last visited

Everything posted by fonecave

  1. Perfect thank you so much I think the main problem was case sensitivity but thanks for all your help
  2. Hi Guys, I have a JET SQL query that i need to convert to MYSQL (Appologies too if this is posted in the wrong section.. i never know whether to go PHP or MYSQL!) Im not being lazy.. ive tried for hours but cannot get it to work, it has two depth inner join and a group by with a where (with 1 criteria)... If anyone can help id massively appreciate it and also explain how you got there... SELECT Count(tbl_Items.ItemID) AS CountOfItemID, tbl_LU_Collections.CollectionDesc FROM (tbl_Items LEFT JOIN tbl_LU_Categories ON tbl_Items.ItemCategory = tbl_LU_Categories.ItemCatID) LEFT JOIN tbl_LU_Collections ON tbl_LU_Categories.CollectionID = tbl_LU_Collections.CollectionID WHERE (((tbl_Items.RetailProduct)=-1)) GROUP BY tbl_LU_Collections.CollectionDesc;
  3. Thanks matey, Ill give it a go and see if it does the job! Thanks
  4. Hi Guys, I am trying to run a mysql query in PHP, I need it to select all field in the products table where it matches a variable to the string in a field in the table AND the other where statement in there... Could i do something like this? ----- ALSO THIS NEEDS TO BE CASE IN-SENSITIVE $query = "SELECT * FROM products WHERE availability ='A' AND instr(['search_terms'],'test')<>0";
  5. After that i have eventually used a flash actionscript to post the login details to the database and then set a cookie if authorised and used the header() function to send the user back to the loginpage where there is a script that reads if there is a cookie set and if so shows the welcome message and a logout link, But.... when the user is authorised and sent back to the login page the logout script doesnt pick up the fact that there is a new cookie until the refresh key is hit! why is this? www.foxmart.co.uk/index.html test with: User Email: test@test.com password: test Thanks
  6. So with that, if the cookie was set i want to show a logout link and when clicked should unset the cookie... How can i do that?
  7. Hi Guys, This question is partly about Javascript too but you probably know all about it too. I am trying to use a php script with mysql database to authenticate users and set a cookie. Basically i need a members site I currently have my database which is perfectly fine at the moment. Then i have 2 php scripts one is a login and one is registration. I have them as seperate scripts ie login.php and register.php both saved on the server and the index.html page has each of them in an iframe. They both seem to work ok but the only problem is what do i do when i have authenticated an set the cookie? i cant set a header as the script running it is in an iframe! could i send a refresh command or send an f5 key? What is the best way to do this? I also have login/logout part but i want to run it in javascript so that if a cookie is set, it shows logout and if pressed unsets the cookie (called user) and if no cookie is set i want it to display login and forward to a page.... login.html? or something not made it yet. I tried writing a script and placing it on the page in a script box (Sitespinner) but it doesnt work: <html> <head> <script type="text/javascript"> function checkCookie() { username=getCookie('user'); if (username!=null && username!="") { alert('Welcome again '+user+'!'); } } </script> </head> <body onLoad="checkCookie()"> </body> </html>
  8. I dont want the id i just want the actual password stored in that record as there will either be none or just 1 as the registration process weeds out duplicates the mysql_numrows($result) lets me know if the login is not there at all but when the record is present i want to encapsulate the password in a variable so a can do a variable match if ($mysqlpassword == $pass) { }
  9. I get Match FoundResource id #3 if i type in an email address thats registered how do i try and match the password attached to the record with a variable to obtain a password match or fail? i.e if ($result == $pass) { do code } UPDATED: <?php if (isset ($_POST['login'])) { $username=trim($_POST['username']); $pass=trim($_POST['pass']); if (empty($username) || empty($pass)) { echo '<form action="login.php" method="post"'; echo 'enctype="multipart/form-data">'; echo '<input type="text" name="username" /><br>'; echo '<br>'; echo '<input type="password" name="pass" />'; echo '<br>'; echo ' '; echo ' '; echo ' <input type="submit" '; echo 'name="login" value="Login" />'; echo '</form>'; echo "<script>alert('Please enter username and password to login.')</script>"; } else { $con = mysql_connect("localhost","fonecave_admin","cloud9"); if (!$con) { die('Contact support@fonecave.co.uk - Could not connect: ' . mysql_error()); } mysql_select_db("fonecave_00001", $con); $result = mysql_query("SELECT password FROM members WHERE email='$username'") or die(mysql_error()); if (mysql_numrows($result) > 0) { echo 'Match Found'; echo $result; } else { echo "<script>alert('Login details incorrect.')</script>"; echo '<form action="login.php" method="post"'; echo 'enctype="multipart/form-data">'; echo '<input type="text" name="username" /><br>'; echo '<br>'; echo '<input type="password" name="pass" />'; echo '<br>'; echo ' '; echo ' '; echo ' <input type="submit" '; echo 'name="login" value="Login" />'; echo '</form>'; } } } else { echo '<form action="login.php" method="post"'; echo 'enctype="multipart/form-data">'; echo '<input type="text" name="username" /><br>'; echo '<br>'; echo '<input type="password" name="pass" />'; echo '<br>'; echo ' '; echo ' '; echo ' <input type="submit" '; echo 'name="login" value="Login" />'; echo '</form>'; } ?>
  10. I am trying to access my database to match the password field for posted_password from a form then set a cookie I can't even get the php code to give me the password in the db for the submitted username! (which is an email address) If i can at least get info from the db i can finish the script HELP! <?php if (isset ($_POST['login'])) { $username=trim($_POST['username']); $pass=trim($_POST['pass']); if (empty($username) || empty($pass)) { echo '<form action="login.php" method="post"'; echo 'enctype="multipart/form-data">'; echo '<input type="text" name="username" /><br>'; echo '<br>'; echo '<input type="password" name="pass" />'; echo '<br>'; echo ' '; echo ' '; echo ' <input type="submit" '; echo 'name="login" value="Login" />'; echo '</form>'; echo "<script>alert('Please enter username and password to login.')</script>"; } else { $con = mysql_connect("localhost","admin_login","pass1"); if (!$con) { die('Contact support@fonecave.co.uk - Could not connect: ' . mysql_error()); } mysql_select_db("fonecave_00001", $con); $result = mysql_query("SELECT password FROM members WHERE email=$_POST['username']"); echo $result; } } else { echo '<form action="login.php" method="post"'; echo 'enctype="multipart/form-data">'; echo '<input type="text" name="username" /><br>'; echo '<br>'; echo '<input type="password" name="pass" />'; echo '<br>'; echo ' '; echo ' '; echo ' <input type="submit" '; echo 'name="login" value="Login" />'; echo '</form>'; } ?>
  11. Thanks for the tip, i must use that more. Heres what i got... Error: No database selected with query SELECT email FROM members WHERE email='user@fonecave.co.uk' it was obvious what i had to do so now fixed! Thank You all so much for your help yet again!
  12. ok i get this now: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /www/110mb.com/f/o/n/e/c/a/v/e/fonecave/htdocs/login.php on line 406 $sql_email_check = mysql_query("SELECT email FROM members WHERE email='$address'"); $email_check = mysql_num_rows($sql_email_check); //line406 if($email_check > 0) { echo 'Registration Failed, Already Registered!'; } else { mysql_select_db("fonecave_00001", $con); mysql_query("INSERT INTO members (name, email, password) VALUES ('$name', '$address', '$password')"); echo "Registration Complete!";}
  13. I Think there was an error with the db i have receated the table and it now work, What code would i use to search for a duplicate email address before adding?
  14. Table structure for: Members Field Name Type Null Key Default Extra name varchar(20) No Unknown email varchar(30) No PRI password varchar(20) No Ihave tried members and Members neither work
  15. ** Deleted for security purposes **
  16. i get the successful text echoed on the page, but nothing appears in the database not even blank records but it must be connecting fine can you think of anything else
  17. I Have tried that i get this Parse error: syntax error, unexpected T_ELSE in /www/110mb.com/f/o/n/e/c/a/v/e/fonecave/htdocs/login.php on line 438
  18. Why is this code not adding anything? It connects ok but doesnt add a recordset <?php if (isset ($_POST['submit'])) { $name=$_POST["name"]; $address=$_POST["address"]; $password=$_POST["password"]; $con = mysql_connect("localhost","my_db","password"); //these are correct login details table is called Members if (!$con) { die('Contact support@fonecave.co.uk - Could not connect: ' . mysql_error()); } mysql_select_db("fonecave_00001", $con); mysql_query("INSERT INTO members (name, email, password) VALUES ('$name', '$address', '$password')"); echo "Registration Complete!"; ?>
  19. HI, i am trying to get a flash file to send a txt variable called ChatText to a php file on my site, if it cant be done ill do it to a txt file instead. The only thing is i was trying to use LoadVars.sendAndLoad() in flash and it opens a new browser window because it uses GET and POST, if anyone knows anything about flash and php would be great can any one suggest anything?
  20. have changed the code to submit into another php file which gives me a new clean page in the same frame!
  21. Have built it on a text file that contains the information instead of a database have a look at www.fonecave.co.uk goto themes and search for "test" or the themes that can be found in the two catagories there aren't many at the minute have only just set it up, if you want to know how ive done it send me an email thanks for your help andy
×
×
  • 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.