Jump to content

JAY6390

Members
  • Posts

    825
  • Joined

  • Last visited

Everything posted by JAY6390

  1. Are you wanting all letters to have the same character after them? or each one different?
  2. function replace_chars($text) { echo '<pre>'.print_r($text, true).'</pre>'; return str_repeat('*', strlen($text[0])); } $text = 'this is a #test'; $result = preg_replace_callback('/(?<!#|[a-z])[a-z]+/i', 'replace_chars', $text); echo $result;
  3. In your .htaccess file put RewriteEngine on RewriteCond %{HTTP_HOST} ^1\.1\.1\.1$ RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
  4. set the field to auto increment http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html
  5. You can just add it to the die statement, or do the error handling the traditional way of $result = mysqli_query($dbc,$query); if(!$result) { echo "MySQL Error:" . mysqli_error($dbc); die('We are sorry, your email could not be sent at this time. Please try again in a few minutes'); }
  6. Thats because you run the echo line BEFORE the query is run (ie before mysqli_query(...))
  7. %s is used with the sprintf() to replace areas with variables. It's just a neater way of putting variables into a string. %s will be replaces with the $_GET['id'] variable
  8. Hi rondog Try this code $query = "SELECT bins.user_id FROM bins LEFT JOIN clips ON clips.bin_id = bins.id WHERE clips.id = '%s'"; $result = mysql_query(sprintf($query, mysql_real_escape_string($_GET['id']))); if (!$result) { die(mysql_error()); } $user_id = mysql_fetch_array($userQuery); if ($_SESSION['userid'] != $user_id['user_id']) { echo "you dont have access to that clip"; } else { echo "show them clip stuff"; } Also be sure that you use session_start(); at the top of your script, or the session wont be active
  9. have a counter in a session, that has the current page number. If the user is trying to access page 4 and the counter is already page 4 then the user has refreshed the page. You can similarly do this to check that they aren't going back in the process as well (you will need to disable the page caching as well)
  10. $query = "SELECT bin_id FROM clips WHERE clips.id = '".mysql_real_escape_string($_GET['id'])."' LEFT JOIN bins WHERE bins.id = clips.bin_id"; $result = mysql_query($query); if(!$result) { //No results found code here }else{ $data = mysql_fetch_assoc($result); $user_id = $data['user_id']; Untested, but something like that should get you started
  11. http://en.wikipedia.org/wiki/Access_control_list
  12. Create a login script, use sessions to remember the person that is logged in and use access control to [dis]allow people access to the profiles
  13. Two options. Either via the DOM http://www.jaygilford.com/php/php-dom-get-all-pagelinks/ or using regex http://www.jaygilford.com/php/common-questions/how-to-get-all-links-from-a-web-page/
  14. In that case, use something like pastebin.org and post the link
  15. JAY6390

    PayPal

    Try with {$currency_iso_GBP} as just GBP
  16. echo '<table><tr>'; foreach($answers as $value){ if (in_array($value, $wrong)){ $class = "wrong"; } else { $class = "correct"; } echo "<td class=\"$class\">$value</td>"; } echo '</tr></table>';
  17. I don't think it's actually possible to do this unless you have the values within a node
  18. Use MySQL's built in date formatter //build query $query = "SELECT DATE_FORMAT(`date_entered`, '%D %M %Y) as `formatted_date` FROM table WHERE field1='xxx' AND field2='yyy'"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $row['formatted_date']; } EDIT: Cags beat me to it
  19. ah oops, total screw up on my part, it is still too early to think Try this $variable = "a bunch of stuff that [rofl]that isn't here[/rofl]or is it?"; preg_match('%\[rofl\](.*?)\[/rofl\]%i', $variable, $out); $variable = str_replace($out[0], '', $variable); $variable2 = $out[1]; echo $variable.'<br />'.$variable2;
×
×
  • 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.