-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
How to reload a page in php after form submit
.josh replied to Ravi_Ramsagar's topic in Javascript Help
without seeing your full code my guess is that your server-side script is dynamically populating the form fields, probably something along the lines of this in principle (in reality your php code would probably be using a condition to check if $_POST['cusname'] is set first): <input type="text" size="20" name ="cusname" value="<?php echo $_POST['cusname']; ?>" id="Customername" required/> so basically you will want to remove that server-side code. If I had to keep on guessing, I'd say your server-side code probably does that so that if form validation fails, the visitor doesn't have to re-fill out the entire form. And that "fill in the blanks" code probably isn't put inside that form validation. So ideally maybe you should look to move that code or else tie it to the form validation code so that you don't break that functionality. But this is all just guessing, since I don't know what your server-side code looks like.- 6 replies
-
- javascript
- php
-
(and 1 more)
Tagged with:
-
note that if the iframe content is hosted on a (sub) domain other than the parent page, you will not be able to use javascript to access or edit the iframed contents.
-
If you are only developing for one browser then you're doing it wrong. Your code should work in all browsers, or at least the ones that your target audience uses (which is where things like Google Analytics come into play).
-
your condition is outside of and comes after your foreach loop, so it's only testing against the last iteration of your foreach loop. It *seems* like what you want to do is move your condition to inside your foreach loop (and then also break from the loop when found if you want it to stop going through the list when found)
-
you made a post saying what you want... you didn't give any details about what you specifically need help with, what you've tried, code so far, etc.. how did you expect people to react?
-
Your code doesn't show that you're even checking for errors. In your other thread I gave you some tips for looking at errors and header info returned from the curl calls.. Have you tried that? What does it output?
-
$.get("TIMINGTOOL.pgm?task=second&choice="+$("#first-choice").val() , function(data) { console.log(data); $("#second-choice-code").html(data); }); does the js console show expected results?
-
yah that was my next guess... $row['picture'] (the file name) has spaces in it for some of them.
- 8 replies
-
- php5
- white space
-
(and 1 more)
Tagged with:
-
why are you even surrounding the src value with whitespace at all? Is your path/to/file really " path/to/file " vs. "path/to/file" ? Did you try just doing if (is_file(MM_UPLOADPATH . $row['picture']) . filesize(MM_UPLOADPATH . $row['picture']) > 0){echo'%20<a href="pictures.php">%20<img src="' . MM_UPLOADPATH . $row['picture'] . '" alt="sevenoaks latest pic" style="width:75px; maxheight:110px; margin:5px; padding:5px;"></a>';
- 8 replies
-
- php5
- white space
-
(and 1 more)
Tagged with:
-
Well it may not solve the problem but it takes the problem out of php's hands because it removes php from the equation. Even if you find that the problem is somewhere else (e.g. - maybe your server's apache timeout directive (or cgi timeout if iis) is too low), php is still acting as an unnecessary middleman. But if you wanna keep poking at php, for shits and grins I would set max_execution_time to 0 (make it unlimited) and see if they still have a problem.
-
why don't you just do like you said: http://oursite.com/dl?f=ZToxJnU6MjY= lookup the path/to/file based on the "f" param (I assume that's what you're doing).. but instead of trying to open and output the file with php, just redirect to the actual file.. example: <?php // grab the "f" param and lookup the path/to/filename, put it into $file // execute whatever code you want that tracks that the user downloaded it header("Location: $file"); exit(); ?>
-
Questions: 1. Does the function have any errors? yes 2. What is the purpose of the function? to be executed 3. What can be done to improve it? lots of stuff 4. Why is isset() used instead of a simple conditional used above it? demonstration of power to oppress 5. What assumptions can you make about the database structure? it has columns and stuff. Also it has those other things.
-
Okay so your example data doesn't match your desired output so I made some guesses and assumptions.. also my code example just uses some arrays (I left them as close to the structure as your objects for easier translation); you'll have to modify it to work with your object(s) but hopefully this will point you in the right direction. On a side note..I don't know the context of your script so maybe that's what works for you, but just throwin' it out there that it's kind of odd that you want the hierarchy to be time > days instead of days > time.. $times = array( '06:00:00' => '06:00:00', '07:00:00' => '07:00:00', '08:00:00' => '08:00:00', '09:00:00' => '09:00:00', '09:30:00' => '09:30:00', '17:30:00' => '17:30:00', '18:00:00' => '18:00:00', '18:30:00' => '18:30:00', '19:30:00' => '19:30:00' ); $events = array( 0 => array( 'class_id' => '1', 'class_name' => 'Fit Box', 'class_description' => 'Fitbox is a high energy aerobic workout utilizing focus pads, kick pads, heavy bags, and speed balls. This class increases muscle strength and cardiovascular fitness and also includes strength and endurance circuit style training. Excellent for co-ordination, reflexes and to pump out the adrenalin! The class is 1 hour in duration.', 'class_time' => '06:00:00', 'class_day' => 'Tuesday', 'class_status' => 'active', 'class_colour' => 'blue', ), 1 => array( 'class_id' => '2', 'class_name' => 'Hot Boxing', 'class_description' => 'test description', 'class_time' => '08:00:00', 'class_day' => 'Wednesday', 'class_status' => 'active', 'class_colour' => 'grey' ), 2 => array( 'class_id' => '3', 'class_name' => 'Punch Face', 'class_description' => 'test again', 'class_time' => '09:00:00', 'class_day' => 'Thursday', 'class_status' => 'active', 'class_colour' => 'grey' ), 3 => array( 'class_id' => '4', 'class_name' => 'MOS', 'class_description' => 'test again', 'class_time' => '19:30:00', 'class_day' => 'Monday', 'class_status' => 'active', 'class_colour' => 'yellow' ), 4 => array( 'class_id' => '5', 'class_name' => 'Yoga', 'class_description' => 'test description', 'class_time' => '08:00:00', 'class_day' => 'Wednesday', 'class_status' => 'active', 'class_colour' => 'grey' ) ); $days_array = array("Sunday"=>"", "Monday"=>"", "Tuesday"=>"", "Wednesday"=>"", "Thursday"=>"", "Friday"=>"", "Saturday"=>""); $result_array = array(); foreach ($times as $time) { $result_array[$time] = $days_array; } foreach ($events as $event) { $class_time = $event['class_time']; $class_day = $event['class_day']; if ( isset($result_array[$class_time]) ) { $result_array[$class_time][$class_day][] = array( 'event_title' => $event['class_name'], 'event_desc' => $event['class_description'], 'event_link' => $event['class_link'] ); } } echo "<pre>";print_r($result_array); output: Array ( [06:00:00] => Array ( [Sunday] => [Monday] => [Tuesday] => Array ( [0] => Array ( [event_title] => Fit Box [event_desc] => Fitbox is a high energy aerobic workout utilizing focus pads, kick pads, heavy bags, and speed balls. This class increases muscle strength and cardiovascular fitness and also includes strength and endurance circuit style training. Excellent for co-ordination, reflexes and to pump out the adrenalin! The class is 1 hour in duration. [event_link] => ) ) [Wednesday] => [Thursday] => [Friday] => [Saturday] => ) [07:00:00] => Array ( [Sunday] => [Monday] => [Tuesday] => [Wednesday] => [Thursday] => [Friday] => [Saturday] => ) [08:00:00] => Array ( [Sunday] => [Monday] => [Tuesday] => [Wednesday] => Array ( [0] => Array ( [event_title] => Hot Boxing [event_desc] => test description [event_link] => ) [1] => Array ( [event_title] => Yoga [event_desc] => test description [event_link] => ) ) [Thursday] => [Friday] => [Saturday] => ) [09:00:00] => Array ( [Sunday] => [Monday] => [Tuesday] => [Wednesday] => [Thursday] => Array ( [0] => Array ( [event_title] => Punch Face [event_desc] => test again [event_link] => ) ) [Friday] => [Saturday] => ) [09:30:00] => Array ( [Sunday] => [Monday] => [Tuesday] => [Wednesday] => [Thursday] => [Friday] => [Saturday] => ) [17:30:00] => Array ( [Sunday] => [Monday] => [Tuesday] => [Wednesday] => [Thursday] => [Friday] => [Saturday] => ) [18:00:00] => Array ( [Sunday] => [Monday] => [Tuesday] => [Wednesday] => [Thursday] => [Friday] => [Saturday] => ) [18:30:00] => Array ( [Sunday] => [Monday] => [Tuesday] => [Wednesday] => [Thursday] => [Friday] => [Saturday] => ) [19:30:00] => Array ( [Sunday] => [Monday] => Array ( [0] => Array ( [event_title] => MOS [event_desc] => test again [event_link] => ) ) [Tuesday] => [Wednesday] => [Thursday] => [Friday] => [Saturday] => ) )
-
The way I understand that OP, $signature is actually the js var (it's part of the js he wants to output). So basically just echo out the php variable you store that whole thing in (make sure it's within script tags of course). Example (truncated for brevity): <?php $variableFromDatabase = '$signature= [{"lx":123,"ly":37,"mx":123,"my":36}]'; echo "<script type='text/javascript'>$variableFromDatabase</script>"; ?>
-
If you add more than one session (multiple addSession() calls), $curl->exec() will return an array of results, so you need to loop through it. $curl->addSession($this->url, $opts); $curl->addSession($this->url, $opts); $results = $curl->exec(); foreach ($results as $result) { echo '<textarea>'.$result.'</textarea>'; } Also you may need to set CURLOPT_SSL_VERIFYPEER => false in your $opts array to ignore ssl cert validation requirements..dunno what urls you are actually using but google.com usually redirects to https. Also..if you're trying to cURL google.com twice in a row like that, they more than likely are treating your 2nd hit like a bot since it's happening so quickly and you aren't even setting a user agent or anything (you can set the user agent string with CURLOPT_USERAGENT). They could be doing any number of things in that case, and your code doesn't show that you are doing anything to capture and report headers or errors or nothin'. If you do the above changes and it still doesn't work, try it on other urls. If it still doesn't work, add these to your $opts array: CURLOPT_HEADER => true, CURLOPT_TIMEOUT => 20, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_MAXREDIRS => 10 Then change your code to be something more like this: $curl->addSession($this->url, $opts); $curl->addSession($this->url, $opts); $results = $curl->exec(); $errors = $curl->error(); $headers = $curl->info(); foreach ($results as $i => $result) { echo "error: ".$errors[$i]."<br/>"; echo "http code: ".$headers[$i]['http_code']."<br/>"; echo '<textarea>'.$result.'</textarea><br/>'; } This should hopefully give you some clues as to what's going wrong. Maybe the target server is slow and you have to up the timeout or somethin'.
-
Mostly it's a numbers game. We aren't opposed to breaking xyz out into its own (sub) forum but if we only get like 1 question a month+ on it, there's no point in doing so. If anything, the forums are due for some spring cleaning; we've got a few that used to get enough traffic to warrant being separated, but no longer.
-
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.