Jump to content

kicken

Gurus
  • Posts

    4,704
  • Joined

  • Last visited

  • Days Won

    179

Everything posted by kicken

  1. The actual data stored in the session is saved on the server, and the users cannot see or change it. The only thing they can access is the session ID value which is stored in a cookie on their end. They could modify this, but unless the know another valid ID changing it would most like just cause them to start a new blank session. You might want to read a little bit about Session Hijacking.
  2. You'll have to either compile it yourself or search the web and try to find a pre-built dll to download. A quick google search turned up http://downloads.php.net/pierre/ which has some vc9 5.3 builds. If those don't work for you then go back to google and try to find something else.
  3. If your slashes are getting stored in the value, then your doing something wrong which is causing the value to get escaped twice. Either your running mysql_real_escape_string on the value twice, or maybe using mysql_real_escape_string on the value then inserting it using a prepared statement and binding the value.
  4. http://www.wolframalpha.com/input/?i=y+%3D+x*%28x-1%29*5+solve+for+x Neat tool that wolfram alpha is. I should use that more.
  5. Unless there is more to that loop which you did not show, your never closing your <label> tag. You need to add a </label> somewhere in the loop.
  6. You may have an un-closed <label> tag, or one referencing the wrong element ID.
  7. This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=358560.0
  8. Find the part of the code from your registration script that does the hashing and copy it over to your change password script so that it will do the same thing.
  9. Since your counter.php file seems to output an image when you browse to it, you want to set it as the src to an image on your page, not include() it in the php file. <img src="/modules/counter/counter.php">
  10. Your first parameter, the hash value, has to be enclosed in quotes since it contains letters. javascript:updateCart("e22659b1a980aaca47048bebd5523817", 2) If your echoing it out with PHP you can use json_encode to get the proper formatting for strings (or other values). For example (use whatever the actual variable is): javascript:updateCart(<?php echo json_encode($row_hash); ?>, 2)
  11. Separate your table into sections, wrap the header row in a <thead> tag set and the body rows in a <tbody> tag set. Then apply the overflow:auto and a set width/height to the tbody tag. That will keep the header fixed and scroll the body portion. You will want to test this in your target browsers though as some do not handle such a setup well (if at all). For browsers that do not handle it properly, you could add a bit of JS to re-write the HTML into a format that is more compatible. You can usually get decent results by putting the header and body into separate tables and wrapping the body table in a div with overflow:auto. You just need to make sure you apply a width to each column so they are rendered the same and look-like one table to the user.
  12. Yes, you need to store the salt somewhere that way you can use it to generate the hash again when the user logs in. The point of the salt is to make it so that the hacker cannot use a rainbow table to determine what the password might be. By including a salt when you hash the password, you ensure it is unique and won't appear on any such tables. This forces the hacker to re-build any such table using the salt, which is an extremely time consuming and memory hogging process (see this thread for some details). It's a bit needlessly complex for salt generation. You could just throw together a few random bytes or even just something like the username+time(). Salt's do not need to be complex, just unique. You do combine the salt and the password, prior to hashing it. Something like: $pass = $_POST['password']; $salt = generateSalt(); $hash = sha1($salt.$pass); Then in your database you store the salt and the hash values. Whenever someone tries to login, you take their username, lookup the salt and hash values, hash their inputted password using the retrieved salt, and see if the hash matches. Something like: $sql = "SELECT salt, hash FROM users WHERE username=$user"; $res = mysql_query($sql); $row = mysql_fetch_array($res); $enteredHash = sha1($row['salt'].$_POST['password']); if ($enteredHash == $row['hash']){ //login valid } else { //login error }
  13. You'll have to get them to give you more details, such as the error message. There's nothing inherently wrong with what you posted, but that doesn't mean there isn't maybe something wrong with the page as a whole, perhaps only in specific situations. Maybe some .js file you included is failing to load. Maybe they don't have Javascript enabled. Maybe some Antivirus/Antimalware/Popup software is re-writing the page so it has an error on their end. I've seen all the above and more actually happen and be the cause of an error that a client had which I couldn't replicate. If the client can't figure out how to get the error message to forward it to you, or any other information you need ask them if they are willing to let you remote into their computer using an app like TeamViewer so you can better guide them and/or do it for them.
  14. All sockets and file descriptors have their own blocking/nonblocking status. You can change it however you wish. Aside from the fact that the "child" socket was created by an accept call from the "parent" the two do not relate in any way, there is no actual child/parent relationship there.
  15. I have a hard time understanding what it is your trying to do. It doesn't make sense to me that you'd be querying this data and trying to group it if there is no relation between the data at all. Near as I can tell though you're basically executing a bunch of queries, and each query has at least a month, year, and source field plus a bunch of other fields that depend on the source. Is that about right? Then you want to create an array structure that will group everything by source, year and month? You could do this with a class and have a class-level array to store the data, or you can use your functions and just have a pass-by-reference array that collects the data into keys. Something like: // Main //Collects all the information in a multi-level structure. // - First level being source // - Second level being Year // - Third level being month // - Fourth level being all the data $finalData = array(); // Algorithm determines dates to grab query($day, $1, $vars, $finalData); // ... query($day, $31, $vars, $finalData); foreach($finalData as $source){ foreach ($source as $year){ foreach ($year as $month){ foreach ($month as $dataRow){ foreach ($dataRow as $fieldName=>$fieldValue){ } } } } } function query ($vars, $being, $passed, &$dataArray){ // Pretend there's a bunch of stuff determining properties and data to query that would be here but isn't because it's unrelated to the question $data = mysql_query($statementA); if ($data){ while ($row=mysql_fetch_assoc($data)){ $src = $row['source']; $year = $row['year']; $month = $row['month']; if (!isset($dataArray[$src][$year][$month])){ $dataArray[$src][$year][$month] = array(); } $dataArray[$src][$year][$month][] = $row; } } //Your other queries. } After all your functions run then your $finalData array should contain a nicely group set of your data, do with it what you will. You could alter the structure if some other grouping would be easier to use or make more sense.
  16. Did you create the database and table being used in the query? I'd guess your query is failing and ->query is returning FALSE rather than the statement object.
  17. If you want it to be non-blocking, then set it to non-blocking mode. It doesn't really matter how it is setup from the accept call. From what you describe, it sounds like it probably defaults to blocking mode rather than taking on the same as the server socket. There's no harm in calling socket_set_nonblock on a socket that's already in non blocking mode, so just do it and be sure.
  18. You can't bind a column name, only values. What your running is a statement more like: SELECT en FROM word WHERE MATCH ('sp') AGAINST ('honey' IN BOOLEAN MODE ) Your matching the literal string value 'sp' against the word honey. Just put your column name in directly rather than bindValue a placeholder. $sql='SELECT en FROM word WHERE MATCH (sp) AGAINST (:word IN BOOLEAN MODE ) '; $st = $con->prepare($sql); $st->bindValue(":word",$word,PDO::PARAM_STR); $st->execute();
  19. $parola .= $my_array[$random]; That line is the same as $parola = $parola . $my_array[$random]; which means it is trying to first read the existing value of $parola before setting it to the new value. On your very first iteration of the loop, $parola does not exist because you've never defined it anywhere. Because it does not exist when php tries to read it you receive that notice. Add $parola = ''; before your loop to define the variable first.
  20. There's not really a good way to do it. You'd have to setup a chroot'ed sandbox environment and run the samples through there. That environment could have it's own php.ini that disables specific functions if you wanted.
  21. You could just do: $a = 1-($pixel/127); And not have to bother with abs(). Not that it really matters too much.
  22. Your query is likely failing because CHARACTER is a reserved word in mysql. You can quote it using backticks (`) to use it. You should get in the habit of including some kind of error reporting in your scripts, especially for queries. Use mysql_error() to see the error message that occurred.
  23. There's also things like McDonald where you'd just have to check for specific prefixes. Ideally you should just give the user the ability to enter their name as they want it displayed rather than try and format it yourself.
  24. Why are you trying to mess around with document.write? Just echo your tags as HTML. echo "<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'></script>" ."<link rel='stylesheet' href='http://domain.com/css/style.css' type='text/css' media='screen'/>"; $list = "<p id='last'></p><div id='slidebox'>" ."<a class='close'></a>" ."<p>TITLE</p>" ."<h2>DESC</h2>" ."</div>" ."<script type='text/javascript'>" ."$(function() {" ."$(window).scroll(function(){" ."var distanceTop = $('#last').offset().top - $(window).height();" ."if ($(window).scrollTop() > distanceTop)" ."$('#slidebox').animate({'right':'0px'},300);" ."else " ."$('#slidebox').stop(true).animate({'right':'-430px'},100); " ."});" ."$('#slidebox .close').bind('click',function(){" ."$(this).parent().remove();" ."});" ."});</script>"; echo $list; There is no need to do anything regarding waiting for the file to load. The browser will automatically delay the execution of the second script block until the script is loaded.
×
×
  • 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.