Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by hacknsack

  1. Hi everybody,Skemcin,Any help here: <head> <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <meta name="generator" content="PSPad editor, www.pspad.com"> <title></title> <script type="text/javascript"> function getInfo(form){ var fields = { user: "ID", pass: "pword" }; for(var nm in fields){ if(form.elements[fields[nm]].value == '') return false; form.elements[nm].value = form.elements[fields[nm]].value; } document.getElementById('f1').submit(); } </script> </head> <body> <noscript> <h3>This form will not work, you must enable javascript.</h3> </noscript> <form id="f1"> <input type="hidden" name="user"> <input type="hidden" name="pass"> <input type="text" name="ID"> <input type="text" name="pword"> <input type="button" onclick="getInfo(this.form)" value="Test This"> </form> HTH
  2. I think you are looking for extract().-hs
  3. Usually hosts have a control panel that will allow you to edit and save files through a browser based interface.Maybe your provider has this feature??-hs
  4. Should be no problem then for you to let us know what error is generated from your query. That's the great thing about phpMyAdmin :)Your code works fine for a table that is created like so: CREATE TABLE `w3test` (`BusinessID` int(6) unsigned NOT NULL AUTO_INCREMENT ,`Status` varchar(25) NOT NULL,`Domain` varchar(25) NOT NULL,`Title` varchar(25) NOT NULL,`Fname` varchar(25) NOT NULL,`Lname` varchar(25) NOT NULL,`Phone` varchar(25) NOT NULL,`Ext` varchar(25) NOT NULL,`Fax` varchar(25) NOT NULL,`Address` varchar(25) NOT NULL,`City` varchar(25) NOT NULL,`State` varchar(25) NOT NULL,`ZipCode` varchar(25) NOT NULL,`Email` varchar(25) NOT NULL,`MarkType` varchar(25) NOT NULL,`MarkDetail` varchar(25) NOT NULL,`Sdate` varchar(25) NOT NULL,`Rdate` varchar(25) NOT NULL,`AddInfo` varchar(25) NOT NULL,PRIMARY KEY ( `BusinessID` )) TYPE = MYISAM And then you also have to make a plan to deal with characters that need escaping.. -hs
  5. Looks like you are getting serious, if I were you I would start using phpMyAdmin.Gives you a command line interface to your database.As far as your problem, do this query and post your results: $sql = "show create table Profile"; Also post the sample data that you are trying to insert into the table.I see that you've checked the fields by posting them on the page, they all posted properly to the page?That is alot of information, are you using post as your form method?-hs
  6. Sounds like eval() is what you need.http://us2.php.net/manual/en/function.eval.php-hs
  7. hacknsack


    Is the script that is using the chmod() in the same directory?Have you tried a relative path instead of absolute?What are the permission settings on the folder where the file is located?I've tested your code on 2 different servers with no errors . . -hs
  8. You do not want to use var when setting the variable in your function, that makes it a local variable. function checkOpen(pageId) {var popupBlocked=((!oWindowsT[pageId]) || (oWindowsT[pageId].closed)) ? true : false;} -to- function checkOpen(pageId) {popupBlocked=((!oWindowsT[pageId]) || (oWindowsT[pageId].closed)) ? true : false;} -hs
  9. str is still empty because your test2() is not called until 1 second has passed.You'll need to test the variable after the setTimeout has had time to work like:var str=""function test1(id) {id=truesetTimeout("test2(\"" + id+ "\")",1000);}function test2(id){if(id)str="hello";}var bool=""test1(bool)setTimeout('alert(str)', 1500); -hs
  10. You're welcome, but actually it was your idea . . I'm glad you suggested the test, I am working on a recipe builder page, I can incorporate the code.Thanks,-hs
  11. In your post you stated that using stripslashes was removing your slashes. My post was meant to illustrate that you would only be missing the slashes if you filtered the string more than necessary.get_magic_quotes_gpc() will return 1 if on if(get_magic_quotes_gpc()) $temp = stripslashes($temp); -hs
  12. I think you mean you have a table named record that has a field named print and you want to total that field using the data from each row returned. $query = mysql_query("select * from record where id='$id'");$objSum = 0;while ($row = mysql_fetch_array($query)) { $objSum += $row['print']; }echo $objSum; Let us know if that is not what you meant.-hs
  13. Can you pinpoint where you are losing the slashes? <html><?phpecho phpversion();if(isset($_POST['t1'])){$tStr = $_POST['t1'];echo "<p>$tStr</p>";$tStr = stripslashes($tStr);echo "<p>$tStr</p>";$tStr = stripslashes($tStr);echo "<p>$tStr</p>";}?><form id="f1" action="" method="post"><textarea name="t1" rows="8" cols="40">This is a "quoted" string with a'quoted' phrase with a \ for more \ testing.</textarea><input type="submit"></form></html> The above test page yields the following results( ver 4.3.7 ): This is a \"quoted\" string with a \'quoted\' phrase with a \\ for more \\ testing. This is a "quoted" string with a 'quoted' phrase with a \ for more \ testing. This is a "quoted" string with a 'quoted' phrase with a for more testing. -hs
  14. Dump the file into a variable and then use nl2br. <?php //include contents$temp = file_get_contents ('content.txt');$temp = nl2br($temp);echo $temp;?> -hs
  15. I'm not sure what happened for you to get that result.You can use either of these methods just adjust the arrays.str_replace(Adjust the top lines in your present markup function)$find = array("<", ">","[ul]","[/ul]");$replace = array("<", ">","<ul>","</ul>");$message=str_replace($find, $replace, $message); preg_replace(Add the search and replace strings to the arrays) $find = ........."/\[ul\]/","/\[\/ul\]/");$replace = ........."<ul>","</ul>"); -hs
  16. Using compact might be a better alternative, I put this together using array_multisort() Post back if it's not working just right. <?php$dir = '.';$imgs = array();$date = array();$name = array();// users method set at next line$method = 'name';// opens image directoryif (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if(!is_dir($file)) { $imgs[] = $file; $date[] = filemtime($file); $name[] = $file; } } closedir($dh); }}if($method == 'date'){array_multisort($date, SORT_DESC, $name, SORT_DESC, $imgs); }if($method == 'name'){array_multisort($name, SORT_DESC, $date, SORT_DESC, $imgs); }print_r($imgs);?> -hs
  17. You'll have to test this on your post thread, but it looks like str_replace is the ticket. <?php$tester = "1[ul]2[ul]3[/ul]2[/ul]1";$find = array("[ul]","[/ul]");$replace = array("<ul>","</ul>");echo str_replace($find, $replace, $tester);?> -hs
  18. The php function filemtime() returns the file "last modified" as a Unix timestamp.To cover the file types you could include a regular expression pattern in your config file: $pattern = "/(\.jpg|\.gif|\.png)$/"; Then add a test when you build the array: while (($file = readdir($dh)) !== false) { if(!is_dir($file) && preg_match($pattern, $file)) { $imgs[] = $file; } } -hs
  19. Sending the "img" and "act" back to show.php you can do this: if (isset($_GET['act'])){ $key = array_search($img, $_SESSION['imgsArray']); if ($_GET['act'] == 'prev'){ $key--; if(isset($_SESSION['imgsArray'][$key])){ $img = $_SESSION['imgsArray'][$key]; } } if ($_GET['act'] == 'next'){ $key++; if(isset($_SESSION['imgsArray'][$key])){ $img = $_SESSION['imgsArray'][$key]; } }} Your links: <a href="<?php echo "$domain/$gallery/show.php?img=$img&act=prev";?>">< Prev</a> . .<a href="<?php echo "$domain/$gallery/show.php?img=$img&act=next";?>">Next ></a> -hs
  20. Looks like the post I referred you to was missing a set of parenthesis...<?php$tester = array("one","two","three","four");if (($key = array_search('four', $tester)) !== false){ echo "$key"; }?> I'll have to study on the multiplication issue.Are you changing the modula formula when you change your columns?Another thing you might consider is firing up a session and store the img array in a session variable, then you don't have to open the directory after the first read.-hs
  21. Take a look at some of these links,php Apache localhostAlso, a good resource http://www.easyphp.org ( thanks to Armed Rebel ) .-hs
  22. hacknsack

    BBCode to HTML

    Check this thread, preg_replace() works with arrays.http://w3schools.invisionzone.com/index.php?showtopic=2488preg_replace()-hs
  23. No php cannot, but there is a "target" attribute that you can set 'target="_blank"'.http://www.w3schools.com/tags/tag_form.aspBefore you spend alot of time pursuing that I would test how different browser's "pop-up" settings respond to it. -hs
  • Create New...