
lipun4u
Members-
Posts
27 -
Joined
-
Last visited
Never
Everything posted by lipun4u
-
I have been trying to implement a captcha in php... here is the code.. <?php // Set the content-type header('Content-type: image/png'); // Create the image $im = imagecreatetruecolor(400, 30); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); // The text to draw $text = 'Testing...'; // Replace path by your own font path $font = 'arial.ttf'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); // Add the text imagettftext($im, 20, 0, 10, 20, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?> But in the browser, it gives the following error... Somebody tell me the reason and how to fix this ..
-
Can somebody give me a link for any RSS related PHP library ??
-
that will be time consuming. it returns 1062 error code(in my case....) is this the universal error code for duplicate record insertion ??
-
In my database, after insertion of records, I want to know if the record inserted is duplicate or not. How can I do this ??
-
Give me some minutes...to make a strip-down-version as it contains some legacy code...
-
That's the problem, I also don't see any '<'. Before this, I am also including 2 include_once(), will this affect the line number ???
-
the required function is defined... <?php function array_key_exists_r($keys, $search_r) { $keys_r = split('\|',$keys); foreach($keys_r as $key) if(!array_key_exists($key,$search_r)) return false; return true; } ?>
-
the error is... Parse error: syntax error, unexpected '<' in F:\Program Files\Apache Software Foundation\Apache2.2\htdocs\submit.php on line 44 line 44 is $_SESSION['user_id']=$row[0];
-
What is the error in the below code ??? <?php if(array_key_exists_r('email|password', $_POST)) { include_once('database.php'); $sql = "SELECT user_id FROM login WHERE user_name = '" . trim($_POST['email']) . "' AND password='" . trim($_POST['password']) . "')"; $result = mysql_query($sql); print_r($result); if (mysql_num_rows($result)>0){ $row = mysql_fetch_row($result); session_start(); $_SESSION['user_id']=$row[0]; $_SESSION['user_name']=trim($_POST['email']); } } ?>
-
how much u suggest to keep the length ???
-
My version is... mysql> select version(); +------------------+ | version() | +------------------+ | 5.1.32-community | +------------------+ 1 row in set (0.02 sec) mysql> If I remove the primary key and not null, everything is fine. What should I do ??
-
I have arequirement that a table has to contain 3 columns, user_id, url and name. I want to make the url primary key. Go throw the following sql query. mysql> CREATE TABLE blog_details ( -> user_id INT(11), -> blogname VARCHAR(1024), -> blogurl VARCHAR(1024) NOT NULL, -> PRIMARY KEY(blogurl), -> FOREIGN KEY (user_id) REFERENCES login(user_id) -> ON DELETE CASCADE -> ); ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes How can I fix the above error ???
-
thank you buddy
-
I want to make a dropdown list in php which will contain the names of all countries. Please help me..
-
I know the fundamentals and also can code. But the problem is that If I write the code it won't nice and attracting.... So I need some IDE ??
-
u need check if the variables are set or not <?php echo isset($name); ?>
-
Can anyone suggest me how to design web pages(HTML and JavaScript) ?? I have used Dream Weaver and Microsoft Visual Web Developer. I don't find this useful ..
-
This function calculates all enum variables in a table <?php include("database.php"); function getEnumValues($table, $field) { $enum_array = array(); $query = 'SHOW COLUMNS FROM `' . $table . '` LIKE "' . $field . '"'; $result = mysql_query($query); $row = mysql_fetch_row($result); $data =$row[1]; preg_match_all('/\'(.*?)\'/', $data, $enum_array); print_r($enum_array); } getEnumVAlues('shirt', 'style'); ?> the structure of the shirt table is mysql> show columns from shirt; +-------+---------------------------------------------+------+-----+---------+-- --------------+ | Field | Type | Null | Key | Default | E xtra | +-------+---------------------------------------------+------+-----+---------+-- --------------+ | id | smallint(5) unsigned | NO | PRI | NULL | a uto_increment | | style | enum('t-shirt','polo','dress') | NO | | NULL | | | color | enum('red','blue','orange','white','black') | NO | | NULL | | | owner | smallint(5) unsigned | NO | | NULL | | +-------+---------------------------------------------+------+-----+---------+-- --------------+ 4 rows in set (0.03 sec) Why the op array has two sub array with enum elements on each array ?? <body> Array ( [0] => Array ( [0] => 't-shirt' [1] => 'polo' [2] => 'dress' ) [1] => Array ( [0] => t-shirt [1] => polo [2] => dress ) ) </body> </html>
-
preg_match_all('/\'(.*?)\'/', $row[1], $enum_array); what does it mean by the above pattern ???
-
Using PHP To Get A Site title and meta description from a url
lipun4u replied to Brandon_R's topic in PHP Coding Help
<?php function getMetaDescription($content) { $metaDescription = false; $metaDescriptionPatterns = array("/]*>/Ui", "/]*>/Ui"); foreach ($metaDescriptionPatterns as $pattern) { if (preg_match($pattern, $content, $match)) $metaDescription = $match[1]; break; } return $metaDescription; } ?> -
why this code gives me error ?? <?php //header("Content-Type: Text/plain"); $name="asit" print_r(explode(" ", "$name is an asshole")); ?>
-
just killing time... thanx for ur suggestion.. the correct code is <?php header("Content_Type: Text/plain"); function user_array_chunk($arr, $size) { $arrs = array(); $k = -1; $i = 0; foreach($arr as $ar1) { if(($i % $size) == 0) { $k ++; $j = 0; $arrs[$k] = array(); } $arrs[$k][$j++]= $ar1; $i ++; } return $arrs; } $input_array = array('a', 'b', 'c', 'd', 'e'); print_r(user_array_chunk($input_array, 2)); ?>
-
I had written a user defined array_chunk() in php.... <?php header("Content_Type: Text/plain"); function user_array_chunk($arr, $size) { $arrs = array(); $k = -1; $i = 0; foreach($arr as $ar1) { if(($i % $size) == 0) { $k ++; $j = 0; $arrs[k] = array(); } $arrs[k][j++]= $ar1; } return $arrs; } $input_array = array('a', 'b', 'c', 'd', 'e'); print_r(user_array_chunk($input_array, 2)); ?> Why it shows errors ??
-
go throw this link http://kodeyard.blogspot.com/2009/10/session-php.html
-
$message = (isset($_GET['test']) ? $_GET['test'] : '');