premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
The force is no longer with me. I cannot read the code from here =\
-
There are experts on this board? Since when ???
-
Well perhaps why it is redirecting to the root is this problem: action="/<?php echo $_SERVER['PHP_SELF']; ?> Should be: action="<?php echo $_SERVER['PHP_SELF']; ?> I did not look at the rest of the code, so there could be other issues.
-
Limit on upload_max_filesize
premiso replied to rondog's topic in PHP Installation and Configuration
You will have to make sure you modify the max post size as well and the limit would be how much disk space your server / computer can hold. I am not sure if downloaded files also get stored in memory, but that could also be a limitation. -
Try using two seperate renames, one for the parent folder and one for the sub and see if it works. If it does then yea, your problem is it cannot be done all at once. I would consider this normal behavior.
-
http://www.garnetchaney.com/htaccess_tips_and_tricks.shtml Search for "Protecting Single File" on that page for examples.
-
array_search This code snippet came from a user comments: function recursiveArraySearch($haystack, $needle, $index = null) { $aIt = new RecursiveArrayIterator($haystack); $it = new RecursiveIteratorIterator($aIt); while($it->valid()) { if (((isset($index) AND ($it->key() == $index)) OR (!isset($index))) AND ($it->current() == $needle)) { return $aIt->key(); } $it->next(); } return false; } To use with your situation (given that you define the function in your code: $rowIndex = recursiveArraySearch($array, '2', 'patientid'); print_r($array[$rowIndex]); Side note: I have no clue where toon was going at, but yea. I think he missed the point.
-
$query = "SELECT * FROM adverts WHERE align = 'hor' order by rand() LIMIT 1"; $result = mysql_query($query) or trigger_error("Adverts query failed Error: " mysql_error()); $banner = mysql_fetch_assoc($result) or trigger_error("Unable to fetch Adverts Result"); echo $banner['code']; Should work for random images using MySQL rand() function.
-
Need help with STR REPLACE function...easy one
premiso replied to becoolufull's topic in Applications
www.mysite.com/<?php str_replace(":", "", wp_title('', true, 'right')); ?> Given that it returns the title and not echos the title. If it echos it, either find a function that returns it, or use output buffering ob_start to grab it by creating your own function for it. Not being a WP Guru, yea. -
Replace Disp "Text" with "Text"_ using preg_replace
premiso replied to qureshi's topic in Regex Help
Oh.. echo str_replace(array("\n", "\r"), "", preg_replace("/Disp(.*)/i","$1_",$string)); Should sort it. -
Right, let's use a depreciated, or being depreciated function (IE ereg). Here is the corrected preg equivalent: if (preg_match('~[^A-Z0-9]~i', $text)) { echo "This has non alpha numeric characters"; }
-
The plus operator tends to concat in javascript. Perhaps try to convert the value to a float before adding, using parseFloat
-
Replace Disp "Text" with "Text"_ using preg_replace
premiso replied to qureshi's topic in Regex Help
Why not just do a str_replace on the string before or after to remove the newlines? echo str_replace("\n", "", preg_replace("/Disp(.*)/i","$1_",$string)); Simplistic as that. -
Look into the curl_setopt function, particularly: CURLOPT_FOLLOWLOCATION
-
file_get_contents doesn't seem to get the file contents (help!)
premiso replied to Chezshire's topic in PHP Coding Help
Well given the error: Warning: file_get_contents(email_addressestxt) I would say you are missing a . in your actual code before the txt. -
Replace Disp "Text" with "Text"_ using preg_replace
premiso replied to qureshi's topic in Regex Help
Ran this: <?php $string = 'Disp "Weight:" Disp X/Y'; echo preg_replace("/Disp(.*)/i","$1_",$string); ?> Got this: "Weight:"_ X/Y_ You need to check your code and make sure you are updating the right file etc. -
Replace Disp "Text" with "Text"_ using preg_replace
premiso replied to qureshi's topic in Regex Help
preg_replace("/Disp(.*)/i","$1_",$string) Should work. -
Using that matching expression posted in the preg_replace, use it in preg_match and viola, you have the first url matched. Simple as that.
-
http://www.phpfreaks.com/forums/index.php?topic=294975.0 Sometimes a search of the forums works wonders. You will also find many other topics in the regex section overing this.
-
Well, what you are doing can be a major security risk if done improperly. Is yoursite.com your actual site that you are trying to do this on? If so the following would probably work: $_GET['page'] = isset($_GET['page'])?$_GET['page']:'index'; // ternary operator acts as a short if / else $validPages = array('about', 'home', 'members', 'index'); // etc etc if (!in_array($_GET['page'], $validPages)) { $_GET['page'] = "index"; } include('index.php'); Should be a secure way of doing it, if you are in-deed working on the site the URL points to.
-
If you figured it out, you should post the solution to help others who find this problem via search.
-
Well, if the jQuery accesses the data via a php script, use ucwords. Or you can use this function: http://phpjs.org/functions/ucwords:569 and it should work.
-
If you are on 4.3.2 I would go with Cake or CI as ZF I believe only works with php 5.2+. If you can wing it though, ZF is my preferred framework.
-
$string = 'Hello, my name is otto!'; $string = str_replace("o", '<span style="color: yellow;">o</span>', $string); echo $string;
-
+1 +2