php

echo javascript with single quotes

hello i got this thing <? if (mysql_num_rows($say) == 1) { $a = "cicişsin!"; } elseif (mysql_num_rows($say) == 0) { $a = "<a href='javascript:LaunchPopup('a2.php','250','1');'>ciciş yap</a>"; } ?> but i cant echo second $a.. its exits at "javascript:LaunchPopup(" single quotes not shown what can i do? ...

Handling JSON repsonse

I'm doing an AJAX call using jQuery's JSON feature. function get_words_json(address, username, paging_value) { $.ajax({ type: "GET", url: "json/" + address, dataType: "json", data: "username=" + username + "&paging_no_st=" + paging_value, success: function(json){ pop_word_list(json, paging_value); } }); } As you can ...

how can i set custom message to sql query for this script

got this: if (mysql_num_rows($ak) == 0) { $sonuc = mysql_query($sql) or die(mysql_error()); } elseif (mysql_num_rows($ak) == 1) { $sonuc = "you already added"; } this script works succesfully. but mysql_query($sql) echos "1" how can let it echo "successfully added." thanks... (im asking simple questions because im new to php)...

PHP: get the browser name

How do I get the browser name using PHP? I thought this would be straightforward? All I need to do is differentiate between IE and Firefox. ...

How to upload .mp3 files with PHP?

<form enctype="multipart/form-data"> <input type="file" name="mp3" /> <input type="submit" /> </form> I tried the above,and found var_dump($_FILES); is always empty. It only works when you upload text files or images. UPDATE I added method="POST" and it works.Why is POST necessary here? ...

MySQL: Random pick that lasts for a specific period of time?

Okay... I'm lost (again). How can I make a custom seed for rand() that will keep the pick from the database for a specific period of time: 10 minutes, 1 hours, 1 day, etc. I use this: $query = 'SELECT * FROM table order by rand () LIMIT 1'; To get a random pick every time I refresh the page. I've been reading for days, but I just can...

How would you model this application?

I've got an MVC application written with Zend Framework that pulls data from an Oracle 10g database and displays this data in Tables and Lists and visually enriches this data through colors and charts. There is no ORM and no Create, Update or Delete involved, just pure Reading. The data is inserted from another application. The data in t...

Is there a sqlite entension for PHP in RedHat Enterprise Linux 5?

Hi, I'm trying to use some off-the-shelf PHP code in RHEL5 which requires the sqlite package (not the PDO one) but it appears this is not included in the base php5.1.6 rpm bundled with RHEL5. Unfortunately, due to circumstances beyond my control, I don't have access to the installation media or RHN access (don't ask). There doesn't app...

How do I factorize a parameters repeats several times in my class?

Hello, I show you firsly my class : as you can see I repeated several times $versionId param because all the method needs it. I am asking myself if there is a way to factorize it so there is lesser repetition. <?php class Admin_Model_Version { private $_db; private $_versionId; private $_path; public function __construct() {...

Dataexchange between C# Server (Not Webserver) and PHP

Hello, i have a continously running Serverprogram (C#/.NET 2.0 on Linux with mono) and i want to connect to it from a PHP Script to display status informations on a WebSite. The purpose is to create a (sort-of) Realtime Browsergame (No Flash, no Silverlight) and i want to use the PHP Script to get the necessary informations from the C# ...

php_ldap over ssl difficulties

I am trying to bind to AD with php_ldap (using ADLdap), from a Ubuntu (hardy 8.04LTS) host. Binding on port 389 is fine to ldap://myserver, but does not allow me to do things like set password, so I need to bind on port 636 to ldaps://myserver. I am aware that some form of credential passing occurs, perhaps with certificates, but I am r...

Web Form Builder Tutorial

I would like to have a go at building a 'Wufoo' type form builder. I have seen a few, and understand the logic behind creating it with the aid of javascript. However saving those form preferences for a returning user seems more complex for me, I was wondering if anywone has seen any examples/turorials of this? Thanks. ...

PHP, LDAPS, APache and Multiple Server Certs

OK, ladies and gentlemen. If you could just read the whole thing before asking "Why would you want to do that!?!", I'd be much obliged ;) I am writing a PHP script to pull information from an LDAP server over LDAPS. I am using PHP 5.3, OpenLDAP and OpenSSL 0.9.7l (28 Sep 2006) and Apache 2.2 on a Windows 2003 server. I have one instanc...

reading binary code of a file...in PHP

How can I read the binary code(to get the 1s and 0s) of a file. $filename = "something.mp3"; $handle = fopen($filename, "rb"); $contents = fread($handle, filesize($filename)); fclose($handle); I tried this but it shows some strange characters... i presume that this is the formated binary...? I was hoping to get the 1's and 0's instead...

Show Content Only to Users in a Geo Location

I would like to show a sidebar advert to users only in a specific location (San Francisco). Would I sniff their IP, then if it fits in the San Fran IP area create an If/Else to show. If the IP != San Fran IP location then don't show? Or do I not use IP to track their location these days? ...

Is there a limit of Events I can enter with the google calendar data api?

Hi Guys, I' running a php script to insert events that I take from a CSV file. The events are entering successfully in my calendar, but it stops after about 75 events entered. Any idea if it's limited to a certain amount of events or it's a problem in my code. Thanks in advance for helping me! $event->title = $service->newTitle($t...

Cookie and session help

I have never wanted to allow a user to stay logged in for any length of time so I never saw a use for a "remember me" feature. I started thinking about how it's done though and would like some clarification. I'm currently storing my sessions in a database. What has always perplexed me was how, even though I do not explicitly set a cooki...

Best way to check an array value with for statement

Hi, I'd like to check if there is a value on an array like this: function check_value_new ($list, $message) { foreach ($list as $current) { if ($current == $message) return true; } return false; } function check_value_old ($list, $message) { for ($i = 0; $i < count ($status_list); $i ++) { if ($status_li...

Apache fails when I pass an URL as an argument

Hey everybody, Im really confused about this problem. Ill try to describe it: The problem is: http://mydomain.com/somedir/somephp.php?arg1=value&amp;arg2=http://otherdomain.com&amp;arg3=http://othertoo.com/somepath/something... totally fails. With and without url encode. My site reads in everything after mydomain.com/everything, except...

PHP - reduce multiple slashes to single slash

Hi, I have a regular expression that I use to reduce multiple slashes to single slashes. The purpose is to read a url that is previously converted to a human readable link using mod_rewrite in apache, like this : http://www.website.com/about/me This works : $uri = 'about//me'; $uri = preg_replace('#//+#', '/', $uri); echo $uri; // e...