php

PHP mailer multiple address

Here is my code. require('class.phpmailer.php'); $mail = new PHPMailer(); $email = '[email protected], [email protected], [email protected]'; $sendmail = "$email"; $mail->AddAddress($sendmail,"Subject"); $mail->Subject = "Subject"; $mail->Body = $content; if(!$mail->Send()) { # sending mail failed $m...

how to validate joomla default text editor?

Hello, i m using joomla default editor for a form and jquery validator plugin, now i want to validate that joomla text editor should not be blank.... how do i validate that?? i read an article regarding validation for tinymce, i want similar to this post although if i click on toggle editor than validation works( coz it turn ...

How to integrate a chat application with other service like GTalk or Yahoo?

I have created a chat application using PHP, but it works only into my site(like the user need come to my site and chat..), i want that user can chat with me through any chat server like Gtalk,yahoo, or MSN. How can it be done?? ...

reference variable array

Hi, i used always $text = $datasql[0]; where $datasql = array('0'=>array('some'=>'text', 'some2'=>'text2'), '1'=>$data, etc...); and found work costruction $datasql = &$datasql[0]; and work, why? That really reference?? and how remeber php in memory this solution. Thanks for reaply ...

How long do I need to maintain old URLs?

Ok, I know it is best practice that once you change or remove a page URL, to redirect that url to the new relevant URL. But for how long? forever? For example, I am using Google website optimizer to test different variations of a page. So I have to create a different url for each like: original.php, var1.php, var2.php, etc. once the t...

PHP - Strings - Remove a HTML tag with a specific class, including its contents

I have a string like this: <div class="container"> <h3 class="hdr"> Text </h3> <div class="main"> text <h3> text... </h3> .... </div> </div> how do I remove the H3 tag with the .hdr class using as little code as possible ? ...

PHP Excel Output for IE gives empty file.

Hi all, I am trying to generate an excel file with php. This works fine in Firefox but with IE I am only getting an empty file. This is what I am doing basically: header('Content-type: application/ms-excel'); header('Content-Disposition: inline; attachment; filename='.$filename); echo $data; I have tried various header settings but ...

Space between two words are getting lost after assigning php variable to javascript variable

Hi All, I have created two simple files in php. first file (i.e. input.php ): Created one form having one textbox and one submit button I have one textbox, user will add input in this textbox One submit button, after clicking on this form will get submit ( used post method ) Second file (process.php) : Posted contents are receive...

MySQL: How to get a sequential number with rows?

How can I number my results where the lowest ID is #1 and the highest ID is the #numberOfResults Example: If I have a table with only 3 rows in it. whose ID's are 24, 87, 112 it would pull like this: ID 24 87 112 Num 1 2 3 The reason why I want this, is my manager wants items to be numbered like item1, item2, etc. I initially ...

Compare text strings to see if they match (allow slight differences)

I'm trying to compare data from two sources. ORIG Kick-Ass: Music From The Motion Picture ALT Kick-A*s (Music from the Motion Picture) ALT Kick-Ass: (Music from the Motion Picture)[Explicit] ALT Kick-Ass: A dedication ALT 1 ALT 2 and ORIG are the same match. ALT 3 is a dummy result. I need to verify that these have a match, is there ...

php - substring from end of text

I am looking to get the substring from the end of a line of text, say $text = "bob/hello/myfile.zip"; I want to be able to obtain the file name, which i guess would involve getting everything after the last slash as a substring, can anyone help me how to do this is PHP? A simple function like $fileName = getFileName($text); ...

Obfuscate javascript with inline PHP?

I'm searching for a javascript obfuscator. Though I've found many obfuscators, no one so far seems to be able to handle (ie ignore) inline php code. Example of what I mean by inline php code: var my_javascript_variable = <?php echo $my_php_variable; ?>; Is this possible to obuscate, and if so, does anyone know of such a tool? ...

CodeIgniter: Encrypt communication between app and mysql db on different servers ?

Can anyone tell me the best way to encrypt data between a CI application and a MySQL db hosted on separate servers. SSH tunnel? If so, has anyone gotten this working using CI? Code examples and/or links are welcome. ...

An image link won't work on codeigniter

Can anybody explain to me why this won't work on CodeIgniter? .linkBack{ background-image:url('/myBlog/CodeIgniter_1.7.2/pictures/arrow.gif'); display:block; height:58px; width:105px; text-indent:-999px; } <div class="linkBack"><?=anchor('myBlog', 'Back to Blog');?></div> while this would work perfectly: #linkBack { backgr...

Character encoding problem from Facebook JSON to HTML via PHP

I'm getting a JSON encoded array from Facebook which contains: [{"message":"D\u011bkujeme Zuzana Boh\u00e1\u010dov\u00e1 za na\u0161i novou profilovou fotku :-)\nWe thank Zuzana Boh\u00e1\u010dov\u00e1 for our new profile picture :-)"}] When I decode the JSON and output the contents I get: DÄ›kujeme Zuzana BoháÄová za...

trying to show definitions for words that are in a glossary

Hi, I'm trying to use regex to parse some plain text and add a definition from a glossary to any words that match it. I'm doing it like this: for ( $i = 0; $i < count($terms); $i++ ) { $search = '|(?<=\b)('.preg_quote($terms[$i]['title']).')(?=\b)|i'; $replace = '<a class="tt2" rel="tooltip" title="'.$terms[$i]['pageBody'].'">...

Getting Textmate to create PHP autoload class name from filepath

What I would like is a snippet that when executed, grabs the TM_FILEPATH output Explodes it on the slash / Then split out each part as a placeholder containing that part and an underscore (apart from the last part (the filename)) For Example: for a file in directory path /Path/To/Original/file we would get class ${1:Path_}${2:To_}${3:Or...

Can multiple independent $_SESSIONs be used in a single PHP script?

I want to use two independent $_SESSIONs in a single PHP script. I have attempted to verify that this is possible using the following code. error_reporting(E_ALL ^ E_STRICT); session_name('session_one'); session_start(); $_SESSION = array(); $_SESSION['session_one_var'] = 'test_one'; $output1 = ( "session_id(): '" . session_id() ....

Is (int) and is_int() secure to protect against SQL injections?

So I was wondering is this enough to be safe that user won't do any SQL injections and the number will be only and always integer? The $id in getArticle function is binded to SQL query. <?php $id = (isset($_GET['id']) && is_int((int)$_GET['id'])) ? (int)$_GET['id'] : false ?> <?php $news = $class->getArticle($id) ?> As far I tested it...

FILTER_SANITIZE_SPECIAL_CHARS problem with line breaks

Hello, Does anybody know how to prevent FILTER_SANITIZE_SPECIAL_CHARS from converting the line breaks ( \n ) into ( ; ). I'm developing a simple commenting system for my website and I found that the php filter converts \n to so when using nl2br() there are no line breaks. help please. thanks :) ...