Jump to content

hacknsack

Members
  • Posts

    183
  • Joined

  • Last visited

Everything posted by hacknsack

  1. How about passing the current image name back to php, use array_search to grab the current index then -- or ++ check to be sure that index exists, if it does send it, if it does not let them know they are either at the end or beginning.Be sure to check this post concerning "false" conditions:http://us3.php.net/manual/en/function.array-search.php#61666-hs
  2. Try generating a string and then write the string to the file: $output = '';foreach($temp as $value) { if(!(strpos($value, $usr))) { $output .= "$value\n"; } }fwrite($fs, $output); [edit] fixed the typos[/edit]-hs
  3. There is a limit using this method:HTML Form Tag How are you generating the array?AFAIK you would have to format a string, then parse it at the server.-hs
  4. hacknsack

    Added slashes

    Appreciate the tip, -hs
  5. This "weird" loop seems to keep going and going and ... well you know.OK this is what little knowledge I can reveal.Download Firefox, get the developer extension,You can now use the "Information" button to view "Response Headers".The problem with your page sonictk AFAICT is that the server is sending the .xsl as text/plain ( as Kovo has already pointed out ).If your host is using Apache you don't have to wait for them to make a change, you can do this with a .htaccess file that would look like:.htaccess file AddType application/xhtml+xml .xmlAddType text/xml .xslAddType text/xml .css That is the .htaccess file I use here:CD List XMLYou can try creating a test dir upload the .htaccess file see if it fixes your headers.( Your pages and style sheets have to be served from this directory )But even an expert like Stu Nicholls has experienced this ( post ): One thing I experimented with was making my xslt stylesheets with a .css extension.My link above displays fine in IE6 and FF ( using a css ext ).( Not recommending that, just saying it is so. )boen_robot, you got my back in case I messed anything up here....-hs
  6. hacknsack

    login help

    Since this is the code sent to the client, <html><head><title>Register</title></head><center><body> We should start at the beginning.Have you set up your own tables in your own database on your host?Can you point us to a support page ( at bravenet ) that contains info regarding mysql connections?Here is an excellent tutorial that might be helpful PHP/MySql.And the writer provides a zip file here example.zip.-hs
  7. hacknsack

    Added slashes

    Would you mind posting the htaccess file.That sounds like a pretty clean solution, especially if it can be made directory specific.-hs
  8. hacknsack

    Added slashes

    You are a victim of magic quotes.You can use stripslashes() on the string and everything will work out.-hs
  9. You could explode the string, then grab the date with substr() $str = 'TMG_Horoscopes_Daily_Virgo_media_20060216100017_985313.xml';$parts = explode("_", $str);$j = count($parts) - 2;echo substr($parts[$j], 0, 8); But I'm not sure exactly what you are asking.-hs
  10. Share Away.. Might be good to include a link to W3Schools and the forum.Have a good one.-hs
  11. This is what I came up with: <?php$dir = '.';$imgs = array();if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if(!is_dir($file)) { $imgs[] = $file; } } closedir($dh); }}rsort($imgs);// fill the array so the table looks goodwhile((count($imgs) % 4) != 0){ $imgs[] = " ";}$total = count($imgs);$pages = ceil($total/16);// set a default value$p = 1;// set a value if one was sentif(isset($_GET['p']))$p = intval($_GET['p']);// find upper limit for the pageif($p * 16 <= $total){ $upperlimit = $p * 16; } else { $upperlimit = $total; }echo "<p>$upperlimit and $total</p>\n";// set the start value of the index$start = ($p - 1) * 16;$j = $start;echo "<table>\n";while($j < $upperlimit){ echo "<tr>\n"; for($r = 0; $r < 4; $r++){ echo "<td>\n"; if($imgs[$j] != " ") echo "<img src='http://www.domain.com/gallery/nwb/thumbnails/".$imgs[$j++]."' alt='Click here to view larger image' />\n"; else echo $imgs[$j++]."\n"; echo "</td>\n"; } echo "</tr>\n";}echo "</table>\n";echo "<p>";for ($j = 1; $j <= $pages; $j++) { if ($p!=$j) { echo "<a href=\"index.php?p=$j\"> $j</a>\n"; } else { echo " $j"; }}echo "</p>";?> Probably easier than me trying to explain. You have done very well, -hs[edit] No credits for me please, just let me know if there are any errors in the code [/edit]
  12. Recommend that you fill the array so that your table looks nice: rsort($imgs);// fill the array so the table looks goodwhile((count($imgs) % 4) != 0){ $imgs[] = " ";} Shout back if you need any help with the table layout.I don't want to spoil your fun, -hs
  13. My suggestion would be to calculate the total number of pages available with the tools:ceil()count() ....$total = count($imgs);$pages = ceil($total/16);// at the bottom of the page you can set up a links areafor($j = 1; j <=$pages; j++){ // echo your links however you want them formatted // you would insert the Page No ( your url would end with ?p=$j ) } You can set up the code to check for a $p variable in the url. // set a default value$p = 1;// set a value if one was sentif(isset($_GET['p']))$p = $_GET['p'];// subtract one because the array index starts at 0$upperlimit = intval($p) * 16 - 1;// you will need to create the equation to get your start for each page$start = ... So, are you sure you don't want to use an already made script. I'm betting that the google search that sbrownii suggested would include a script that has a "class" that would allow sorting by date like you are after.-hs
  14. You want to declare the array outside your loop and you can add a test for the dir's, and then do your sort after you have filled the array: <?php$dir = '/path/to/files';$imgs = array(); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if(($file != '.') && ($file != '..')) { $imgs[] = $file; } } closedir($dh); }}sort($imgs);// you can use print_r() for debugecho "<pre>";print_r($imgs);echo "</pre>";?> -hs
  15. Go ahead and post what code you have tested and we will help you make your modifications.As far as working with arrays: <?php// first declare the array$imgs = array();// start your code that loops thru the filenames// add items to the array like this$imgs[] = $item_to_add;// after you have your array intact sort itsort($imgs);// then build your output?> Check out php's sort().-hs
  16. Here's what's happening:If at the home page user hits Info/Email the form appears.If the user hits Contact, clicks here (enquiries), the error appears. Warning: main(emailform2.php): failed to open stream: No such file or directory in /home/mkarting/public_html/emailinc.php on line 17Warning: main(): Failed opening 'emailform2.php' for inclusion (include_path='.:/usr/share/pear') in /home/mkarting/public_html/emailinc.php on line 17 Also errors on info pack.-hs
  17. And you said Elvis is living where .. .. Glad it worked for you.
  18. IE doesn't like the use of "parent" changed it and used {} after your "if". function compArg(usr){window.location="./index.php?act=Msg&CODE=4&MID="+usr}linkAr=document.links;reg=/showuser=(\d+)/g//Going through all the linksfor(specLink=0;specLink<linkAr.length;specLink++){//If it's found a link to a user profileif(linkAr[specLink].href.match(reg)){prevIH=linkAr[specLink].parentNode.innerHTML;//If the link is located in a place where an image shouldn't appearif(prevIH.match(/Log/g) || prevIH.match(/In/g) || linkAr[specLink].parentNode.className=="row2"){}else{oparent=linkAr[specLink].parentNode//Checking browser---cross-browser issuesif(navigator.userAgent.indexOf('MSIE') > -1 && navigator.userAgent.indexOf('Opera') == -1){var newEnv = document.createElement('<img src="http://i1.tinypic.com/noiuqt.png" onclick="compArg(' + RegExp.$1 +')">');}else{newEnv=document.createElement("img");newEnv.setAttribute('src','http://i1.tinypic.com/noiuqt.png');newEnv.setAttribute('onclick', "compArg('" + RegExp.$1 + "')");}//Add envelope picture next to current linkoparent.insertBefore(newEnv,linkAr[specLink])}}}
  19. DarkElf is correct there is some sort of problem this is the error when I click on the "click here". Warning: main(emailform2.php): failed to open stream: No such file or directory in /home/mkarting/public_html/emailinc.php on line 17Warning: main(): Failed opening 'emailform2.php' for inclusion (include_path='.:/usr/share/pear') in /home/mkarting/public_html/emailinc.php on line 17 The above happened in IE6.
  20. OK, I feel like there has got to be somebody who can write a better test for this.Please don't hesitate to post a better solution if you have one.The new re captures the char before the http, so I believe it will take care of the issue. $find=array("/\[img\](.+?)\[\/img]/","/\[link name=(.+?)\](.+?)\[\/link\]/","/\[link\](.+?)\[\/link\]/","/\[b\]([^$]*)\[\/b\]/","/\[u\]([^$]*)\[\/u\]/","/\[i\]([^$]*)\[\/i\]/","/\[quote\]\[originator=(.+?)\]([^$]*)\[\/quote\]/","/\[quote\]([^$]*)\[\/quote\]/","/\[sup\]([^$]*)\[\/sup\]/","/\[sub\]([^$]*)\[\/sub\]/","/\[div align=(.+?)\]([^$]*)\[\/div\]/","/\[size=(.+?)\]([^$]*)\[\/size\]/","/\[anchor\](.+?)\[\/anchor\]/","/\[color=(.+?)\]([^$]*)\[\/color\]/","/([^'>])http:\/\/([^'<\s]+)/","/^http:\/\/([^'<\s]+)/");$replace=array("<img src=$1>","<a href='$2'>$1</a>","<a href='$1'>$1</a>","<b>$1</b>","<u>$1</u>","<i>$1</i>","<br /><ul>quote <b>$1</b><br /><hr />$2<hr /></ul><br />","<br /><ul>quote<br /><hr />$1<hr /></ul><br />","<sup>$1</sup>","<sub>$1</sub>","<div align=$1>$2</div>","<font size=\"$1\">$2</font>","<a name=\"$1\"\></a>","<span style=\"color:$1\">$2</span>","$1<a href='http://$2'>http://$2</a>","<a href='http://$1'>http://$1</a>"); Shout back if you spot a problem.OK, added a test to check if the http string starts the string...Whew..
  21. Post the data that illustrates the problem please, I'll need it for testing.As for that re, it tests to see if the http string has already been treated by the link maker.If it has it will be surrounded by ' or > the \s makes sure we stop the capture at a space.Thanks,forgot the link:RegExLib
  22. Check out this link:object exampleMight give you a start toward your project.
  23. Added some tests to the re so that there is no re-treatment on the hyperlinks: <?php$m = '<Test This>This is a line of text[link name=Google]http://www.google.com[/link]This is a line of text[link]http://www.google.com[/link]This is a line of text[url="http://www.google.com"]http://www.google.com[/url] test';function markup($message){ $find = array("<", ">"); $replace = array("<", ">"); $message=str_replace($find, $replace, $message); $find=array("/\[img\](.+?)\[\/img]/", "/\[link name=(.+?)\](.+?)\[\/link\]/", "/\[link\](.+?)\[\/link\]/", "/\[b\]([^$]*)\[\/b\]/", "/\[u\]([^$]*)\[\/u\]/", "/\[i\]([^$]*)\[\/i\]/", "/\[quote\]\[originator=(.+?)\]([^$]*)\[\/quote\]/", "/\[quote\]([^$]*)\[\/quote\]/", "/\[sup\]([^$]*)\[\/sup\]/", "/\[sub\]([^$]*)\[\/sub\]/", "/\[div align=(.+?)\]([^$]*)\[\/div\]/", "/\[size=(.+?)\]([^$]*)\[\/size\]/", "/\[anchor\](.+?)\[\/anchor\]/", "/\[color=(.+?)\]([^$]*)\[\/color\]/", "/[^'>]http:\/\/([^'<\s]+)/"); $replace=array("<img src=$1>", "<a href='$2'>$1</a>", "<a href='$1'>$1</a>", "<b>$1</b>", "<u>$1</u>", "<i>$1</i>", "<br /><ul>quote <b>$1</b><br /><hr />$2<hr /></ul><br />", "<br /><ul>quote<br /><hr />$1<hr /></ul><br />", "<sup>$1</sup>", "<sub>$1</sub>", "<div align=$1>$2</div>", "<font size=\"$1\">$2</font>", "<a name=\"$1\"\></a>", "<span style=\"color:$1\">$2</span>", "<a href='http://$1'>http://$1</a>"); $message=preg_replace($find, $replace, $message); $message=nl2br($message); return $message;}echo markup($m);?> You'll have to test with all your inputs to make sure it works correctly.
  24. You might try reversing your handling of the http strings.(handle them first and then write your links)This is what you have in the source code (at the browser): <a href="%3Ca%20href=" http://f="">http://f</a>iles.neoseeker.com'>NeoFiles - The http's you are inserting at the first are being read later by your regular expression.Might help if you can supply a sample input to this function.(What does "$message" look like.)
×
×
  • Create New...