-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
[WordPress] I'm completely New and having a tough time
.josh replied to mittymit6's topic in Applications
the file you posted only contains css, which has nothing to do with the error you are getting. -
if you are using cURL then you can use curl_setopt and set CURLOPT_USERAGENT if you are using something more generic like file_get_contents then you will have to set it in your php.ini file
-
Okay, then you can use the first pattern I showed: /SKU:\s(\S+)/ As I said, this will capture anything that is not a space. A more restrictive version based on your feedback could be: /SKU:\s([\w-]+)/ This will capture one or more "word" characters or hyphens But "word" characters include underscore, so even more restrictive would be: /SKU:\s([a-z0-9-]+)/i This will explicitly only match letters, numbers and hyphens. Notice I added the "i" on the end of there, after the closing delimiter. This is to make the match case-insensitive
-
\w is shorthand for a "word" character class, and is the equivalent of [a-z0-9_] which matches letters, numbers or underscore. It stops at "DD" because a hyphen isn't a "word" character. A liberal approach would be to do this: /SKU:\s(\S+)/ This will capture anything that is not a space. A more restrictive approach could be this: /SKU:\s(\w+-\w+)/ This will match one or more "word" characters followed by a hyphen followed by one or more "word" characters. An even more restrictive approach could be this: /SKU:\s(\w+-\d+)/ This will match one or more "word" characters followed by a hyphen followed by one or more numbers. An even more restrictive approach could be this: /SKU:\s([A-Z]{2}-\d{6})/ This matches for 2 uppercase letters followed by a hyphen followed by 6 numbers
-
okay but you also mentioned html, css, etc.. so is it also supposed to show line by line those things too? Also, I asked that you show me exactly what you want to see. The point of this exercise is that you aren't being very clear, and it's not just the language barrier that's making you unclear. Pretend you have already made the script that does what you want. Take the code I have given and generate the log file and output. You will have to do this manually or by hand of course, since you don't actually have the script yet. Then post it, so that we have a very clear "before" and "after" picture.
-
Okay so how exact do you want this? Let's say you have the following: <html> <head> <script type='text/javascript' src='someScript.js' /></script> </head> <body> <?php include('db/connect.php'); $query = 'select param, value from table'; $result = $mysqli->query($query); ?> <script type='text/javascript'> var config = {}; <?php if ($result) { while ($row = $result->fetch_row()) { echo "config.{$row[0]} = '{$row[1]}';"; } } ?> runScript(config); </script> </body> </html> Show me exactly what you expect to see in the log file from this.
-
Yep, there will be no perfect solution with regex alone. Even if the grammar and punctuation are done perfectly, there are too many alternates and exceptions that involve punctuation, nested stuff, etc. And that's if the grammar and punctuation are perfect - very few people out there are 100% accurate about that stuff, or even 75%. Even if you were to attempt to make a parser that uses more than just regex, it's just not possible to perfectly parse all the exceptions and overcome the fuckups. The human brain is considered an amazing thing for a reason: because it can manage to parse it.
-
Right, but in this condition block: if(!$file) { //file doesn't exist RefreshStatus(); $fgame = $data[1]; $flogin = $data[2]; }else Yes, you create the file, but this code block doesn't assign anything to $data so you're trying to reference $data[1] and $data[2] when they don't exist.
-
you aren't assigning a value to $data unless the file already exists. IOW $data doesn't exist unless the file exists, but you try to reference it when the file doesn't exist.
-
so where is this "session c=#" normally found when you go to it in your browser? Is it in the response url? on the page somewhere in a div tag or something?
-
<? ?> isn't short tag. <?= ?> is short tag. But if you changed them to <?php ?> and you still get that error, check for missing closing bracket in this file: require_once("include/forum_id.php");
-
Timed events -- Not sure best way to approach this
.josh replied to RyanWalsh3387's topic in PHP Coding Help
but to answer your question, you'd use a cronjob to run a script every minute or hour or whatever and check the current timestamp(s) in the database vs. current time. -
Timed events -- Not sure best way to approach this
.josh replied to RyanWalsh3387's topic in PHP Coding Help
what kind of system is this for? I can't imagine a whole lot of scenarios where time-based assertions are feasible from a "business" PoV.. -
considering there's login involved, you probably need to handle cookies. Look at the various cookie settings in curl_setopt
-
sounds more like a memory problem, not an ftp program problem. By "map" I assume you mean folder or directory, right? you may need to ftp from command line or write your own script that ftps to it..IOW a method that doesn't involve trying to grab and display a list of the working directory/folder. And then NOT do things like list or display dir content.
-
Except that lying to get free shit (which is the same as stealing) is wrong. Even moreso since you can afford it.
-
Hello All, We have a http://forums.phpfreaks.com/topic/273124-readme-everything-youd-want-to-know-about-php-freaks/#entry1405504'>sticky that explains what the badges under members' names are, but a Guru in particular is basically anybody who has demonstrated that they are actively trying to be a part of the phpfreaks community and in general know wtf they are talking about. You don't have to be some super ninja expert at everything, nor do you have to be posting 100 posts a day to achieve this rank. Traditionally the process for "gaining rank" around here involves you joining our community and making an effort to help others out with their questions. And after a while of this, one or more members of the staff (guru, mod or admin) may take notice of your efforts and then nominate you to join the ranks (this happens internally). In addition, we try to look at things like rep and posts marked solved to find you. But maybe you feel like you've been making an effort for naught. Most of us don't regular all the forums; we just hang around the ones we are the strongest at or most interested in. So maybe the one thing you're really good at is the one forum nobody else really hangs out in. Or maybe the stars just don't seem to align right or something. So, in order to ensure that nobody feels like they are going unnoticed, I want to extend the nomination process to the entire community. If you feel like you've been hanging around and helping out for a while and have what it takes to wear a Guru badge, or if you know someone around here who does, please post your nominations here, as a way to ensure yourself or someone else is on our radar. .josh
-
Are you requesting an OOP Tutorial? We do have a multi-part "OO PHP" Tutorial, as well as a multi-part "Design Patterns" tutorial. If you have read those and still don't understand OOP, perhaps you can be more specific about what you don't understand? Feel free to post asking questions (but not in this forum; go to the Application Design forum)
-
No, the mbstring regex functions are not deprecated. Was that an oversight, or did they specifically decide to make an exception?
-
We get posts asking about this error on a fairly regular basis, so here's a sticky detailing the error and what to do to fix it. PHP has a number of POSIX regex functions for performing regex matching/replacing/splitting. All of these functions are deprecated, which means they are currently still available in php, but are going to eventually be removed from a future version of PHP. This is an "annoyance" to you now, because it causes an error, which may or may not show up, depending on what your error reporting settings are. This is bad news for you in the future, because your code will break when you upgrade to a future version of PHP that no longer supports these functions. The solution is to convert the POSIX functions to one of the PCRE regex functions instead. Here is the manual entry summarizing the differences, as well as what the PCRE function replacements are. For most cases, you simply have to pick the PCRE equivalent and wrap a delimiter around your pattern. You may also need to use the i modifier if you are using a case-insensitive POSIX function (eg: eregi vs. ereg). Example: Check if a username is only numbers, letters (case-insensitive) and 6-12 chars long. POSIX regex if ( eregi("[a-z0-9]{6,12}",$username) ) { // good username! } else { // bad username! } PCRE regex if ( preg_match("~[a-z0-9]{6,12}~i",$username) ) { // good username! } else { // bad username! } In the PCRE regex example, I use ~ as the delimiter and added the i modifier to make the regex case-insenstive. If doing this doesn't fix your problem, then more than likely your pattern itself has POSIX-specific stuff in it, and you will need to change that, in which case, feel free to post in this forum asking for help.
-
@kicken: lol I remember playing #2 w/ paper/pen when I was a kid, sittin' in church w/ my siblings
-
I'm a big fan of "generator" type scripts, especially ones that have to do with words. Example: IT Department [name] Generator from seventh sanctum
-
You can work yourself up to at least Guru membergroup status and be able to post tutorials yourself. Or you can submit to can submit the tutorial to us for review.
-
This thread is not meant to promote using frameworks instead of using core javascript for everything. That is just silly. Frameworks are not alternative languages, they are tools built on existing languages to make certain things easier. This thread is about using a framework for AJAX specifically.
-
What this board is for If you have some code you are wanting people to debug, or a website you are working on that you want people to 'beta test,' post the code/link here. The idea of this forum is that you have finished your code, and now you wish for people to test it for weak spots, logic problems, etc.. While you can of course expect feedback from your testers, if you need more help fixing your code, use the Help forums. This forum is for testing and testing feedback ONLY. This is NOT a "rate my script/site" forum. Please go to the critique forum for that. Try to give a good description of what your code is supposed to be doing. We can do little more than find syntax errors if we don't know what it's supposed to be doing. Your topic doesn't show? All new topics are moderated, meaning that they will not show up until a staff member approves it. Read the rules for posting in this forum and follow the directions. Some advice to be cautious Be very careful on what kind of info you post, especially when it comes to posting links to your site. Posts of this nature are often times aliases of "please try to hack my site and tell me if you do, and how, so I can fix it." We cannot and will not be held liable for any kind of damage or loss that results from you posting any of your stuff here (or anywhere else on the site, for that matter). Not everybody out there is honest. Someone out there may read your post, go to your script, find a security hole and exploit it without telling you, all the while giving you the thumbs up. Rules Regarding "Exploit Scanners" Use of exploit scanners can be an effective way to discover exploits on a website, so we have no intention of banning posting scanner results. But these scanners can also return bogus results. Secondly: Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. As of now, posting scanner results is only allowed under the following conditions: 1) You must share the name and how to get the scanner 2) You absolutely MUST explain every item in the result (why is this a risk, not just because the scanner says so) As with all forum rules, ignoring these could lead to moderation action. Ignorance of these rules is not a defense. Thank you for your cooperation.