php

Convert PHP encryption code to C#

Hi, I'm trying to convert this piece of code from PHP to C#. It's part of a Captive Portal. Could somebody explain what it does? $hexchal = pack ("H32", $challenge); if ($uamsecret) { $newchal = pack ("H*", md5($hexchal . $uamsecret)); } else { $newchal = $hexchal; } $response = md5("\0" . $password . $newchal); $new...

how to call to controller function when user selected a value in drop down list?

how can i create a drop down list with action which allow me link to other page? i using cakephp to doing a system, which i wanna have a drop down list to let user select. when user selected the value, i wanted to call a function in controller.. izit available that i can using a $form->input to perform this?? how can i call a function ...

PHP on IIS 5.1 is not working

I know this has been asked a few times here. But none of the suggestions or answers related to PHP on IIS have helped. I have tried installing PHP ON IIS 5.1 (XP SP 3) on two computers and it still doesn't work. I've even began to think that all of the articles and installers for PHP on IIS are a huge prank...and that PHP on IIS doesn't...

PHP watermarking

i am using this code to create watermark. $image = '1.jpg'; $overlay = 'stamp.png'; $opacity = "20"; if (!file_exists($image)) { die("Image does not exist."); } // Set offset from bottom-right corner $w_offset = 0; $h_offset = 100; $extension = strtolower(substr($image, strrpos($image, ".") + 1)); // Load image from file ...

PHP drop down menu help needed

Hi, Need help with my simple PHP menu. I'd like to have something like that: when child elements < 6 display one column if > 6 display two columns. Any advices how to make it? Regards ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do conditionals like: if($result["Users"]["is_login"]) the conditions are always false. Then i tried doing this: $result["Users"]["is_login"] = "...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 pixels how can i do that. any help? ...

how to use curl to post message to a facebook business page?

I wonder there is a way to post a message to a facebook business page with cURL? thanks ...

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need help knowing which of these would be the best to attempt to use when trying to get the UTC offset from the user on register. One: <option v...

Zend Framework: Authentication, MySQL errors when switching from SQLite

I'm switching my app from using SQLite to MySQL. It works with SQLite and it's not working now that I've changed it to use MySQL. Here's the error message I'm getting: Message: SQLSTATE[HY000] [2000] mysqlnd cannot connect to MySQL 4.1+ using old authentication What does this mean? Note: I'm running this locally running Snow Leopard,...

Validating $_GET

Hello, How do i validate $_GET thats the number coming from correct source. My url look like : index.php?page=items&catID=5 When users put something like 3 which is doesn't exist on catID. I want it to display error message. $catID = intval($_GET["catID"]); if($catID) { $checkSQL = mysql_query("SELECT * FROM category WHERE cate...

How to Improve image quality when resized as a thumbnail using PHP?

I found this script online that creates a thumbnail out of a image but the thumbnail image is created with poor quality how can I improve the quality of the image. And is there a better way to create thumbnails if so can you point me to a tutorial on how to create thumbnails using PHP. Here is the code below. <?php function createThum...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die('unable to connect' . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = date('d/m/Y h:i:s a', time()); echo date("d/m/Y h:i:s a", time()); */ date_default_timezone_set ("Asia/Calcutta"); $cd=date("d/m/Y"); echo $cd;...

Brute-force/DoS prevention in PHP

I am trying to write a script to prevent brute-force login attempts in a website I'm building. The logic goes something like this: User sends login information. Check if username and password is correct If Yes, let them in. If No, record a failed attempt in the database. Check if there's too many fails within a given timeframe (eg: 5 ...

How to Add URL Suffix

Hello Guys, I just want to ask that how do i add html suffix to each url of my site using htaccess? A url like this: www.mysite.com/index.php?hello/world should become www.mysite.com/index.php?hello/world.html ...

Zend: How to insert NULL values into MySQL

I am using Zend Framework with MySQL,Apache and Ubuntu 9.04. I am trying to insert NULL values into database like this: $personObj->setPersonId( '1' ); $personObj->setPersonEmail('NULL'); $personObj->save(); But 'NULL' is stored in database as string and not NULL. When I use this: $personObj->setPersonId( '1' ); $personObj->setPers...

[PHP]: Connection variable in a class generates error while closing connection.

Below is my DB connection class. The problem is that when I try to access the CloseConnection function from my code, it gives error: "Unknown MySQL localhost". I use "dbconnection::CloseConnection" through my other code files. It is successfully opening the connection, but giving error in "$conn". final class dbconnection { privat...

How to get the images aspect ratio using PHP?

I was wondering if a user uploads an image how can I get the aspect ratio of that image when creating the thumb. I know my width will be 180px but how can I get the height. Here is the code I got so far listed below. list($width, $height) = getimagesize($file) ; if ($width >= 180){ $modwidth = 180; $modheight = ; } else { $modwidth...

Using mysql_query and mysql_fetch_array

I am trying to find out which is the proper way to fetch data from my database. Either way works, but what's the difference; an in-depth explanation? $sql = mysql_query("SELECT * FROM _$setprofile"); while($row = mysql_fetch_array($sql)) { $username = $row['user']; $password = $row['pass']; echo "$username:$password"; } ve...

Joomla module works locally but displays nothing when hosted

Hello, I am new to joomla and I need to work on a joomla website for a school project. I modified an existing module to make it display featured projects and it does that flawlessly when I test the site locally. However, when I uploaded my files to the hosted copy of the website, the module will load but does not display anything. It jus...