php

How do I add css to be loaded last in drupal?

drupal_add_css('override/files/style.css'); This kind of statement can't ensure the css is loaded last, how can I do the trick? ...

How do I know if an input sting is a method name of a specific class?

Inside an object, I get a string and I have to know if there is a method with the same name in the current object I am in. How do I do that? ...

profiling php inline

I'm looking for a solution to profile my php scripts within the browser (rather than having to use *cachegrind) I saw this a while ago http://particletree.com/features/php-quick-profiler/, but i have no idea how good it is (or accurate) tips/advice appreciated ...

how i can make login with face book

how i can make login with face book i want an php code or class let me making that ...

Fastest way to check for value existance.

I have a list of values I have to check my input against it for existence. What is the faster way? This is really out of curiosity on how the internals work, not any stuff about premature optimization etc... 1. $x=array('v'=>'','c'=>'','w'=>); .. .. array_key_exists($input,$x); 2. $x=array('v','c','w'); .. .. in_array($input,$x);...

Protect my PHP App

Hello all, I have developed an app and its written in PHP (with a bunch of SQL scripts), this app will be used by a few small companies. For them to use it, I will have to install Apache and SQL Server for them. Every method I have thought has fallen short of what I need. I was actually just hoping to use ZendGuard or IonCube but they ...

How do I get all the ids of the row created by one multiple row insert statement.

Hi All. I'm new to php. So, please forgive me if this seems like a dumb question. Say i have a MySQL insert statement insert into table (a,b) values (1,2),(3,4),(5,6). table 'table' has a auto increment field called 'id'. how can I retrieve all the ids created by the insert statement above? It will be great if i get an example that u...

Access PHP var from external javascript file

I can access a PHP var with Javascript like this: <?php $fruit = "apple"; $color = "red"; ?> <script type="text/javascript"> alert("fruit: " + "<?php echo $fruit; ?>"); // or shortcut "<?= $fruit ?>" </script> But what if I want to use an external JS file: <script type="text/javascript" src="externaljs.js"></script> ex...

Regex for matching words, even though they might be words apart

So for the string: A large chicken, either thighs or breasts I need a regex to match the term "chicken breast" So it would be something like /chicken(.*?)breast/ would it not? Thanks. ...

Regular Expression to find the job id in a string

Hi all, Please could someone help me, i will be forever appreciative. I'm trying to create a regular expression which will extract 797 from "Your job 797 ("job_name") has been submitted" or "Your Job 9212 ("another_job_name") has been submitted" etc. Any ideas? Thanks guys! ...

Are Symphony and CakePHP too slow to be usable?

Until now, I have always said that CakePHP is too bloated and slow. I don't really know that, I just saw "some" benchmarks. What I really want to know, is that if those two frameworks (Symfony and CakePHP) are too slow to be usable in a way that the user will get frustrated. I already know that those frameworks are slower than other alte...

How to Manage Sessions with ajax

Which are the common scenarios where both can not use together ? ...

Directory of "index.html" on site

I wonder if the index.html MUST be in the "www" folder on the server after uploading the site? This because I have actually made everything in a folder called "SV", so my site is located in : "www/SV/index.html" My Q is, on the server, could I just create a folder named "SV" under "www" and expect index.html to be automatically display...

PHP memcached: getDelayed & getMulti - how to use?

Hi everybody, I have thought a bit recently about how to use getDelayed and getMulti in a PHP application, and their difference. From reading the documentation about getDelayed: "The method does not wait for response and returns right away. When you are ready to collect the items, call either Memcached::fetch or Memcached:...

jQuery ajax delete script not actually deleting.

I have a little personal webapp that I'm working on. I have a link that, when clicked, is supposed to make an ajax call to a php that is supposed to delete that info from a database. For some unknown reason, it won't actually delete the row from the database. I've tried everything I know, but still nothing. I'm sure it's something incred...

change document root

I have apache2 and need to change the document root folder from: /var/www/ to /var/www/SV/ Now, I have checked the httpd.conf file, but it is empty, so I read someplace that all info is nowdays placed into apache.conf. However, I cant find any "DocumentRoot" line in that file. Should I add that line? Thanks ...

how can i embed php chart graphs into html

i'm using PHP Graph Lib PHPGraphLib i created some graphs , and all i need is to embed these graphs into html,, you know, inside and so on,, every time i put the code within html it gives me errors The image “http://localhost/chart2.php” cannot be displayed, because it contains errors. although without the html code , it works f...

Partial PHP code refresh

Is it possible to refresh only the part of the page? How? the part: if (checkExpiry($member->expires)==true) { print timeLeft($leftts); } else { print "expired"; } I have table which is showing name, email, time until membership ends and I need to refresh 'time until membership ends' every second. ...

Cakephp - how to encrypt and then decrypt data that is being stored and retrieved from the database.

Err.... like the question says. How do I go about encrypting and then decrypting data that is being stored and retrieved from the database. By the way it's not just for storing a password which has been md5ed, I need to retrieve the data too. Thanks! ...

Saving variables (not sessions)

This may be a silly question, but how do I save variables that are not specific to a particular session. An simple example of why you might want to do this would be a visitor counter - a number that increases by one each time someone visits a web page (note - I'm not actually doing that, my application is different, but that is the funct...