-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Is an HTTPS a must when using websockets for a chat function?
requinix replied to moose-en-a-gant's topic in Javascript Help
Yes, plain HTTP is fine. -
I'm struggling to get cURL into a stored function.
requinix replied to t_v's topic in PHP Coding Help
Your code is inconsistent: are you trying to foreach on $result (which is a string) or $test (which is a SimpleXMLElement). Assuming the latter, have you verified that $result is the XML string you expect it to be? And that it looks something like <foo> <things> <bar> <cool_thing>A cool thing</cool_thing> <cooler_thing>A cooler thing</cooler_thing> </bar> <bar> <cool_thing>A cool thing</cool_thing> <cooler_thing>A cooler thing</cooler_thing> </bar> <bar> <cool_thing>A cool thing</cool_thing> <cooler_thing>A cooler thing</cooler_thing> </bar> </things> </foo> -
Is an HTTPS a must when using websockets for a chat function?
requinix replied to moose-en-a-gant's topic in Javascript Help
It's the same deal with other things: - Don't use http from an https page - Use https if you need to keep the traffic secure -
Hitting Enter is equivalent to clicking the form's default submit button (which subjects it to disabled buttons, click events, etc). http://www.w3.org/TR/html5/forms.html#implicit-submission
-
Edit a line in a txt file containing a certain word/ id
requinix replied to mauricederegt's topic in Regex Help
Store the information in a database instead of generating HTML in a file. Otherwise you'll have to read in the entire file, locate the Jake line, replace the new entry with the old one, and write the contents back out. That sucks. With a database you store all the information in there that you want, update however you want and whenever you want, then when you need that HTML you run a query to get the data back out and format however you want. -
Not too sure I understand what you're seeing... It looks like there's two (or more) virtualhosts: one for 192.168.1.200 and one for test.sites.example.com. The IDE (presumably?) is making a request to the former for some reason - maybe there's an old configuration pointing to the IP address instead of the hostname? It does seem like a ping of sorts because it doesn't have any of the normal HTTP headers in the request.
-
One thread at a time, please. Are you sure you installed PHP properly? In the address bar of your browser, does the URL start with "http://" and not "file://"?
-
To be clear, SHA256 is not encryption. Encryption is reversible. SHA256 is a hashing algorithm. Hashes are not reversible. Yes, for version 0 it is hashing the string + a salt. The output is the hash and only the hash - not hash+salt (or the more common salt+hash which may be what you meant). For version 1 it returns the version + pepper + the hash of the string+salt+pepper, with some $s mixed in. It emulates crypt output without the benefit of how crypt() works. Which supports SHA256 itself, by the way. $this->salt means the "salt" property on the current object. It's part of object-oriented programming in PHP. The salt was set somewhere else.
-
A rundown on sockets, c right?
requinix replied to moose-en-a-gant's topic in Other Programming Languages
Think maybe you're looking at stuff more complicated than what you need... Web, right? Look into WebSockets. They are sockets but with a lot of the work abstracted out for you. -
How about producing some sample images? And being more precise than "anything but 1": 0.99999 is "anything but 1" but you'll get just about the same result, so clearly there's more to it than "anything but 1".
-
Currently there is no scale, which means you have to add it first. There's two places with $y2 that you can scale it: $y2 = $yscale1 * ($y_max - $yscale2 * $nt["dht22temp"]);Notice the quotes with the array key. dht22temp is a string and strings need quotes. Do the same for event. You might want both $yscale1 and $yscale2, or maybe just one of them. Start with 1 and adjust in small increments until you're satisfied. [edit] You also need to make sure you account for the possible values of dht22temp: one image now may look good but another image with different values (if that's possible) may be different.
-
Attachments are annoying. <?php $page_title = 'INS Arduino Temperature Sensor Graph'; include "./includes/dbconnect.php"; $qt=mysql_query("SELECT event, dht22temp FROM sensordata ORDER BY id DESC LIMIT 12"); header ("Content-type: image/png"); $x_gap=40; // The gap between each point in y axis $x_max=$x_gap*13; // Maximum width of the graph or horizontal axis $y_max=250; // Maximum hight of the graph or vertical axis // Above two variables will be used to create a canvas of the image// $im = @ImageCreate ($x_max, $y_max) or die ("Cannot Initialize new GD image stream"); $background_color = ImageColorAllocate ($im, 234, 234, 234); $text_color = ImageColorAllocate ($im, 233, 14, 91); $graph_color = ImageColorAllocate ($im,25,25,25); $x1=0; $y1=0; $first_one="yes"; while($nt=mysql_fetch_array($qt)){ echo "$nt[event], $nt[dht22temp] "; $x2=$x1+$x_gap; // Shifting in X axis $y2=$y_max-$nt[dht22temp]; // Coordinate of Y axis ImageString($im,2,$x2,$y2,$nt[event],$graph_color); //Line above is to print month names on the graph if($first_one=="no"){ // this is to prevent from starting $x1= and $y1=0 imageline ($im,$x1, $y1,$x2,$y2,$text_color); // Drawing the line between two points } $x1=$x2; // Storing the value for next draw $y1=$y2; $first_one="no"; // Now flag is set to allow the drawing } ImageJPEG ($im); ?>
-
1. Stop echoing stuff. You're messing up the image. 2. You're outputting a JPEG so don't claim it's a image/png. Should be an image/jpeg. With those two changes you should get an actual image. Is the image correct? If not, post it and explain why it's wrong.
-
Look into PayPal's "billing agreements". You first send the user to PayPal to log in and all that, then agree to something where you can bill them for whatever amount at whatever time you want. In less scary terms. PayPal then gives you an identifier and you can use that to make a charge without requiring user action. The user can cancel the agreement whenever they want, though it does require jumping through a few hoops, so do you have to keep that in mind. In addition to the possibility of a charge being declined, of course. So that's why I get weird ads on my tablet: it's been browsing dating sites while I wasn't using it! Maybe I should get another tablet so it won't be lonely?
-
dynamic/ live text via php mysql and refresh without reload
requinix replied to silvercloud902's topic in PHP Coding Help
According to the tags on this thread, you already know about AJAX. Did you have any particular questions about it? Maybe you have some code you've tried and it's not working? Are you having difficulties with the Javascript side or the PHP side? -
Is it bad for a photos folder to be publicly accessible?
requinix replied to moose-en-a-gant's topic in Miscellaneous
The directory shouldn't be indexed (as in going to /uploads doesn't show a directory listing) but otherwise sure. But make sure you've validated uploads very, very well. A safer course would be to keep the directory private, such as by locating it outside the web root, and use a script to pass-through the information. The advantage there is that the web server plays no part in interpreting the file and your script would force everything to "be" an image - even if someone got past your validation and uploaded something different. -
With just that description I'd probably do a VARCHAR(1000). VARCHARs are stored inline in the table, like the other normal types like INT and CHAR, so they're pretty fast. You should be extra wary of SELECT *s as you could be pulling this text data and then not using it, which is wasted time and bandwidth. MySQL has size limits on rows, though. 8KB I think. If you needed anything close to that, or had more than one large VARCHAR column, then you may have to switch to TEXT. TEXT (and BLOB) are stored outside the table, which means they're a little slower but obviously you can store much more. VARCHARs may be stored outside too if you ask for a large enough size. Here's a question: is the 1000 arbitrary? Think you might expand it at some point? Does this field represent a free-form input from the user? Are you making sure to enforce a 1000 character limit? Depending on your answers, TEXT may be more appropriate in terms of data modelling, even if it means a bit (a bit) less performance.
-
List of safe things to do? If there was it would be way too long. Something automatic? Not that can't be fooled. Common pitfalls? Sure. But it'd help to know the nature of the code so we wouldn't have to rattle off everything we can think of. Sounds like you're talking about someone checking for bugs or security vulnerabilities, and while there's some amount of automation that can catch easy ones, the best method is to get trained eyes on it. But that generally means paying for it. However if there's not much code then you can post it somewhere, like here, and get a lot of people looking at it for free.
-
If that is your own URL for a page on your own site then use $_GET. Otherwise parse_url to get the entire query string and parse_str to parse the query string into an associative array.
-
Well, you could, you know, remove the </script> <script>Or am I missing something?
-
Have you considered finding out what the error is?
-
Sounds like it. If you're able to browse the repository locally and in BitBucket, and especially if you're able to clone it to another machine, then everything is working properly.
- 4 replies
-
- git
- sourcetree
-
(and 1 more)
Tagged with:
-
$xml->gms['g eid'];That says "give me the 'g eid' attribute of the gms element". What you want is "give me the 'eid' attribute of the g element of the gms element" (I think that's where it is).
-
Is your husnr column UNSIGNED?
-
If all you need is the timestamp then use the file modification time. file_exists() to check that it even exists in the first place, filemtime() to get the modification time, touch() to set it. Don't have to ever delete the file, just check that it's been less than two hours since it was "modified".