Jump to content

KrisNz

Members
  • Posts

    271
  • Joined

  • Last visited

Everything posted by KrisNz

  1. Theres a findCount function, I think it would look something like this $count = $this->Webapp->findCount(array("mutId"=>$jobid)); Your 2nd and 3rd lines of code baffle me though. You should read the manual page for escapeshellcmd(), since it's for an entirely different purpose than the one you're using it for. Go through the cake tutorials also.
  2. I don't think its possible to do it that way, though I can't fully get my head around why, hopefully someone else can explain. Here is another solution. <?php $text = "cheese is a kind of meat, a tasty yellow beef."; $keys = range('a','z'); $final = array_combine($keys,array_reverse($keys)); echo strtr($text,$final); ?>
  3. http://php.net/manual/en/ref.runkit.php
  4. this would fix your problem $stringData = "$ni = {$_POST['nickname']}; \n"; but if you're generating a php file, wouldn't you want to literally write that string to the file, as in $stringData = '$ni = $_POST["nickname"];'."\n"; Otherwise your generated php file will contain the value of $ni rather than literally $ni. Try echoing out both the statements I've shown to see the difference.
  5. It's also often caused by trying to access a variable but without a dollar sign or trying to access a hash key without placing the key in quotes. <?php $foo = 'bar'; //ok echo foo; //undefined constant, common typo $hash = array('foo'=>'bar'); echo $hash['foo']; //ok echo $hash[foo]; //undefined constant, foo is a string ?>
  6. Yes, that's possible, no you haven't used while correctly. cURL returns all the page content at once so you don't need that loop at all.
  7. do a print_r() on $_POST and check in both browsers, you'll notice a difference. Firefox includes the name of the image button in the postback. IE doesn't, hence your login code doesn't run in IE.
  8. I'd suggest validating your html. You have a meta tag in your body section for starters.
  9. Suppressing errors when you require/include will suppress errors for that entire file, i.e if somefile.php has errors, they wont be displayed, regardless of whatever error reporting is set in that file. Use sparingly, if at all.
  10. Try changing this $searchKey = preg_quote($this->searchKey); to $searchKey = preg_quote($this->searchKey,'/'); If this works, I can't really take credit for it, it was on the manual page for preg_quote, but it worked for me.
  11. http://www.4guysfromrolla.com/demos/OnBeforeUnloadDemo1.htm
  12. I would do something like this, since it gives more meaningful code and allow you to access the data more easily. It's also more flexible in that it doesn't require each piece of data to have the same length the way your method would. This merges each line with a set of keys to define what each piece of data represents. <?php $keys = array("code","coords1","coords2","coords3","fname","lname","time","date","code2"); //these are just for example of course $tmp = file("test.txt"); //replace with your file name - this reads each line into its own array element $geoData = array(); //create the final array we will store everything in foreach ($tmp as $line) { //loop through our file()'d array $t = explode(" ",$line); //assume that a space delimits each piece of data $geoData[] = array_combine($keys,$t); //combine our keys and data together and store them in our final array } pr($geoData); //output the contents to screen /*this is for convenience*/ function pr($a) { echo "<pre>".print_r($a,1)."</pre>"; } ?> What you also need to consider is how each field is delimited, that is, what character defines the end of a piece of data. I've used whitespace in my example, but say you wanted name to be one field. One way around would be to store name as one value by separating first and last name with an underscore '_'. Another way would be to delimit each piece of data with something other than whitespace. Commonly used characters are ',' '|' and 'รพ' to name a few.
  13. The problem is with the way you're trying to use the mail function. A basic usage would be mail("bobrick82@gmail.com", 'online registration',$message); If you want to include all the other pieces of data you are going to have to concatenate each piece together, and store that into one variable.
  14. Find it with a regular expression. E.G <?php $string = <<<EOF <div style="width: 70%; float: left;"> <div style="float: left;"> </div> <div style="padding: 3px 0pt 0pt 5px; float: left;"> <label title="Use free text. 6 remaining" for="compose.paymentType" style=""> Use free text. You have 6 texts remaining </label> </div> </div> </div> EOF; preg_match("/(?<=You have )[0-9]+/",$string,$matches); print_r($matches); ?>
  15. Not really, theres some ambiguity in that since it states earlier in the file Plus the default setting for php is to have buffering on with a max of 4k of data, essentially spitting things out in 4k chunks. I'll also quote this from another thread http://www.dynamicdrive.com/forums/archive/index.php/t-11082.html Also this http://www.ipbwiki.com/Practical_PHP_Programming:Output_buffering_performance_considerations and this http://www.linuxformat.co.uk/wiki/index.php/PHP_-_Output_buffering Those articles suggest that performance depends on compression, and the content you're compressing but theres no suggestion that it will grind your server to a halt. It's all interesting stuff anyways...
  16. Do you have a benchmark or an example/article that demonstrates this please?
  17. You do realize, that $logname = stripslashes($qls->user_info['username']); doesn't actually tell me what value it has. It could be nothing for all I know. $num could equal 0. I'm suggesting that you check those values to see if they're what you expect. Plus posting code that poorly written and laid out and then saying I can't read code is pretty funny.
  18. what does $num = ? what value does $logname have?
  19. Its called complex syntax. You could always RTFM. http://nz2.php.net/manual/en/language.types.string.php
  20. ...Which is why you should use output buffering. It's as simple as <?php ob_start(); include("user_file.php"); ob_end_clean(); if (isset($user_var)) { //.... } ?> Perhaps a better alternative, would be to check the uploaded file at the time its uploaded for the required variables, and reject it with a message to the user as to why its unacceptable.
  21. Or, if thats not an option, use output buffering.
  22. I mean that they should all be part of your CURLOPT_POSTFIELDS string. The code that processes the login will be expecting them and will be part (if not all) of the reason you're getting bumped back to the homepage.
  23. try <?php $img_number = imagecreatetruecolor(275,25); //this doesn't make any visible difference here, but the php manual recommends using it. $backcolor = imagecolorallocate($img_number,76,174,255); $textcolor = imagecolorallocate($img_number,255,255,255); imagefill($img_number,0,0,$backcolor); $number = " Your IP is $_SERVER[REMOTE_ADDR]"; Imagestring($img_number,10,5,5,$number,$textcolor); header("Content-type: image/png"); imagepng($img_number); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.