php

When I click on 'remember me' and after sign out, when I try again to login cookies are not retrieved

I have a login form in which i have a username, password and a remember me radio button option. Now I want it so that when I've signed out from home page and I try again to login then without asking for a username and password I get logged in because I am going to store the username and password values into cookie. I wrote code on passw...

models using controllers?

is it usual to use controllers in models? then you have to include the controller in the model? ...

Remove Text Between Parentheses PHP

Hi, I'm just wondering how I could remove the text between a set of parentheses and the parentheses themselves in php. Example : ABC (Test1) I would like it to delete (Test1) and only leave ABC Thanks ...

Keep or discard "www" when saving URLs?

Hello, I'm creating an application in PHP5 that needs to store a unique URL for a website. For example, if a user enters "http://www.google.com/" ill store it in the DB as "google.com" after parsing it. Basically I need a consistent convention for URLs so that there aren't multiple entries for the same site. Basically, is it ok to be ...

most efficient way to print a list of names based off a csv using php and mysql

I have an array of player's IDs. There will generally be about 5 players, not likely to be more then a dozen: $cplayers= array(1,2,5); I want to display the players names as a list. $query = "SELECT username,id FROM users ORDER BY id"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $playercoun...

How to recursively subtract from an array?

I'm pulling the url parameter and I'm trying to create a breadcrumb out of it. So, if I pull: $url = 'contact/jane/now'; and I do: $path = explode("/",$url); How can I put it in a loop so that it breaks each part into a path like this: <a href="/contact">contact</a> <a href="/contact/jane">jane</a> <a href="/contact/jane/now">now...

where do i include the super_model in an ajax call?

from javascript i request for a php file. and this php file will call a model that extends a super_model. i wonder where i should include this super_model. in the php file (which acts like a controller) or in the model? i've got other models too, should i include the super_model they all extend in the controllers that are calling them,...

javascript, php, cookies

When i declare mac = 123, my internet explorer and firefox will keep refresh non-stop. And if i declare mac = getMacAddress it returns a value 1... I'm able to do a document.write(getMacAddress()) and it would able to display the mac address nicely. 1) Why my explorer will keep refreshing non-stop when i code it manually with "123" 2)...

PHP - What encoding does mcrypt use on an encrypted string?

Using PHP I'm trying to convert the cipher text generated by mcrypt into binary but when I try and convert it back to the cipher text it doesnt get converted back properly so it cant be decrypted. I'm assuming my encodings are getting messed up somewhere but I dont know where to start to figure it out. Here is a link to the site http://d...

regular expression to validate image filename

Heya im looking to validate a string and make sure it is the following format "thumb_*.jpg|gif|png" where * is a wildcard, and jpg|gif|png are optional file extensions this is in PHP Is that possible? ps: i just want return value true or false ...

Upgrade from jQuery 1.3.2 to 1.4 sortable serialize stops working

i just upgraded from jquery 1.3.2 to 1.4 - and I found my sortables serialize not working anymore?! anyone else experience this problem? heres the code: $(document).ready(function() { $("#list_to_sort").sortable({ handle : '.handle', update : function () { var order = $('#list_to_sort').sortable('serialize'); $("upd...

Insert array in ONE field in mysql

Hello .. I want to insert an array in ONE field in mysql database using PHP .. this is work fine : HTML : anotherField :<input type="text" name="anotherField" /> fax :<input type="text" name="f[]" /> email :<input type="text" name="f[]" /> phone :<input type="text" name="f[]" /> PHP (I use CodeIgniter frame) : <?php functi...

difference between libraries and helpers in php frameworks

if i've got string functions i use a lot, should i put them in a helper class or a library class? functions like: truncate string if longer than 30 characters, return a random string, make all lower cases and so on. these are functions that i probably don't need to create an object for. it's better to use them as static methods. should...

Integrating PHP/General HTTP Request with Rails

I have a Rudy on Rails backend which I use because it has some libraries that other languages don't have. I'm trying to use it as a web service/backend and accept requests from PHP/general HTTP request pages. It should be very simple - hopefully, accept a JSON object and respond with a JSON object. Rails seems to default to a RJS/ non-st...

Find if node has siblings using simplexml

I am try to find if a certain node has siblings, and if it does, I would like to know what those siblings are. Is this possible? ...

Why won't PHP create this zip file (permissions issue)

I am on windows I am using PHING to zip up some files I have lots of things being zipped Zipping works, except for ones that include a particular phing fileset in the files being zipped When I debug, I can see in phing's ZIP Task that ZipArchive::close is returning false. The error string reads "permission denied". In the manual it stat...

How to list all table in mysql database

Hi I want to list all tables in my mysql database. I want that each table list with column name and datatype. So how could i do this, any query or something like that. Running on php Thanks Avinash ...

code for giving ratings

hi friends, I want to give some type of ratings to my posts in my site. i want to do this coding some like the below site http://www.comminit.com/en/node/222010/2754 i want to do this type of ratings in my site. Does any one have code to do this. or any one can tell from where i can download such type of codes... ...

html tags inside xml via php

I am trying to put an html string inside of xml with php like this: <?php $xml_resource = new SimpleXMLElement('stuff.xml', 0, true); $xml_resource->content = '<![CDATA[<u>111111111111111111111111111111111 text</u>]]>'; $xml_resource->asXML('stuff.xml'); ?> but for some reason my xml file looks like this: <?xml version="1.0"?> <data>...

Drupal 6 dynamic menu item

I need to create a menu item, which changes its title and link if a user has a certain condition, or not. Drupal caches all the menues, so i can't really think of a way to do that. For example, user has a node attached to his profile, menu item is "Create blabla" (link node/add/blabla) User doesn't have the node, menu item is "Create no...