Jump to content

Username:

Members
  • Posts

    155
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://testchan.org

Profile Information

  • Gender
    Male
  • Location
    The Future

Username:'s Achievements

Member

Member (2/5)

0

Reputation

  1. It will be for an imageboard type-thinger. I need to have post numbers, or maybe I don't, I don't know yet.
  2. Didn't edit in time, my apologies. My current structure looks like this: thread -> ---name var(32) ---subject var(128) ---email var(128) ---message longtext(2000) ---last int(11) ---password varchar(128) ---id int(11) <- this is what I need to auto-increment reply -> ---name var(32) ---subject var(128) ---email var(128) ---message longtext(2000) ---password varchar(128) ---id int(11) <- this is what I need to auto-increment I need "id" to be unique over both tables (reply & thread) and consecutive (in thread you'll see 11, and in reply you'll see 12, assuming they were both posted consecutively after eachother)
  3. Is this possible? I want ids to auto-increment over two tables.
  4. Well, it's gonna be a rather large code, so it has to be in a seperate file now anyway haha. http://pictureunrelated.com/screengrabbr/2.30.55-AM_2011-11-29.png It works alright I guess. It's really slow after about "Hello PHPFrea"
  5. <script> $('#canvas').mousedown(function(e){ alert("test"); }); </script> <canvas class="canvas" id="canvas" width="500" height="300" style="border: solid 1px"></canvas> I'm almost positive there's nothing wrong This is killing meeeeee, please help
  6. I don't believe in censorship myself, but the script I'm making it for, the user wants a censor! I am aware that filters could easily be bypassed, but simply allowing only alphanumeric letters should do the trick, right? The users should theoretically be English only. I have tried using the one-or-more blabbity blah, but this allows anyone to simply write "f.uck"
  7. I'm currently making some regular expressions for a word filter Now, if the user enters for example: f**k It would censor to **** and if he enters f**************************************kkkkkkkkkkkkkkkkkkkkkkkkkkkk it would censor to *************************************************************** Now, if the user enters: f * * k it won't censor. My current code (I apologize for the swearing, I just wanted you to see what I see): public static function wordFilter($text) { $filter_terms = array('s+h+i+t(|ting|er|e|ing|s)\b','f+u+c+k(|ing|ed|s|er)','a+s+s(|hole)\b','c+u+n+t', 'p+u+s+s+y', 'n+i+g+g+e+r', 'f+a+g(|got)'); $filtered_text = $text; foreach($filter_terms as $word) { $match_count = preg_match_all('/' . $word . '/i', $text, $matches); for($i = 0; $i < $match_count; $i++) { $bwstr = trim($matches[0][$i]); $filtered_text = preg_replace('/' . $bwstr . '/', str_repeat("*", strlen($bwstr)), $filtered_text); } } return $filtered_text; } A) Yes I am aware that is not a good way to filter words B) Could someone point me in the better direction? Thanks in advance If you need anymore details just ask.
  8. function insertDATA($postData) { if(!ifEmailExists($postData['email'])){ $sql = " INSERT INTO tbl SET email = '".$postData['email']."', name = '".$postData['name']."', phone = '".$postData['phone']."' "; echo "data submitted successfully!";//this line withing the form $res = executeSql($sql); if($res) { echo "<img src='path/to/image.jpg'></img."; } else { die(mysql_error()); } } I don't know if that will work, since you never told us how executeSql works, and you'll have to have the link for the image in the img tag.
  9. This code runs fine on my server. <?php $title = "Home"; $username = "user"; if(file_exists("styles/top.php")) { require("styles/top.php"); } else { echo "styles/top.php is missing"; } if (isset($username) && strlen(trim($username)) >= 1) { echo "<br>Welcome $username!"; echo " <table> </div> </td> </tr> <tr> <td width='244' valign='top'><br /> <form id='form1' name='form1' method='post' action='search_results.php' style='margin-left:20px;'> <input name='var' type='text' class='size12' id='var' style='width:124px; background-color: #A4D1FF;' /> <input name='button' type='submit' class='size11' id='button' value='Search' /> </form> <br /> <div id='leftNav' style='margin-left:22px;'> <!-- Start tv --> <strong> <font color='#FFFFFF'><span class='size16'>TV</span></font></strong><br /> <a href='tv.php?c=tv&sc=cartoons'>Cartoons <font size='-3' color='#FFFFFF'></font></a><br /><a href='tv.php?c=tv&sc=news'>News <font size='-3' color='#FFFFFF'></font></a><br /><a href='tv.php?c=tv&sc=adventures'>Adventures <font size='-3' color='#FFFFFF'></font></a><br /><a href='tv.php?c=tv&sc=horror'>Horror<font size='-3' color='#FFFFFF'></font></a><br /><a href='tv.php?c=tv&sc=Drama'>Drama<font size='-3' color='#FFFFFF'></font></a><br><br /> <!-- End TV --> <!-- Start Videos --> <strong> <font color='#FFFFFF'><span class='size16'>Videos</span></font></strong><br /> <a href='videos.php?c=videoss&sc=children'>Children <font size='-3' color='#FFFFFF'></font></a><br /><a href='videos.php?c=videos&sc=music'>Music<font size='-3' color='#FFFFFF'></font></a><br /><a href='videos.php?c=videos&sc=comedy'>Comedy<font size='-3' color='#FFFFFF'></font></a><br /><a href='videos.php?c=videos&sc=youtubemovies'>Youtube Movies <font size='-3' color='#FFFFFF'></font></a><br /><a href='videos.php?c=videos&sc=sports'>Sports <font size='-3' color='#FFFFFF'></font></a><br /> <br> <!-- End videos--> <!-- Start Movies --> <strong><font color='#FFFFFF'><span class='size16'>Movies</span></font></strong><br /> <a href='movies.php?c=movies&sc=comedy'>Comedy <font size='-3' color='#FFFFFF'></font></a><br /> <a href='movies.php?c=movies&sc=action'>Action <font size='-3' color='#FFFFFF'></font></a><br /><a href='movies.php?c=movies&sc=adventure'>Adventures <font size='-3' color='#FFFFFF'></font></a> <a href='movies.php?c=movies&sc=horror'>horror <font size='-3' color='#FFFFFF'></font></a><br /> <a href='movies.php?c=movies&sc=drama'>Drama<font size='-3' color='#FFFFFF'></font></a><br /><br /> <br /> <!-- End Movies --> </div> </table>"; } else { echo "<h2><font color='red'>You must be logged view this Part.</font></h2>"; } if(file_exists("styles/bottom.php")) { require("styles/bottom.php"); } else { echo "styles/bottom.php is missing"; } ?>
  10. :shrug: :shrug: Please help before this script drives me insane. It tries to download a skin from Minecraft. It works fine, except, if it returns an error code, (301, 302, 404), don't download, and using my image (char.png) as a replacement. I can get the error code, except, no matter how I compare it, it will a) still say it's 302 or b) not work at all. Here's my code: userskin.inc.php > <?php require('class.mineuser.php'); if(!isset($_GET['width']) || strlen(trim($_GET['width'])) == 0 || !isset($_GET['height']) || strlen(trim($_GET['height'])) == 0) { $x = 16; $y = 16; } else { $x = $_GET['width']; $y = $_GET['height']; } if(isset($_GET['refresh'])) $refresh = true; else $refresh = false; if(isset($_GET['debug'])) $debug = true; else $debug = false; $http = curl_init("http://www.minecraft.net/skin/{$_GET['user']}.png"); curl_setopt($http, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($http); $http_status = curl_getinfo($http, CURLINFO_HTTP_CODE); $resp = preg_match("/302/", $http_status, $match); $code = $match[0]; if($code == 302) { mineuser::downloadSkin($_GET['user'], $_GET['path'], $code, $refresh); mineuser::getFace($_GET['user'].".png", $x, $y, $_GET['path'], $code, $debug); } else { mineuser::getFace("char.png", $x, $y, $_GET['path'], $code, $debug); } class.mineuser.php > <?php class mineuser { public static function downloadSkin($user, $path = "", $resp, $new = false) { if($resp !== 302) { //Checks if $new is true, if it is, then delete $user.png and download a new one. if($new == true) unlink("$path/$user.png"); //Checks if the users skin already exists (faster loading time) if(!file_exists("$path/$user.png")) { $fh = fopen("$path/$user.png", "w"); $file = file("http://www.minecraft.net/skin/$user.png"); foreach($file as $char) //Since it's an array, we use a foreach loop and write each character individually fwrite($fh, $char); fclose($fh); //Close our file handler. } } else { } } //End of function downloadSkin() public static function getFace($user, $width, $height, $path, $resp, $debug = true) { $im = imagecreatetruecolor($width, $height); if($debug == false) { header("Content-type: image/png"); } if($resp === 302) { $image = imagecreatefrompng("$path/char.png"); } else { $image = imagecreatefrompng("$path/$user"); } imagecopyresampled($im, $image, 0, 0, 8, 8, $width, $height, 8, ; imagepng($im); imagedestroy($im); } //End of function getFace() } ?> please help before i go insane :-\ Thanks in advance
  11. I tried adding an alpha channel to my script, but it just made it appear worse. just read the rest of that script, I get it now $alpha = (imagecolorat($im,$x,$y) & 0x7F000000) >> 24; //DITHER! if ($alpha > 3 && ( $alpha >=127-3 || (rand(0,127))>=(127-$alpha) )){ imagesetpixel($im,$x,$y,$transparentColor); // <----------- that } edit: I added it, with no change. Did I do it wrong? <?php function imgToAscii($img, $letter) { echo " <style type='text/css'> .ascii { font-smooth:never; font-size:1px; line-height:1; letter-spacing:-1px; font:fixedsys; } </style>"; $ext = substr(strrchr($img, '.'), 1); if($ext == "jpg" || $ext == "jpeg") { $imgh = imagecreatefromjpeg($img); } elseif($ext == "png") { $imgh = imagecreatefrompng($img); } elseif($ext == "gif") { $imgh = imagecreatefromgif($img); } else { die("<font color='white'>Unknown file format!</font>"); } $trans = imagecolorallocate($imgh, 0xfe, 0x3, 0xf4 ); $w = imagesx($imgh); $h = imagesy($imgh); for($y=0; $y<$h; $y++) { for($x=0; $x<=$w; $x++){ $rgb = imagecolorat($imgh, $x, $y); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8 ) & 0xFF; $b = $rgb & 0xFF; $alpha = (imagecolorat($imgh,$x,$y) & 0x7F000000) >> 24; if ($alpha > 3 && ($alpha >=127-3 || (rand(0,127))>=(127-$alpha))){ imagesetpixel($imgh,$x,$y,$trans); } if($x == $w) { $art .= "<br>"; } else { $art .= "<span class='ascii' style='color: rgb($r, $g, $b);'>$letter</span>"; } } } return $art; } ?>
  12. Why is that? Transparency in fonts etc is supported natively by CSS. Could I just check for the color it sends out and tell it to put color: transparent; instead? Oh, and after I changed it to RGB(), transparency makes the image have a blue tint instead. And, transparency is this: color: rgb(0, 0, 251);
×
×
  • 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.