-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
heartbeat.png is a real PNG, however it's set up using a palette. So I need to clarify what I said earlier: a) Use a different file format - I suggest PNG, making sure you save in RGB or truecolor format (or whatever your image editor calls it) Attached is a PNG in RGB format. However you've moved away from GIF format, and that means you could improve the quality of the image. Do you still have the raw source available? You should recreate your base image using that as a source, rather than convert the inferior-quality GIF to a superior-quality PNG.
-
GIF images have a maximum of 256 colors available. Your heartbeat.gif is using all 256 already, so imagecolorallocate will fail and return false. However false == 0 so when you try to write the text on the image it will use the color at palette index #0, which is light red. Either a) Use a different file format - I suggest PNG b) Save the image using fewer than 256 colors
-
I must be misunderstanding something because it sounds like you're suggesting that search engine spiders are submitting data on your site and so you don't want them to index it at all.
-
Setting two arguements with single function?
requinix replied to NotionCommotion's topic in PHP Coding Help
Nothing that would be better. -
[edit] Evidently yes, someone did say that.
-
You can't get an arbitrary number of columns in MySQL, so you have to find a way to represent all that information in multiple rows instead. I'd just do that with two queries, one for the contents of each table. Fetch all that into your PHP and then process it from there. But I have a question: why does the second list not continue from Moore to de Mohrenschildt and Oswald like the first list did? Or does it and you just didn't show that much in your example? And another question: what happens if you have a circular association, like Philips > Barnes > Moore > Philips? And one more: should the relationships be bidirectional? Philips knows Barnes, but doesn't that also mean Barnes knows Philips?
- 11 replies
-
- tables
- relational database
-
(and 1 more)
Tagged with:
-
automatically populating $HTTP_RAW_POST_DATA
requinix replied to NotionCommotion's topic in PHP Coding Help
Ah. 1. You need to set the Content-Type in the request if you are passing any kind of data. If you don't then it seems PHP assumes application/x-www-form-urlencoded, which is why $_REQUEST gets that odd-looking value. If you set a Content-Type that PHP is not familiar with (basically neither that one or multipart/form-data) then PHP will take a different path of interpreting the body and not really do anything. However that path triggers code which deals with the $HTTP_RAW_POST_DATA stuff - not necessarily the variable itself but logic related to it. 2. $_REQUEST only works for application/x-www-form-urlencoded and multipart/form-data. Because those are key/value pairs that fit well into the $_REQUEST array. When you specify application/json content then $_REQUEST will not be filled and you need to use php://input to get the raw JSON. Your code should be like if ($_SERVER["REQUEST_METHOD"] == "POST") { if (stricmp($_SERVER["CONTENT_TYPE"], "application/json") == 0) { $json = @json_decode(file_get_contents("php://input")); } else { // maybe accept other formats } } else { // ? } -
automatically populating $HTTP_RAW_POST_DATA
requinix replied to NotionCommotion's topic in PHP Coding Help
At the very least errors attributed to Unknown:0 are often bugs in and of themselves for not giving accurate or usable information. Taking that mentality, the first step is reproducing the bug with a minimal test case. Is that possible? What kind of application are you using? Can you debug through it to at least find out when the error messages are being outputted? -
I split the quote thing into its own thread.
-
Bug: Empty lines when [quote]ing
requinix replied to requinix's topic in PHPFreaks.com Website Feedback
I think the empty tag is being added by CKEditor. I can't find any settings for it in IPB, and I can't simply remove a because that's used for blank lines. So fixing that will probably require spelunking into CKEditor. IPB gives me a way to log in as people. As you, if I go into Coding Help, pick a thread, and go to the full editor, I see the options to attach files. I don't see it when trying to post to this thread. So are you not able to attach files in specific forums? Or at all? Do you see the attachment form? -
Bug: Empty lines when [quote]ing
requinix replied to requinix's topic in PHPFreaks.com Website Feedback
How are you using it? When I use that button the editor puts the cursor on a new line inside the quote, but if I click away then the empty line disappears. -
You say 10 articles but your query says 6... There's a general approach to take with this sort of problem. 1. Calculate a number that increases by 1 for every unit of time you care about. That's a month. Yes, you said you want every six months, but the unit you're using is a month. Include the year so that January 2017 = December 2016 + 1. year * 12 + month 2016 * 12 + 9 = 24201 2016 * 12 + 10 = 24202 2016 * 12 + 11 = 24203 2016 * 12 + 12 = 24204 2017 * 12 + 1 = 242052. Scale that number down according to how many intervals of that unit you want. Here is where the six months matters. floor((year * 12 + month) / 6) floor((2016 * 12 + 9 ) / 6) = 4033 floor((2016 * 12 + 10) / 6) = 4033 floor((2016 * 12 + 11) / 6) = 4033 floor((2016 * 12 + 12) / 6) = 4034 floor((2017 * 12 + 1 ) / 6) = 4034Note that it changes in December, and will again in June. If you want Jan-Jun and Jul-Dec then alter the formula from step 1 to offset by however much you need (ie, -1). 3. Use modulus to reduce that number to choose which group of articles you want. If you have 30 articles and want 10 at a time then that's 3 groups. floor((year * 12 + month - 1) / 6) % 3 floor((2016 * 12 + 9 - 1) / 6) % 3 = 1 floor((2016 * 12 + 10 - 1) / 6) % 3 = 1 floor((2016 * 12 + 11 - 1) / 6) % 3 = 1 floor((2016 * 12 + 12 - 1) / 6) % 3 = 1 floor((2017 * 12 + 1 - 1) / 6) % 3 = 24. For your query, you need to determine a starting offset given a group number. Since the first group will be 0 (0-2 not 1-3), the offset is just group * 10. use your imaginationSo you're left with $offset = (floor((date("Y") * 12 + date("m") - 1) / 6) % 3) * 10; $str = "SELECT * FROM tc_articals LIMIT {$offset}, 6";By the way, your idea won't work unless you have an exact multiple of 10 articles. Are you sure you will always have that?
-
automatically populating $HTTP_RAW_POST_DATA
requinix replied to NotionCommotion's topic in PHP Coding Help
Set the value to -1 (as you did) and use file_get_contents("php://input") instead of $HTTP_RAW_POST_DATA. -
The best source of helpful information is Google. Seriously. I'm not sure what you're trying to find but what you actually need will be somewhere within the first couple pages of search results. Though I will say that if you're looking for a purely Javascript-based solution then you're not going to find one: there must be a server-side component for the whole idea to work.
-
extensions located in ext not loading
requinix replied to RonaldOa's topic in PHP Installation and Configuration
Don't hijack threads. Have you read the note on the installation page? -
Bug: Empty lines when [quote]ing
requinix replied to requinix's topic in PHPFreaks.com Website Feedback
Found and patched. Please let me know if you notice something broken. @benanamen: Your example really is a blank line in the post. That's not fixed. -
Bug: Empty lines when [quote]ing
requinix replied to requinix's topic in PHPFreaks.com Website Feedback
So it looks like it's a rendering problem instead. <blockquote class="ipsBlockquote" data-author="benanamen" data-cid="1537698" data-time="1474511715"><br /> <div><br /> <p>Personally, I don't know why the site was "Upgraded". I never had any problems. Only issue I had was the annoying double space when you did a quote.</p> </div> </blockquote> <p> </p> <p>I personally liked many of the design changes. And was happy to see the [code][/code] tag bug go away, as well as the double space issue. Of course, there were many things I would have needed to adjust to and some that I'm still trying to repress. <img src='https://forums.phpfreaks.com/public/style_emoticons/default/happy-04.gif' class='bbc_emoticon' alt=':happy-04:' /></p>Don't know where the s are coming from. Well, it's probably converting them from newlines, but the places I've seen that can do it don't appear to be responsible. The raw post is using only \n and not \r\n so it isn't that. <blockquote class="ipsBlockquote"> <p> </p> <p>At the least, clicking the quote icon in the standard editor</p> </blockquote>That looks like there's actually a blank line in there when you were writing the post. -
Bug: Empty lines when [quote]ing
requinix replied to requinix's topic in PHPFreaks.com Website Feedback
So cyberRobot's post is stored as <blockquote class="ipsBlockquote" data-author="benanamen" data-cid="1537698" data-time="1474511715"> <div> <p>Personally, I don't know why the site was "Upgraded". I never had any problems. Only issue I had was the annoying double space when you did a quote.</p> </div> </blockquote> <p> </p> <p>I personally liked many of the design changes. And was happy to see the [nobbc][code][/code][/nobbc] tag bug go away, as well as the double space issue. Of course, there were many things I would have needed to adjust to and some that I'm still trying to repress. </p>The problem is the extra div/p in the quote. But I don't know how it got into that state. How are you quoting people? Are you using quick reply or the full editor or what? Are you using the editor in text or WYSIWYG mode? -
Is this double-space issue I keep hearing about? This last week is the first time I've heard about it, and I don't remember seeing this happen until now (not to say it didn't, I just don't remember).
-
Can you unfiddle with the directory? What did you do?
-
Use -> for nodes and [] for attributes (or indexes). So like the ISP value, and both use the arrow. $geoLocXML = $getGeoLocXML->result[0]; echo($geoLocXML . '<br>'); echo($geoLocXML->isp . '<br>'); echo($geoLocXML->city . '<br>'); echo($geoLocXML->countryname . '<br>');
-
Use your web server's built in logging mechanisms instead. Don't even need PHP.
-
IPB 3 is old and unsupported. No updates, no improvements, no fixes. We need to move to something that's still actively maintained. IPB 4 is the best candidate but apparently there are some issues we need to work out with it first.
-
Sorry about the few days of lost content but IP.Board 4 was clearly not up to the job. Two points specifically: 1. Due to their implementation of search, search engine spiders were killing site performance. This was the main problem. 2. They dropped features we need and use, namely BBCode (very handy for a programming community) and Mark Solved (their Discussion forum style is not a replacement). To the handful of members who signed up in the last few days, sorry but you will need to sign up again. I promise your experience on this site will be better than it was before.