Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. 1) and 2) can't help you with 3rd <?php function scandir_r($directory) { $scanned_files = array(); $files = scandir($directory); foreach ($files as $file) { if (is_dir($file)) { $scanned_files[] = scandir_r($file); } else { $scanned_files[] = $file; } } return $scanned_files; } function search_r($filename, $directory) { $result = array(); $files = scandir_r($directory); foreach ($files as $file) { if (is_array($file)) { $result[] = search_r($filename, $file); } else if (strpos($file, $filename) !== false) { $result[] = $file; } } return $result; } ?>
  2. I was actually referring to an extension that your browser definitly not knows like .foo for example
  3. You are talking about variable variables: http://be.php.net/language.variables.variable However you can not make a variable that starts with a number it must be either an underscrore or an alphabetic character create a variable variable like this: <?php $var = "foo"; ${$var} = "bar"; echo $foo; ?>
  4. I don't think there is a problem with your code your browser just recognizes the extension and instead of downloading it display's it. The same thing happens when you download a pdf file instead of downloading, the browser reads the file, loads the plugin and display's the pdf in browser. Try adding a different extension and see if that helps P.S. remove the echo headers_sent();
  5. Did you try: <?php // content negotiation $supportXhtml = stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml') !== false?true:false; $br = nl2br("\n", $supportXhtml); $brs = str_replace($br.$br, $br, $brs); ?>
  6. http://www.phpfreaks.com/tutorial/basic-pagination
  7. http://dev.mysql.com/doc/refman/6.0/en/comparison-operators.html#operator_between
  8. http://dev.mysql.com/doc/refman/6.0/en/time-zone-support.html
  9. http://www.phpfreaks.com/tutorial/basic-pagination
  10. Well that depends you could ofcourse also use strip_tags() if you don't want any html tags in your database
  11. Well like it says it can't find mysqli_connect.php Verify your paths
  12. It's mysql_real_escape_string() not mysql_escape_string() add this code on top of your script: error_reporting(E_ALL);
  13. <?php $username = mysql_real_escape_string($_POST["username"]); $password = mysql_real_escape_string($_POST["password"]); $role = mysql_real_escape_string($_POST['role']); $query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'" ; $result = mysql_fetch_array(mysql_query($query)); if (!sizeof($result)) { $output .= '<loginsuccess>no</loginsuccess>'; } else if ($role === 'user') { $output .='<loginsuccess>user</loginsuccess>'; } else if($role === 'admin') { $output .= '<loginsuccess>admin</loginsuccess>'; } echo $output; ?>
  14. <?php $query = ".."; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { ?><div style="width:132px;height:132px;margin:0 5px 0 5px;float:left;"> <table width="132" style="background:url('http://image.vickizhao.net/starhome/photo/list/img_pic_bg.gif') no-repeat;"> <tr style="height:132px;"> <td><a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/read/read.php?Pid=<?php print $row['id']; ?>"><img id="reSizeImg1" src="<?php print $row['imgpath']; ?>" style="border:solid 1px #ffffff;" alt="" /></a></td> </tr> </table> </div><?php } ?> for this part: <table width="100%"> <tr style="height:33px;background:#f3f3f3;"> <td class="tac vam"><span class="fs11"><img src="http://image.vickizhao.net/style_guide/icn/icn_starhome_prevfirst.gif" class="vat" alt="NEXT" style="margin:2px; 0 0 0;" /> <img src="http://image.vickizhao.net/style_guide/icn/icn_starhome_prev1.gif" class="vat" alt="PREV" style="margin: 2px;"> <a class="fs11 fc7" href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/list.php?Pid=1">1</a><span class="fs10 fc7"> / </span><a class="fs11 fc7" href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/list.php?Pid=2">2</a><span class="fs10 fc7"> / </span><a class="fs11 fc7" href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/list.php?Pid=3">3</a><span class="fs10 fc7"> / </span><a class="fs11 fc7" href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/list.php?Pid=4">4</a><span class="fs10 fc7"> / </span><a class="fs11 fc7" href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/list.php?Pid=5">5</a><span class="fs10 fc7"> / </span><a class="fs11 fc7" href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/list.php?Pid=6">6</a><span class="fs10 fc7"> / </span><span class="b fs11 fc7">7</span><!--<a class="fs11 fc7" href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/list.php?Pid=7">7</a>--><span class="fs10 fc7"> / </span><span class="fs11 fc10">8</span><!--<a class="fs11 fc7" href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/list.php?Pid=8">8</a>--><span class="fs10 fc7"> / </span><span class="fs11 fc10">9</span><!--<a class="fs11 fc7" href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/list.php?Pid=9">9</a>--><span class="fs10 fc7"> / </span><span class="fs11 fc10">10</span><!--<a class="fs11 fc7" href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/list.php?Pid=10">10</a>--> <img src="http://image.vickizhao.net/style_guide/icn/icn_starhome_next1.gif" class="vat" alt="NEXT" style="margin:2px; 0 0 0;" /><!--<a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/list.php?Pid=11" onfocus='this.blur();' style='text-decoration:none;'><img src="http://image.vickizhao.net/style_guide/icn/icn_starhome_next1.gif" class="vat" alt="NEXT" style="margin:2px; 0 0 0;" /></a>--> <img src="http://image.vickizhao.net/style_guide/icn/icn_starhome_nextlast.gif" class="vat" alt="NEXT" style="margin:2px; 0 0 0;" /></span></td> </tr> </table> look at: http://www.phpfreaks.com/tutorial/basic-pagination
  15. Object id #.. is a description for it's internal objects
  16. So you arrange a string from msd to lsd by converting it to an integer, correct?
  17. if (isset($_GET['page']) && $_GET['page'] === 1) { ..page 1.. } else if (isset($_GET['page']) && $_GET['page'] === 2) { ..page 2.. } ..
  18. read this: http://www.phpfreaks.com/forums/index.php/topic,250459.msg1174355.html#msg1174355 and yes you can host it locally
  19. @PFMaBiSmAd That is very interesting i never though about it that way nevertheless i tested it and it didn't work, tried both: <?php if ("1-1-2009" > "31-12-2008") { echo "yep!"; } else { echo "nope!"; } ?> <?php if ("01-01-2009" > "31-12-2008") { echo "yep!"; } else { echo "nope!"; } ?> Both say nope!
  20. Then you would have to extend Ken's code: <?php $strings = array('there is something about mary..', 'some more mary', 'and a little more.. mary'); $words = explode(' ', array_shift($strings)); $matches = array(); foreach ($words as $word) { foreach ($strings as $string) { if (strpos($string, $word) !== false) $matches[] = $word; } } ?> No problem to big, no problem to small for us guru's to solve ain't it Ken
  21. add another field in your form which says: <input type="hidden" name="id" value="<?php print $row['id']; ?>" /> then you can do: UPDATE tableName SET validate = $_POST['validate'] WHERE id = $_POST['id'] also where in my code do I put well that is more difficult, not in the while that is for certain Sorry I'm an annoying newbee! And i am here to entertain you
  22. To easy: <?php $strings = array( 'apple blue green', 'apple yellow not', 'apple something blue', 'apple drugs car yellow' ); $wordcounts = array(); foreach ($strings as $string) { $words = explode(' ', $string); foreach ($words as $word) { if (isset($wordcounts[$word])) { ++$wordcounts[$word]; } else { $wordcounts[$word] = 1; } } } print_r($wordcounts); ?>
  23. besides what probably everyone forgot was that php can not compare dates only mysql can when you do this: if($todate<$fromdate) then you are comparing strings which means you are comparing there ascii value, example: if ("A" > "a") 65 > 97 == false so what you need to do is change the date into an integer and compare these therefor you can use my method and then if ($from_unixtime < $to_unixtime) you will get the resulsts you need
  24. <?php if($todate<$fromdate) { echo "You entered a Wrong date/time.Please enter the Date/Time correctly"; exit;} if($todate==$fromdate) { echo "You entered a Wrong date/time.Please enter the Date/Time correctly"; exit;} ?> is the same as <?php if($todate<$fromdate || $todate==$fromdate) { echo "You entered a Wrong date/time.Please enter the Date/Time correctly"; exit;} ?> Maybe you can use something like: list($date, $time) = explode(' ', $_POST['fromdate']); list($year, $month, $day) = explode('-', $date); list($hour, $minute, $second) = explode(':', $time); $fromdate = mktime($hour, $minute, $second, $month, $day, $year); However these kind of dates aren't really practical especially not for the end-user try creating some regular expression if you can not create one then you may be able to find one on: http://regexlib.com/
  25. You are possibly looking for this: http://chimit.mirrors.phpclasses.org/blog/package/2/post/1-Process-incoming-email-messages-using-PHP.html However there are a few drawbacks to this method for example if your script fails then you will never get that e-mail and no back-up exists..
×
×
  • 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.