Jump to content

fonecave

Members
  • Posts

    61
  • Joined

  • Last visited

Contact Methods

  • MSN
    andynewham@hotmail.com

Profile Information

  • Gender
    Not Telling

fonecave's Achievements

Member

Member (2/5)

0

Reputation

  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!
×
×
  • 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.