cokacola's Profile User Rating: -----

Reputation: 5 Worker
Group:
Contributors
Active Posts:
62 (0.05 per day)
Joined:
23-July 10
Profile Views:
1,682
Last Active:
User is offline Mar 09 2014 05:12 AM
Currently:
Offline

Previous Fields

Country:
AU
OS Preference:
Who Cares
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
50

Latest Visitors

Icon   cokacola has not set their status

Posts I've Made

  1. In Topic: Cooking Up Some Password Hash

    Posted 3 Mar 2014

    Yea I think a lot of people actually do store it in the database and link it to the user.
    As long as your users are using secure passwords you should be pretty good.
    Should also possibly implement some security to prevent brute forcing, for example I heard some sites actually intentionally slow down the login request by a little bit(like 300ms).
    Makes no difference to the user but if you're running thousands of requests it would slow them down a bit. Also, you could implement a system that allows 5 password attempts before either locking the account or blocking login requests from that IP for like 30 minutes or something, a lot of forums and such I've seen do that.

    And ah, well if you change your mind I also linked the compatibility library, same functions for PHP 5.3.7+.
  2. In Topic: You're DOING IT WRONG!

    Posted 3 Mar 2014

    Well that's a lot of bad code!
    Nothing hurts my eyes more then using mysql_* functions to insert _GET or _POST variables directly into the database.
    It's like plain-text passwords with a public phpmyadmin using a root with a password of 'abc123' or something.
    Seriously I think it could give some developers a stroke!
  3. In Topic: Cooking Up Some Password Hash

    Posted 3 Mar 2014

    I assume that'd be fairly difficult to reverse.
    I assume you're storing the hash in your database too?

    Also, if you're running PHP 5.5+ you have access to the new functions designed just for this purpose: http://www.php.net/m...ok.password.php
    And if you don't have 5.5 but do have 5.3.7+ you can also try out this compatibility library here: https://github.com/i...password_compat
    Good luck!
  4. In Topic: TextBox navigation using arrow keys

    Posted 3 Mar 2014

    Hmm, there is a separate .Select() for the TextBox that takes two arguments and selects text, but if you're not providing any arguments I don't see why it would interfere.
    If you're trying to accomplish input focus, you could try input.Focus().
    Check out MSDN: http://msdn.microsof...(v=vs.110).aspx
  5. In Topic: Retrieve data from database into dropdownlist using ajax

    Posted 3 Mar 2014

    I'll assume the page you listed is getuser.php
    First off, it's displayed because you're asking for $_GET['q] before you even submit the request.
    Since you have the PHP at the bottom of the page, it'll run regardless of whether or not you actually submit your ajax request.
    To fix this, you can wrap your PHP code in an if statement and check if the variable exists.
    On top of this, if what I've said is true and it's the same page, the data returned by the ajax request will contain all of your HTML as well.
    So, if they are both in the same page, you can try either placing the HTML and the PHP in two separate files, or try something like this:
    <?php
    	if(isset($_GET['q']))
    	{
    		$q = intval($_GET['q']);
    
    		$con = mysqli_connect('localhost','root','','my_db');
    		if (!$con)
    		  {
    		  die('Could not connect: ' . mysqli_error($con));
    		  }
    
    		mysqli_select_db($con,"ajax_demo");
    		$sql="SELECT * FROM req WHERE id = '".$q."'";
    
    		$result = mysqli_query($con,$sql);
    
    		echo "<table border='1'>
    		<tr>
    		<th>Requirements</th>
    		<th>Description</th>
    		</tr>";
    
    		while($row = mysqli_fetch_array($result))
    		  {
    		  echo "<tr>";
    		  echo "<td>" . $row['Requirements'] . "</td>";
    		  echo "<td>" . $row['Description'] . "</td>";
    		  echo "</tr>";
    		  }
    		echo "</table>";
    
    		mysqli_close($con);
    	}
    	else
    	{
    ?>
    <html>
    	<head>
    		<script>
    		function showUser(str)
    		{
    			if (str=="")
    			{
    				document.getElementById("txtHint").innerHTML="";
    				return;
    			} 
    			if (window.XMLHttpRequest)
    			{
    				xmlhttp=new XMLHttpRequest();
    			}
    			else
    			{
    				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
    			}
    			xmlhttp.onreadystatechange=function()
    			{
    				if (xmlhttp.readyState==4 && xmlhttp.status==200)
    				{
    					document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    				}
    			}
    			xmlhttp.open("GET", "getuser.php?q="+str, true);
    			xmlhttp.send();
    		}
    		</script>
    	</head>
    	<body>
    
    		<form>
    			<select name="users" onchange="showUser(this.value)">
    				<option value="">Select the Categories:</option>
    				<option value="1">Order</option>
    				<option value="2">Management</option>
    			</select>
    		</form>
    		<br>
    		<div id="txtHint"><b>This info will be listed here.</b></div>
    
    	</body>
    </html>
    <? } ?>
    
    


    Now, if the code is actually in two separate files, I'm not sure as that should work.

My Information

Member Title:
D.I.C Head
Age:
19 years old
Birthday:
January 25, 1995
Gender:
Location:
Australia
Interests:
Programming, Mostly
Years Programming:
6
Programming Languages:
PHP, C#, Java, Lua, C++, HTML, CSS, JS

Contact Information

E-mail:
Private
Website URL:
Website URL  http://www.cokacola.us.to/
Twitter:
BizzyCola

Friends

cokacola hasn't added any friends yet.

Comments

cokacola has no profile comments yet. Why not say hello?