php

How to strip domain name out of a url in PHP?

parse_url($url, PHP_URL_HOST) The above will work for: sub1.domain.name, sub2.domain.name,... I want to strip the domain name only. ...

How to Facebook like newsfeed?

How can i impelement a Facebook NewsFeed like feature in my PHP based community application? For example "X user uploaded a new photo, Z attending to a event". Fetching all this data from different tables consumes too resources. Thanks. ...

how to remove index.php from url in codeigniter ?

how to remove index.php from my url in codeigniter . i remove index.php from my config file and i have run my rewrite_module in apache(2.2.11) and my .htaccess file is RewriteEngine on RewriteCond $1 !^(index\.php|images|captcha|css|js|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] now whenever i click any link it show tha...

How to remove part of a string?

How to trim a part of a string, and save it in a particular string in MySQL using PHP? Example: If a string has the value "REGISTER 11223344 here" How can I cut "11223344" from the string? ...

Help needed in changing these all Queries to dept oriented.

I am getting my deptid like this $deptid=$_SESSION['deptid']; public function setSkillMatrix($data) { //return print_r($data,true); //$ot=""; $deptid=$_SESSION['deptid']; if(!$data || !is_array($data)|| !sizeof($data)){throw new Exception("No data sent.".(is_object($data)?"y":"n"));} //throw...

Binary $_POSTed filedata gets messed up

Hi, I am currently testing out the new client side resizing of SWFupload ( http://demo.swfupload.org/v250beta2/resizedemo/index.php ) It resizes the image on the client via flash before it gets uploaded. However, it sends it as a normal POST request with the image data as a binary string / application/octet-stream. I am able to acces...

how to keep multi session live together

Thanks a lot and sorry for bothering.. I'm still a PHP rookie, I am having a few problems trying to understanding/finding out how to keep multi session live together works.. here my existing sessions e.g. session_start(); // If no session exists, create one if (!session_is_registered('lesson')) { $_SESSION['lesson'] = new lesson; } ...

Programmatically creating forms - default selected index of a select

Hi, Part of a form I've created in Drupal 6 is: $form['limiter'] = array( '#type' => 'select', '#id' => 'limiter', '#options' => array('10'=>'10','25'=>'25','50'=>'50') ); Which works fine. However how do I define the default selected index so '25' is selected when the page loads? Anything I pass to ...

I can't delete an Event Feed with Google data API

Hi Guys I'm trying to delete multiple events from the Google Calendar API (From a date range). I get the feed correctly, this is not the problem. The probleme is the delete function. I get this error : "Error: You must specify an URI to which to post." Can somebody please help me! Thank You $service = new Zend_Gdata_Calendar($clien...

PHP crypt and salt - more clarification please

I was here yesterday and got some really great answers. I took what I got and put together, what I think will be a fairly secure algorithm. I'm having a problem using blowfish with a for loop that generates the salt. I'm using base64 characters and a for loop to get a random string. I want to take this generated string and insert it int...

PHP Perform Action with Incoming Email

Hi, I'm building a photo sharing website (just testing PHP stuff) and I want users to be able to submit photographs using email. For instance, the website needs to run a script when the users sends an email with an image attachment and text in the body. The image would be uploaded to the server, and a new "photo post" would be created...

readfile/fpassthru web caching

I have noticed that files delivered by PHP through readfile or fpassthru techniques are never cached by the browser. How can I "encourage" browsers to cache items delivered via these methods? ...

How to determine the memory footprint (size) of a variable?

Is there a function in PHP (or a PHP extension) to find out how much memory a given variable uses? sizeof just tells me the number of elements/properties. EDIT: memory_get_usage helps in that it gives me the memory size used by the whole script. Is there a way to do this for a single variable? ...

What is the correct way to document PHP constants (define) with phpDocumentor

How must we document (with phpDocumentor) constants defined with define() in PHP? I found nothing in the docs, but found the following example (which I don't see it's use) in the sample2.php: /**#@+ * Constants */ /** * first constant */ define('testing', 6); /** * second constant */ define('anotherconstant', strlen('hello')); ...

Ckeditor only submits part of the content

I'm using ajax to gather the ckeditor data to be submitted. The problem is only the content before the first apostrophe is being submitted to the database. What could I be doing wrong? Edit: $date = strtotime($formData['date']); $article=mysql_real_escape_string($formData['article'],$DBconnect); $DBconnect=mysql_connect($dbVals['host...

PHP/Javascript/Jquery - Dynamic Website Diagram

I want to have an application that displays all of my website's external links and outputs a diagram. Like for example www.example.com/articles/some-title.html is linked to my homepage. Home - www.example.com/some-text - www.another-site.com/my-title - www.example.com/articles/some-title.html Products Products - www.buy-now.com/pr...

PHP Objects vs Arrays

I have a huge amount of PHP objects for a neural network for which I have to iterate over and perform some maths on. I was wondering if I would be better off using an associative array over instances of classes? I am dealing with around 3640 objects and iterating around 500 times (at best) on top of that so any micro-optimization helps ...

Programatically backing up (and emailing) a full MySQL database via PHP

I need to take a backup of a MySQL database daily, and preferably have it email itself to an email address of my choosing. Is it possible to do this? What is the SQL to generate a backup file? How can I add this file as an "attachment" to the email which is sent? Thanks for the help, I really need to make these backups! I do know how...

Undefined mysql functions using mySql5 + php5 + apache2 installed by macports under mac os x

I've installed mySql5 using macports and did manage to run the mysql server. but from some reason all mySql related functions like mysql_connect return an error message saying "a call to undefined function...." under php5. Here is partial mysqlnd section taken from the phpinfo report: mysqlnd enabled Version mysqlnd 5.0.5-dev - 081106...

parsing text for contents of database table of limited size

I have a MySQL table of "people" as part of a web site, for example: | people_id | firstname | lastname | ----------------------------------------- | 1 | John | Lennon | | 2 | Paul | McCartney | | 3 | George | Harrison | | 4 | Ringo | Starr | | . | ....