-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
its the same as $_SESSION['Posted_values'] = $_POST; copies the post to a session
-
Approach to authentication when integrating an app
MadTechie replied to tlavelle's topic in PHP Coding Help
workout how the main app's authentication works then alter the attached apps authentication to suite -
[SOLVED] please can anyone see what is wrong with this
MadTechie replied to jeppers's topic in PHP Coding Help
ahh to slow.. -
have you searched this forum ?
-
persaonlly i keep away from [:alnum:] personal choice.. The ^ means starts with and the $ means ends with so the whole string is from 4 to 6 chars the /i or eregi, means case insensitive.. so only a-z needed not a-zA-z. make sense ?
-
probably the form, can you post the form for the upload and i'll take a peek
-
as for IE PNG, read this
-
i think you want this $data = "test"; if (preg_match('/^[a-z0-9]{4,6}$/i', $data)) { # Successful match } else { # Match attempt failed } or $data = "test"; if (eregi('^[a-z0-9]{4,6}$', $data)) { # Successful match } else { # Match attempt failed } $data = "test"; //works $data = "testing"; //fails $data = "tst"; //fails
-
white space (space, tab etc) (better option) if (preg_match('/\s/', $data, $regs)) { $result = $regs[0]; } echo $result; Match the ASCII or ANSI character with position 0x20 (32 decimal) in the character set if (preg_match('/\x20/', $data, $regs)) { $result = $regs[0]; } else { $result = ""; }
-
whats the "problem" maybe the freelance section ? Edit: oow was this just moved
-
erm.. no thats what isset() is for ie if( isset($_GET['page']) ) { echo $_GET['page']; } as for referances instead of passing a value to a function and then having to return it you can use a referance ie Note: the foo function is NOT returning anything, but $a still increases by 1 <?php function foo(&$var) { $var++; } $a=5; echo $a."<br>"; foo($a); echo $a."<br>"; ?> SO.. to sum up $b=100; $a = $b;//$a equals 100 $c = & $b; //$c equals $b (not 100 but whatever $b is) $b=$b+100; echo "a=$a, b=$b, c=$c"; Hope that helps
-
what do you mean 500kb.. erm.. well Microsoft have gone down hill or thats just wrong.. unless your refering to third party software (in which case wrong section)
-
No i mean that not useful infomation.. what do you mean by "but it seems to have failed." its like saying "theirs a problem"
-
before you resize (imagecopyresized) use imagealphablending($imageFile, true);
-
How To Display An Image From A MySQL Table
MadTechie replied to JustinK101's topic in PHP Coding Help
how did you get the date into the database? thats the real question, as your reverse that -
Nope, the header would be needed IF you have the php as the image but your send the image resource to the file not the screen
-
well thats as useful as it works as its be programmed to!
-
or.. foreach($_POST as $Key => $Value) { echo "Key:$Key => Value:$Value"; }
-
heres one for extraction, i broke it down to make it a little easier <?php $data ="";//the html page //get input preg_match_all('/<input ([^>]*)>/si', $data, $regs, PREG_PATTERN_ORDER); $inputs = $regs[1]; foreach($inputs as $input) { $key = "type"; if (preg_match('/type\s?=\s?(?:\'|")?(\w+)(?:\'|")?/si', $input, $regs)) { $type = $regs[1]; }else{ $type = ""; } echo "$key=$type|"; //----other key $key = "name"; if (preg_match('/type\s?=\s?(?:\'|")?(\w+)(?:\'|")?/si', $input, $regs)) { $type = $regs[1]; }else{ $type = ""; } echo "$key=$type<br />"; } ?> problem is my client was just on the phone so i have to do some paid for work.. will look at this later to night
-
try this <?php function change_pic($pic_name, $newname, $width=100, $height=100, $quality=60) { //not sure why the head as we're saving to file! //header("Content-type:image/jpeg"); $im_src = imagecreatefromjpeg($pic_name); $width_src = imagesx($im_src); $height_src = imagesy($im_src); $width_dst = $width; $height_dst = $height; $quality = $quality; //resize process $im = imagecreatetruecolor($width_dst, $height_dst); imagecopyresampled($im, $im_src, 0, 0, 0, 0, $width_dst, $height_dst, $width_src, $height_src); imagejpeg($im, $newname, $quality); imagedestroy($im_src); imagedestroy($im); } if ($fupload_type = "image/pjpeg" || $fupload_type = "image/jpeg") { copy($fupload, "./$fupload_name"); change_pic($fupload_name, "./".$fupload_name,300,300); change_pic($fupload_name, "./100".$fupload_name,100,100); } else { echo "File must be JPEG"; }?> this code will create the 300 sized image and the 100 sized one.. Note the file name of the 100 with have 100 prefixed.. as i don't know where you wanted it stored
-
$start = 150; $end = 450; $cValue = 250; $currentPercent = $cValue * ($start/ $end); Opps, didn't read the end of the question $currentPercent = $cValue * (100 / ($end - $start))
-
erm.. ok try $game_time = $row['game_time']; if(date("Y", $game_time) == 1969) { $game_time = "TBA"; } hate working with dates!
-
How To Display An Image From A MySQL Table
MadTechie replied to JustinK101's topic in PHP Coding Help
file image.php $ID = (int)$_GET['id']; //add connection string etc $sql = "SELECT myImage FROM images WHERE id = $ID"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_object($result); //for JPEG header("Content-type: image/jpeg"); imagejpeg($row->myImage) Thats the whole file! no echoing in there as it will mess it up.. in another file use <img src="/my/php/image.php?ID=12" /> as The Little Guy said hope that sums it up -
How To Display An Image From A MySQL Table
MadTechie replied to JustinK101's topic in PHP Coding Help
example $sql = "SELECT myImage FROM images WHERE id = 1"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_object($result); //for JPEG header("Content-type: image/jpeg"); imagejpeg($row->myImage) also see imagepng -
trust me you don't need to be tired to make stupid mistakes but it helps.. infact 4:30am.. i'm out too night all!