php

CodeIgniter: Weird echo of $config coming back when I load Email Library

Version info: CI version 1.7.2 - PHP 5.3.1 - Apache2 - Mac OSX 10.6.3 For some reason, when I load CI's email library, either in my controller, or in autoload.php, it automatically and immediately echoes the config info like so: $config['protocol'] = 'sendmail'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['charset'] = 'iso-8859...

codeigniter passing the same information (like login status) to all the views

I'm using DX_AUTH to handle autentication in my codeigniter app. I want to display in each page the login status, I'm used to develop my view throught template inheritance. I'm looking for a way to access login information from the views without passing it each time. ...

What is ^ mean in PHP?

i came across this line of code in an app im revising: substr($sometext1 ^ $sometext2, 0, 512); thank you ...

going to build a php MVC, what naming conventions do i need to be aware of?

I'm pretty new to OO PHP, however i get how it all works and am ready to start building an MVC for a big site i'm working on. I know it isnt necessary written that you must do it like this but there's gotta be some normal practises.... class names - camelcase? underscores? class files - same as class? url/post/get controll name - rout...

PHP String tokenizer not working correctly

I have no clue why strtok decided to break on me. Here is my code. I am tokenizing a string by dollar symbol $. echo 'Tokenizing this by $: ',$aliases,PHP_EOL; if(strlen($aliases) > 0) { //aliases check $token = strtok($aliases, '$'); while($token != NULL) { echo 'Found a token: ',$token,PHP_EOL; if(!isGo...

Learning Php MySql queries, How to show the result in PHP?

Hi, im just need the easiest way in php to navigate in this result: $datos = mysql_query("SELECT * FROM usuarios LIMIT 0, 30 "); I mean, how do i do an echo from $datos in each element of the table? Ex. Table: ID Name LastName 1 Domingo Sarmiento 2 Juan Lopez How can i read for example the second last name? ...

library classes or model classes?

i have looked into design patterns and mvc and understand the basics of it. but i don't understand if these classes that these patterns are constituted of are library classes or model classes. i'm using codeigniter and don't know if i should put the classes in models folder or libraries folder. the classes could be: observers and ob...

Send mail every n days

Hello all! I have a php script that i use to send mail to customers. How can i execute this script every 5 days for example? Can anyone give me an idea or some links? Thanks ...

curl_multi_exec stops if one url is 404, how can I change that?

Currently, my cURL multi exec stops if one url it connects to doesn't work, so a few questions: 1: Why does it stop? That doesn't make sense to me. 2: How can I make it continue? EDIT: Here is my code: $SQL = mysql_query("SELECT url FROM shells") ; $mh = curl_multi_init(); $handles = array(); while($resultSet = mysql_...

Need variable width negative lookbehind replacement

I have looked at many questions here (and many more websites) and some provided hints but none gave me a definitive answer. I know regular expressions but I am far from being a guru. This particular question deals with regex in PHP. I need to locate words in a text that are not surrounded by a hyperlink of a given class. For example, I ...

Order a MySQL result by Date and Time in PHP

Hi, i have this code: $datos = mysql_query("SELECT * FROM `usuarios` LIMIT 0, 30 "); Who is a simple MySQL query in php, but i need the result organized by date and time. There is a field in my table who has this value (automatic inserted when the user sing up in my page). So the table is something like this: Id Name DT 1 Dom...

PHP Help with "if" statement to dynamically include files

Hello, I have these files: "id_1_1.php", "id_1_2.php", "id_1_3.php" etc "id_2_1.php", "id_2_2.php", "id_2_3.php" etc the number of files is not known because will always grow.. all the files are in same directory.. I want to make a if statement: to include the files only if their name ends with "_1" another function to load all th...

MySQL query pulling from two tables, display in correct fields

I'm trying to select all fields in two separate tables as long as they're sharing a common ID. //mysql query $result = mysql_query("SELECT * FROM project, links WHERE project.id = links.id and project.id = $clientID") //displaying the link if ($row['url'] != null){ echo "<div class='clientsection' id='links'>Links</div>"; ec...

Large file uploads from web pages

Hi folks, I code primarily in PHP and Perl. I have a client who is insisting on seeking video submissions (any encoding) from the public via one of their pages rather than letting YouTube do its job. Server in question is a virtual machine and I can adjust ini settings for max post, max upload size etc as needed. My initial thought i...

How to forward $_POST with PHP and cURL?

I receive POST request at my PHP script and would like to forward this post call to another script using POST too. How to do this? I can use cURL if it's required for this action. ...

SugarCRM installation frozen

Hi there. I'm trying to install SugarCRM version 5.5.1. on a webhost. Everything goes nice until the step when the installation begins. The output is this one: Creating Sugar configuration file (config.php) Creating Sugar application tables, audit tables and relationship metadata ............. And never moves on! ...

Is there a way to find out how many times a class has been instantiated in php?

I'm currently using this method: class Foo { private static $num_instances = 0; function __construct() { self::$num_instances++; } } which seems to work, but I'm wondering if there's a built in way.... ...

jQuery fadeout a div that's revealed by php and not Javascript?

Seems like this might be easy, but from reading other SO answers there are a number of ways for it to possibly work: I have the "thanks" div below that shows when a php form is sucessfully submitted: <?php if(isset($emailSent) && $emailSent == true) { ?> <div class="thanks"></div> The page does not reload after the form is submitted;...

MySQL access classes in PHP

I have a connection class for MySQL that looks like this: class MySQLConnect { private $connection; private static $instances = 0; function __construct() { if(MySQLConnect::$instances == 0) { //Connect to MySQL server $this->connection = mysql_connect(MySQLConfig::HOST, MySQLConfi...

Correctly encode characters in a PHP mail form ("I'm" turns to be "I\'m")

Hello guys, I'm testing a PHP mail form, a very barebones one, found here: <?php if(isset($_POST['submit'])) { //The form has been submitted, prep a nice thank you message $output = '<h3>Thanks for your message</h3>'; //Deal with the email $to = '[email protected]'; $subject = 'you...