Jump to content

Prismatic

Members
  • Posts

    503
  • Joined

  • Last visited

Everything posted by Prismatic

  1. <?php $bad_tags = array("123123123", "123~123123", "123 123 123", "abc123-123~123hgt"); foreach($bad_tags as $tag) { echo implode("-", str_split(preg_replace('/[^\d]/', "", $tag), 3)) ."\n"; } ?> Output: 123-123-123 123-123-123 123-123-123 123-123-123
  2. ImageTTFText has an angle option. -90 should draw it vertically. However, if you're looking to draw the letters upright but vertical like this h e l l o Then you'll need to take your string, explode it into indivual characters, then loop over each character placing it on the picture xx pixels lower then the previous letter
  3. View the source of the generated page. What is the src="" value for the image?
  4. Try this, it's untested. <?php $result = mysql_query("SELECT * FROM products"); $count = mysql_num_rows($result); if($count < 17) { $page = '<a href = "products.php">Page 1</a>'; } elseif($count < 37) { $page .= '<a href = "products.php?page=1">Page 1</a>' . " "; $page .= '<a href = "products.php?page=2">Page 2</a>'; } $totalproducts = mysql_num_rows($result); echo $page; echo '<table width="750" border="0" align="center">'; echo '<tr>'; $i = 0; while($row = mysql_fetch_array($result)) { if( (($i % 4) == 0) && ($i != 0) ) { echo '</tr><tr>'; } /** * I'm assuming all your image's reside in the /img directory. */ echo '<td width="25%" height="150" align="center">' . '<img src="img/' . substr($row['prod_img'], strrpos("/", $row['prod_img']) + 1, strlen($row['prod_img'])) . '"/>' . '<br>' . $row['prod_name'] . '<br>' . '$' . $row['prod_price'] . '</td>'; $i++; } echo '</tr>'; echo '<table>'; ?>
  5. <?php $file = "path_to_file.jpg"; header('Content-type: image/jpeg'); readfile($file); exit; ?>
  6. We won't give you the full script. You need to make an attempt or you'll never learn. How much of your system is done sofar? And how is your database structured?
  7. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN"> <html> <head> <title></title> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> First name: <input type="text" name="first_name"><br> Last name: <input type="text" name="last_name" style="position: relative; left: 1px;"> <input type="submit" value="Submit"> </form> <?php $first = $_POST['first_name']; $last = $_POST['last_name']; $charecter = array("is gay", "is cool", "is a funny", "is a wierdo", "is just dumb"); $doing = array("farts alot", "runs in circles", "...", "and loves strawberry shortcake"); $number = range('0','9'); $test = ($number[rand(0,9)]) . ($number[rand(0,9)]); if($_POST['submit']) { if(!empty($first) && ($last)) { echo $first . " " . $last . " " . $charecter[rand(0,4)] . " and " . $doing[rand(0,3)] . "<br /> Lucky Number: " . $test . "."; } if($test < 99 && $test > 50) { echo "That is a great number!"; } } ?>
  8. It also won't work. You only set $input to $output if magic quotes is on. If it's not, mysql_real_escape_string ends up escaping an empty $output variable.
  9. Wouldn't that just generate an uncaught exception error since you don't catch any exceptions.
  10. Not needed... Most providers allow you to simply email a phone an SMS, go here for a list http://www.makeuseof.com/tag/email-to-sms/
  11. I had the same problem years ago and discovered an Apache setting that would include a file across any site you wanted... Unfortunately I cant find the trick anymore
  12. No, playlists will not be filenames. They are just going to be in stored in the database. So, when you mysql_real_escape_string() a value, it converts all single quotes into \' Does the \, get stored in the database like that? With the backslash? Yes. When you recall the data from the database run stripslashes() on it to remove them.
  13. No, that removes all spaces. use this <? $string = "this has lots of extra spaces"; echo preg_replace('/\\s{2,}/',' ',$string); ?>
  14. Smarty is not hard at all. You put all your templates in the templates folder. inside each template where you want a variable to show do {$variable_name} then you simply do $smarty = new Smarty(); $smarty->assign("variable_name", "Hello world!"); $smarty->display("template_file.html"); It can be more complicated if you'd like but all template engines will follow the same general flow.
  15. <?php $s_date = strtotime("2009-03-01 12:00"); $e_date = strtotime("2009-03-03 14:00"); $date = strtotime("2009-03-02 13:00"); if($date > $s_date && $date < $e_date) { print "Date is between start and end"; } else { print "Date is outside start and end"; } ?>
  16. <?php $data = array(array("name" => "laptop 1", "username" => "user 1", "start" => "2009-01-31 10:00", "end" => "2009-01-31 12:00"), array("name" => "laptop 1", "username" => "user 1", "start" => "2009-02-01 10:00", "end" => "2009-02-03 12:00"), array("name" => "laptop 1", "username" => "user 1", "start" => "2009-03-01 10:00", "end" => "2009-03-03 12:00"), array("name" => "laptop 1", "username" => "user 1", "start" => "2009-04-01 10:00", "end" => "2009-04-03 12:00"), array("name" => "laptop 1", "username" => "user 1", "start" => "2009-05-01 10:00", "end" => "2009-05-03 12:00")); foreach($data as $key => $val) print $val["start"] ."<br />"; ?> Returns: 2009-01-31 10:00 2009-02-01 10:00 2009-03-01 10:00 2009-04-01 10:00 2009-05-01 10:00 edit - im slow
  17. You can, just make sure it gets inserted into the <head></head> of your document
  18. You sir, have no idea what you're talking about... And frankly I'm not sure if I can say what you actually want. Do you need to create a guestbook using MS Access as a database? Yes, I need to create a guestbook using MS Access as a database... Why do you keep quoting people and not adding anything? Is that your way of bumping? If so, you're not going to get a better answer. Sorry. There isn't a *magic* answer. he keeps adding his replies inside the quotes.
  19. For the value of each element you wish to repopulate assign a php variable to it <input type="text" name="something" value="$something_value"> Then in your script you would simply do $something_value = $_POST['something']; //Other code... //Code to display the form(s)
×
×
  • 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.