Jump to content

Scooby08

Members
  • Posts

    244
  • Joined

  • Last visited

Everything posted by Scooby08

  1. No go.. Any other ideas I could try out there?
  2. I have tried this: <?php chmod("head.tmpl", 0777); ?> But I get this error: Does the directory that the file is in need to be writable as well or something?
  3. Is there a way to change file permissions to a file that is not created by php, but rather one that I uploaded myself? I'm getting this error: Maybe something like so: <?php system("chmod -R 777 \"/head.tmpl\" "); ?> I don't know? Not sure? Any ideas??
  4. Ahh nice! Thanks rajivgonsalves!! I think that'll work just lovely!
  5. I tried that way, but if two, three or four keys are the same for example, all gets deleted but one.. That's why I had two b's in the order.. I need to be able to have duplicates..
  6. Here's how the array's are created.. <?php while ($x = readdir($dp)) { $order[] = $p['order']; $files[] = $x; } ?> Here's a sample of how they come out.. Array ( [0] => c [1] => f [2] => a [3] => b [4] => d [5] => b [6] => [7] => e ) Array ( [0] => learn-more [1] => apple.php [2] => company-info [3] => zigzag.php [4] => products-services [5] => customer-support [6] => index.php [7] => service-agreements ) How could I sort the files array by using the values of the order array and also make index.php always first to get something like so: Array ( [0] => index.php [1] => company-info [2] => zigzag.php [3] => customer-support [4] => learn-more [5] => products-services [6] => service-agreements [7] => apple.php )
  7. Thank you for the info guys.. I have read through some of the documentation and am having troubles figuring out how to do a search for everything except specific words.. For example, I have this line: /href=\"(.*)?\"/ which replaces all href's with whatever I like.. The thing I'm trying to figure out is how would I do the same, except not replace any href's like so: <a href="javascript://"> I'm thinking something like this: [^javascript\:\/\/] but Im not sure how to incorporate that into this line: /href=\"(.*)?\"/ Thanks again..
  8. Could somebody let me know if this is the correct way to do this? It seems like it's not right because the closing javascript tag seems to escape the <<<EOF.. <?php $test = "value"; return <<<EOF <script language="JavaScript" type="text/JavaScript"> <!-- some javascript --> </script> <form> <input type="text" value="$test" /> </form> EOF; } ?> Would I want the input line to be like it is, or like this: <input type="text" value="<?=$test;?>" />
  9. I basically have a function like so: <?php function AdjustForEdit($block) { $search[] = "/(['\"])?(templ\/)?images\//m"; $replace[] = "\\1".$SITEURL."/\\2images/"; $ret = preg_replace($search, $replace, $block); return $ret; } ?> I was wondering if anybody could tell me what the numbers 1 and 2 in this line are doing exactly: $replace[] = "\\1".$SITEURL."/\\2images/"; I can't seem to find any documentation on that either because I'm not too familiar with regex and do not know what exactly to search for.. Can anybody recommend any good resources??
  10. The purpose is to search 3 tables in 2 specific fields from each.. Table one, two, three and each table has fields name, symbol.. I see nothing when I run the code.. All 3 tables are like so: CREATE TABLE `one` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `symbol` varchar(20) NOT NULL default '', `market_value` varchar(20) NOT NULL default '', `description` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
  11. I can't seem to get this bit to work.. I'm not getting any errors either.. Any recommendations?? <?php $query = "SELECT one.name, one.symbol, two.name, two.symbol, three.name, three.symbol "; $query .= "FROM one, two, three "; $query .= "WHERE one.name LIKE \"%$find_symbol%\" "; $query .= "OR two.name LIKE \"%$find_symbol%\" "; $query .= "OR three.name LIKE \"%$find_symbol%\" "; ?>
  12. Ahh never mind.. Thanks for pointing me to the table Snart.. I have all records twice and didn't realize it..
  13. Can anybody tell why this would be returning two records for each item found?? <?php $query = "SELECT name, symbol "; $query .= "FROM pfs "; $query .= "WHERE name LIKE \"%$symbol%\" "; $query .= "ORDER BY symbol"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo $row['symbol']; echo $row['name']."<br />"; } ?>
  14. Trying to figure out how to tell if its the last loop.. Here is basically what I've got for the while loop: <?php $i = 1; while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { // check if last loop $i++; } ?> What must I do??
  15. Would it make any difference if the file I was trying to open is a .csv??
  16. I'm not showing any errors.. How can I show errors for file_get_contents?
  17. Would anybody know how to get larger files to open with file_get_contents? Files over 600kb seem to not work?? Any ideas out there??
  18. Awesome!! Thanks guys.. Problem solved..
  19. ok.. I actually have that sorta thing going, but I'm still not getting how to tell if it's the last loop.. Here is sample code: <?php $amount = "one two three,two three four,three four five,four five six"; $pieces = explode(",",$amount); $i = 1; $data = array(); foreach($pieces as $piece){ $data = explode(" ",$piece); if ($i == 1) { } else if ($i == 2) { } else { echo "<pre>"; print_r($data); echo "</pre>"; } $i++; } ?>
  20. Is there some way to tell which is the last loop from this code: <?php foreach($rows as $row){ echo "$row"; } ?> The amount of loops is always unknown..
  21. I do have multiple values in the arrays, I just took out the rest to show my problem.. Here is the full function: <?php function TranslateVariables($input, $props = "") { global $VAR, $TEMPL, $sitedir, $USER, $SITEHOMEURL, $SITEURL; $search = array("/<title>.*?<\/title>/im", "/<meta name=\"keywords\" content=\".*?\">/im", "/<meta name=\"keywords\" content=\".*?\" \/>/im", "/<meta name=\"description\" content=\".*?\">/im", "/<meta name=\"description\" content=\".*?\" \/>/im", "/<\!--CompanyName-->.*?<!--\/CompanyName-->/", "/<\!--TagLine-->.*?<!--\/TagLine-->/", "/<\!--Footer-->.*?<!--\/Footer-->/", "/<BASE HREF=\"(.*?)\">/", "/##USERNAME##/", "/##URL##/", "/##EMAIL##/", "/##PHONE##/", "/##COMPANY##/", "/##ADDR1##/", "/##ADDR2##/", "/##FAX##/", "/##OWNER##/", "/".urlencode("##COMPANY##")."/", "/".urlencode("##TAGLINE##")."/" ); $replace = array("<title>".EncodeText($VAR['title'])." - ".($props['title'])."</title>", "<meta name=\"keywords\" content=\"".(stripslashes($props['keywords']))."\">", "<meta name=\"keywords\" content=\"".(stripslashes($props['keywords']))."\" />", "<meta name=\"description\" content=\"".(stripslashes($props['description']))."\">", "<meta name=\"description\" content=\"".(stripslashes($props['description']))."\" />", "<!--CompanyName-->".EncodeText($VAR['title'])."<!--/CompanyName-->", "<!--TagLine-->".EncodeText($VAR['tagline'])."<!--/TagLine-->", "<!--Footer-->".EncodeText($VAR['footer'])."<!--/Footer-->", "<BASE HREF=\"$SITEURL/\">", "$USER", $VAR['url'], $VAR['email'], $VAR['phone'], $VAR['title'], $VAR['addr1'], $VAR['addr2'], $VAR['fax'], $VAR['owner'], urlencode($VAR['title']), urlencode($VAR['tagline']) ); if (strlen($VAR['logo'])>0) { $search[] = "/<!--CorpLogo-->/"; $replace[] = "<a href=\"index.php\"><img border=0 src=\"".$VAR['logo']."\" ".$TEMPL['logohtml']."></a>"; } return preg_replace ($search, $replace, $input); } ?> I have a question.. What does the +\1 mean in this line: '/<base href=([\'"])[^\'"]+\1>/i';
  22. I switched it to this and it got rid of the error, but it is not finding any matches.. <?php function TranslateVariables($input) { global $SITEURL; $search = array("/<base href=(['\"])(.+?)\1>/i" ); $replace = array("<base href=\"$SITEURL/\" />" ); return preg_replace ($search, $replace, $input); } ?>
  23. Here is my new code.. <?php function TranslateVariables($input) { global $SITEURL; $search = array('/<base href=([\'"])(.+?)\1>/i' ); $replace = array("<base href=\"$SITEURL/\" />" ); return preg_replace ($search, $replace, $input); } ?>
  24. I have tried these suggestions and this is the error I get and I'm not quite sure what it is meaning.. Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')'
×
×
  • 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.