-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
-
I assume that this input field eventually comes with some kind of submit button.. alternatively you could validate it onclick or onsubmit. However, just want to point out that seeing as how this is javascript, the user can simply disable javascript or overwrite your js function to do whatever the hell he wants.. you should be validating this server-side.
-
google "beautify url" lots of tuts on how to do exactly this.
-
You can use str_replace (the examples even show replacing linebreaks)
-
How to reload a page in php after form submit
.josh replied to Ravi_Ramsagar's topic in Javascript Help
Oh okay I get it.. okay try this: window.open('', 'invoices', 'width=650,height=800,status=yes,resizable=yes,scrollbars=yes'); window.setTimeout("document.getElementById('inv').reset();",100);- 6 replies
-
- javascript
- php
-
(and 1 more)
Tagged with:
-
How to reload a page in php after form submit
.josh replied to Ravi_Ramsagar's topic in Javascript Help
So you're telling me that the form page itself isn't reloaded from the form submit? If that is the case, then in your check_counter() function you can add this: document.getElementById('inv').reset();- 6 replies
-
- javascript
- php
-
(and 1 more)
Tagged with:
-
No, I am not trying to split hairs; my contention is that it IS worded fair enough. My concession is that it has limited use as an actual function - IMO a function that will return the keys, as shown in the comments you pointed out, would be more useful.
-
The manual says: preg_grep — Return array entries that match the pattern Report a bug Description array preg_grep ( string $pattern , array $input [, int $flags = 0 ] ) Returns the array consisting of the elements of the input array that match the given pattern. How is this poorly defined? Not entirely useful? Sure. Poorly defined? Nope.
-
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'.