-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Checking referrer when downloading from remote source
requinix replied to dannyb785's topic in PHP Coding Help
The referrer is insecure. Don't rely on it. Do you mind having the file go through your server first? Means double the bandwidth (both site1 and site2 are sending the whole file) but it's the easiest answer. -
Start with any number of non-space characters, then repeat a set of one space followed by more non-spaces. Problem is that it's harder to do the 2-12 requirement. /^[a-z0-9]+( [a-z0-9]+)*$/i For the length just do x.length>=2 and x.length
-
Stop creating thread after thread after thread for the exact same problem! It's annoying!
-
If it's a client-side thing then this could be done in JavaScript...
-
Right, multidimensional. You were actually already doing that but I guess you didn't quite realize it. Anyway, use to get the syntax highlighting.
-
if the cookie is empty and hide is 1 or 2 { set the cookie to 1 } else if hide is 2 { set the cookie to 1,2 } else { anything that needs to happen here? }
-
By putting in logic that does one thing if it's 1 and another thing if it's 2?
-
Regex - combine to one statement - I just couldn't get it to work..
requinix replied to shb_php's topic in Regex Help
The .+ will match everything after the ".Sent Items." (the subfolders). Parentheses make it a capturing group so that the substitution text can use $1 (1=first group counting left-to-right) to insert it back in. -
The message means that $firstfs (where strpos() is to begin looking for a period) is negative* or beyond the end of the string**. We need to see more code. Especially the stuff that creates $firstfs and what's in between that code and the line you posted. My guess is that $block1 is has one period at the very end and that the $firstfs code looks like $firstfs = strpos($block1, ".") + 1; While we're at it, how about some context? What does the code do? What is $block1? * Maybe. Might have different message for that case. ** Technically, greater than or equal to.
-
Not without knowing what the problem is. Can you at least describe it?
-
Regex - combine to one statement - I just couldn't get it to work..
requinix replied to shb_php's topic in Regex Help
At this point I'm not going to flat-out give you the answer. I've been trying to get you to keep working on it, and unless somebody else comes in here and posts the right expression you'll have to try to follow along with what's happening. If you know a bit of regex then you know what [abc] means, right? If I gave you a string cat and told you to replace [abc] with 5, you'd end up with 55t. The t didn't change because it wasn't part of the expression. Now, you want to change INBOX\.Sent Items to INBOX\.Sent, right? Still the same subfolder structure, right? So for the substituting you don't have to care what comes after that one part - if it's not in the expression then it will remain unchanged. -
That MIME type is for DOCX files. Find a different one.
-
Regex - combine to one statement - I just couldn't get it to work..
requinix replied to shb_php's topic in Regex Help
Keep the first one but with a change. Speaking of, the $ means end-of-string so do you really want it? -
Regex - combine to one statement - I just couldn't get it to work..
requinix replied to shb_php's topic in Regex Help
Oh, it's Perl-style. I didn't realize (though the s/ really should have tipped me off). Anyway the /i goes at the end. As in s/.../.../i. -
Clues on reading this xml document using simplexml
requinix replied to xmlrod's topic in PHP Coding Help
It's not using namespaces so there isn't that to worry about... You'd read it like you'd read any other XML file. Like, the first message's body is $xml->sms[0]["body"] -
Regex - combine to one statement - I just couldn't get it to work..
requinix replied to shb_php's topic in Regex Help
To save me from looking it up myself, how does imapsync use this regex to remap the folders? -
If they're just numbers a simple implode() would work (and be better than serializing the array). What are you asking about?
-
If $compass == "north" then it !="east", right? And if it =="east" then it !="north"... You want &&, not ||.
-
The problem is with /uploads/test.pptx. Your server is sending the response as a application/zip, which is technically correct (because PPTX files are really just special ZIP files - try renaming one as .zip), but it should be sending the PPTX type. To change that, in a .htaccess somewhere (such as uploads/) add AddType application/whatever-its-supposed-to-be .pptx
-
Using the SQL LIKE method to find an exact string.
requinix replied to marcbraulio's topic in PHP Coding Help
Correct. -
Using the SQL LIKE method to find an exact string.
requinix replied to marcbraulio's topic in PHP Coding Help
Why is the state/country/zip stuff being associated with the person? It belongs with the city information. -
Using the SQL LIKE method to find an exact string.
requinix replied to marcbraulio's topic in PHP Coding Help
Yes: normalize your table. Create a second table dedicated to holding just a person and a city (specifically their IDs). person | city -------+----- A | 11 A | 22 A | 44 A | 34 B | 12 B | 56 B | 78 B | 98 Then you should find everything suddenly becomes a lot easier. -
Well that code isn't to blame for it. If you can share, what's the URL you're using for one of these "bad" PPT files? (An example file is fine too.)
-
Kinda. Mostly I'm saying to start using associative arrays. Your earlier version $universiteiten = array( $uniAmsterdamVan = array('uniNaam' =>'Universiteit van Amsterdam', 'uniID' => 'uva'), $uniAmsterdamVrij = array('uniNaam' =>'Vrije Universiteit Amsterdam', 'uniID' => 'vu'), is not (well, half not) associative. Those extra $uniX variables are just complicating things. You should be accessing everything like $universiteiten[name]["uniNaam" or "uniID" or "hURL"]
-
That header tells whatever is downloading the file what type of file it is (and thus what should be done with it). If you're going there with your browser and it doesn't know how to handle that content-type then it'll do its default action: download it. From the ten seconds of searching I just did, what you need is to embed the viewer in a page and point the viewer to wherever the pptx comes from. Google's thing then downloads the file and displays it.