Jump to content

ChemicalBliss

Members
  • Posts

    719
  • Joined

  • Last visited

    Never

Everything posted by ChemicalBliss

  1. What is the error? <?php $ip = "66.79.190.40"; $port = "27960"; if (! $sock = @fsockopen($ip, $port, $num, $error, 5)) echo '<B><FONT COLOR=red>Offline</b></FONT>'; echo '<br />'.$num.'<br />'.$error; else{ echo '<B><FONT COLOR=lime>Online</b></FONT>'; fclose($sock); } ?> -cb-
  2. No i'm sorry but whoever told you not to encrypt passwords should rethink their position as a web designer. Passwords are not just encrypted so that "Intruders"£ cannot see them, it is so YOU cannot see them also, it is giving a peace of mind to your customers/clients. I would NEVER sign up to a website if i had a hint they were going to keep my password in plain text on file. What if someone got your password, hacked your FTP, Tricked you into letting them put a file on your website, using PHP injection to execute code.?? A lot of people on the internet use one or two passwords for anything they sign up to. i guess you have their email address, they could get their email address, and then technically they could get every account that person has opened under the sun, any website that has told them thank you for signing up etc in their email! Encrypt passwords with HASHES and SEEDS (A seed is a unique number that goes with the the password in an MD5 or SHA256 Hash). If they forget their password then they get a new one that your script will generate. If they cant remember one they put before then they shouldn't mind having a new random string password. If you want to go a step further then you can let them change their password, but only if it is secure enough (capital letter/8 chars long+/a number or more). -cb- PS: Security is one thing in your project you CANNOT get lazy about.
  3. I'm not sure of the specific problem because my time is limited but best practices use methods to set properties. Properties should be specific to that object, they should be the variables of the object itself, What you should do is use getter and setter methods that would interact with these properties in a standard way, otherwise you could have code that could quickly get out of hand. -cb- Note: $this->partnerID = $ids->id[$b] and $this->partners->set_partner_id($this->partnerID); Are contradictory, the second one is what im talking about. This way you can check the property exists, make sure its validated properly etc all in one place.
  4. http://www.phpclasses.org/package/2221-PHP-Server-files-for-downloading-with-resume-support.html You'll want to download both the class file and the test file. The test file shows how to use the class: include_once "class.httpdownload.php"; $object->set_byfile($FILENAME); // Tell the Object where the file is. $object->use_resume = true; // Resume Ability $object->speed = 100; // KB/s $object->download(); // Start the download This class works perfectly. (You may need to change the PHP opening tags from <? to <?php) You can also use an authentication system, but to test or use it you will need to edit line 313 to: return $this->handler['auth']($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); For some reason the author used an incorrect number of parameters with his function he used in test.php, the first argument isn't needed since we know it's an auth. -cb-
  5. I'm sure you mean your getting attending once, and not attending twice. If you are getting attending 3 times then there is 3 rows with the same id? anyway i think what you want is to put an "if" statement inside the "foreach" loop. If the "$user['id']" is equal to the selected "id" then echo the result (Attending or not attending). -cb-
  6. Found a shortlist on useful headers: http://www.jonasjohn.de/snippets/php/headers.htm Notice the quotations around the filename in the header. Also, check this out for an example of what you want: http://www.awesomephp.com/?Tutorials*16/Download-file-with-resume,-stream-and-speed-options.html Take note of this part: if(isset($_SERVER['HTTP_RANGE'])) { list($a, $range)=explode("=",$_SERVER['HTTP_RANGE']); str_replace($range, "-", $range); $size2=$size-1; $new_length=$size-$range; header("HTTP/1.1 206 Partial Content"); header("Content-Length: $new_length"); header("Content-Range: bytes $range$size2/$size"); } else { $size2=$size-1; header("Content-Range: bytes 0-$size2/$size"); header("Content-Length: ".$size); } Google is handy -cb-
  7. what is it for? the current user or all users? Use a loop: all: foreach($movies['data'] as $user){ echo($user['name']." is ".($user['rsvp_status'] == "attending")? "Attending" : "Not Attending"); } -cb-
  8. Are you creating this array? I would personally use a multi-dimensional associative array such as; Array ( [0] => Array ( [link] => index.php [name] => Home ) [1] => Array ( [link] => page.php?id=23 [name] => Page ) ) Then use this to loop; <?php foreach($array As $item){ echo('<a href="'.$item['link'].'">'.$item['name'].'</a>'); } ?> ---- For your case you need to use a counter, and the modulus operator, such as; <?php $i=1; $last_item = null; foreach($array As $item){ if($i % 2 == 1){ echo('<a href="'.$last_item.'">'.$item.'</a>'); } $last_item = $item; $i++; } ?> -cb-
  9. There is nothing in that script that would cause that output. Try different variations of the script with different text and output. -cb-
  10. is that the source code or what appears on screen? Is it the Constant itself? ie, <?PHP define( "MESSAGE", "Testing Testing 123" ); if(isset($_GET['message'])) { die("test message"); } ?> -cb-
  11. output started at /home/x/public_html/index.php:3 line 3 in index.php Then take a look at this link: http://www.phpfreaks.com/forums/index.php/topic,37442.0.html its the very first sticky in this forum. -cb-
  12. preg_match_all(); PCRE functions are invaluable. php.net/manual Head over to the REGEX sub-forum for more details on your question. -cb-
  13. $moveChoice is not defined anywhere in your code. (I hope your not expecting to use GLOBALS ). other than that, remove parts of the code until it works, narrow down the culprit. -cb-
  14. If you coded your php file in Windows, there can be end-line consistency errors which can cause the Parser to report a syntax error. I had this problem when i moved a small php cms i made to another online host provider. Firstly i would suggest getting Notepad++ (if you havn't already), there are some very neat, quick-access features that can make your life a lot easier. Once you get notepad++, in _every_ file you upload/make (you can even do it on your local server, windows doesn't seem to care) you: Go to the Top Menu "Format" (ALT+M), Then select "Convert to UNIX format". Voila. If that doesn't work then you do have some syntax error, somewhere. -cb-
  15. Firstly: This is a Javascript question. But here's how; One: Add a new variable in the AJAX code next to id that houses the pageid by using the "name" attribute. var id = $(this).attr("id"); var pageid = $(this).attr("name"); var string = 'id='+ id + '&pageid=' + pageid; Two: Modify your a link to include the name attribute that will house your pageid. <a href='#' class='deletecom' id='$id' name='$pageid'><img src='$domain/templates/$template/sources/images/bullet_delete.png ' />Remove Comment></a> -cb-
  16. To make sure there are characters; if(!preg_match("/[a-z]+/i",$input))){ exit("Error: Must contain some Text"); } Dirty way to make sure they don't use entity characters: if(html_entity_decode($input) != $input){ exit("Error: Cannot contain HTML Entity codes ( etc)"); } Another dirty way to check they don't use HTML tags: if(strip_tags($input) != $input){ exit("Error: Cannot contain HTML Tags (<b>, <i> etc)"); } -cb-
  17. What you see is what you get on this var. Every http server needs a request uri. Therefor it will be populated in every condition except one: When a PHP script is run from a command line or similar. Although I'm pretty sure this variable still populates even under those circumstances. -cb-
  18. Of course, read those articles i posted it will tell you everything you need to know. -cb-
  19. value=\"$dogid\" Since $dogid is not in your while loop, it will be the same value for every drop down item you create. I'd suggest setting the $dogid before trying to use it. -cb- PS: There is no reason to use two while loops, that first loop is not doing anything.
  20. Sessions have uniquely generated Keys, only this key is passed to the user via either the URL, or a COOKIE. These keys, depending on the amount of Users visiting your page is extremely difficult to guess. Some light reading: http://phpsec.org/projects/guide/4.html http://www.sitepoint.com/blogs/2004/03/03/notes-on-php-session-security/ The answers on this page can give some good information if your really interested: http://stackoverflow.com/questions/138670/how-unique-is-the-php-session-id -cb-
  21. Please use timestamps (PHP's time() or microtime() functions); Will keep consistency of time/dates between php applications, and also much easier to format/manage/manipulate and compare in PHP code. If your fields use Mysql' DATETIME field type you can use the SELECT UNIX_TIMESTAMP(`col`) function to get a tmiestamp from mysql for use in php. This will preserve the ability to use MySQL' Date functions when manipulating data. I personally use timestamps from PHP all the way, this way i know the time is going to be the same, i can predict the data easier through different database since it is an integer created by my script and not some server program (which could very well be in a different timezone). -cb-
  22. A quick look at that pastebin showed me that the code you used was originally intended as a user search of some kind. If you notice the "preg_match" function, it is checking the input from the form (via POST) that it contains only a-z and A-Z characters. You just need to add 0-9 also. -cb-
  23. Since PHP is limited to a single query per mysql_query() call (to generate a Resource ID for each query), you should look at why you need to pass that many updates at once. Looks to me like you could optimize the code that deals with morale and injurytime in the frontend. Why are you modifying those fields for multiple players? -cb-
  24. Hmm, i cannot reproduce this error without using a single = operator. So i cannot help you in that respect, maybe do a quick search on php bugs see if someone has posted already , if not then psot with as much info as possible so they can try to reproduce it. for now though, i would do this part like this: if(!is_numeric($cost)) { $cost = "0"; } -cb-
×
×
  • 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.