php

How to force a DOM refresh when running multiple Ajax tasks in a loop.

I have a page that sends emails to customers. It has a send all button at the bottom of the page to provide the convenience of being able to send all the emails at once. Problem is it works badly or not at all. It either isn't redrawing the page or isn't managing to process all the Ajax calls. Here is the JavaScript... function aj...

CodeIgniter: View doesn't load if I use die() function.

Hi, I have the following code. Checks if the user is logged in or not. When the variable $is_logged_in is not set or is False, I load a message view. Unfortunately, at the same time the system loads the restricted content view. So I used die() function, and now only shows a blank page. What can I do to only load the message view when t...

Command Line Tool To Supercharge Web Development?

Is there a way to create a command line tool which will help extensively in building an application. For example, say I have a zend project and I want to add a whole new admin module based on some predefined patterns. I run: myzf create admin-module-framework Which would then setup (as per a predefined template): The module, models,...

Creating a pagination function in PHP that exist in other class that generate the HTML

Hello, I need help creating a pagination function in PHP. I have created one that works great if it exist in the index page. I tried to put it in an PHP class it didn't work. Any help please. This is the code: function paging($eu,$limit,$back,$next,$nume,$t1) { $l=1; $i=0; echo $eu; //$ echo $limit; // maximum record p...

PHP Problem reading the hex values between these addresses?

<?php $file = 'file.dat'; $file_contents = file_get_contents($file); for ($i = 0x000481; $i <= 0x00048B; $i++) { print $i; } ?> I am creating an online file analyzer but I have a small problem. It outputs (which is the actual position the hex is in) 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 when it should be 44 7...

MySQL + PHP: General Help Needed for Echoing Data from Foreign Key

I have 2 tables (Users, Wall). The UserID in the Wall table is a foreign key. How would I go about fetching the users details using this? (I want to fetch the users Forename and Surname who posted the message.) Users Table: Wall Table: EDIT: I cannot figure out how to show the data. <?php include('config.php'); ?> <!DOCTYPE html PU...

Function ereg() is deprecated

I'm going through my code to replace any instances I'm using the ereg() function - which I was using for matching regex inside a string. I could use a little direction, if someone has a better method than what I'm using. Here's my old "currency validation" script: function valid_currency($number){ if(ereg('^[0-9]+\.[0-9]{2}$'...

What can I use instead of eval() ?

I have a string that stores some variables that must be executed to produce a result, for example: define('RUN_THIS', '\$something.",".$somethingElse'); Which is then eval()-uated: $foo = eval("return ".RUN_THIS.";"); I understand that eval is unsafe if the string that gets evaluated is from user input. However, if for example I wa...

New to PHP, can I just insert PHP in code?

Let's say I just want to use PHP include to grab HTML from another file. can I just put in that little PHP script and name my .html file (index.html) to index.php and it'll work? I thought I'd have to add my server password an other info in PHP to use it.. What do I do? ...

line breaks on comments textareas

A user post a comment on a forum using a textarea, he presses enter to format his text wich means line breaks, how can i convert those line breaks to html breaks when inserting its message on the database so the message is echoed with the line breaks formatting? cheers ...

Will caching be appropriate for this scenario?

Hi folks, So I have a PHP CodeIgniter webapp and am trying to decide whether to incorporate caching. Please bear with me on this one, since I'll happily admit I don't fully understand caching! So the first user loads up a page of user submitted-content. It takes 0.8 seconds (processing) to load it 'slow'. The next user then loads up ...

PHP and Round Robin DNS: Cache interfering?

Sketch: I have the following situation. "host.domain" is a Round Robin DNS records which points to 3 IPs (ie: 10.0.0.2, 10.0.0.3, 10.0.0.4). The servers behind it, are SMTP servers for handling outgoing mail. If I use PHP Pear's "Mail" package, and use the smtpinfo to set the host to "host.domain", I can not seem to get any other retu...

PHP $_POST print variable name along with value

I have a POST in PHP for which I won't always know the names of the variable fields I will be processing. I have a function that will loop through the values (however I would also like to capture the variable name that goes with it.) foreach ($_POST as $entry) { print $entry . "<br>"; } Once I figure out how to grab the variable...

help using php explode () and organizing output

Can someone pls show me how to map this correctly? I am trying to understand how to use php explode() and organizing the values in a way that I can retrieve and print them in some organized matter. For each record I want to put a name=value in a particular bucket. I have (7) max buckets per record. Sometimes I have records that won't fi...

PEAR Image_Graph XAxis coordinate orientation

I'm making a graph using PEAR Image_Graph and the bottom coordinates labels are dates. Instead of the labels (dates) displaying horizontally, I'd like them to display vertically - or maybe at a slight angle, so they aren't all on top of each other. However, I'm not sure if this is possible and I can't seem to find anything in the docum...

mb_str_replace()... is slow. any alternatives?

Heya all. I want to make sure some string replacement's I'm running are multi byte safe. I've found a few mb_str_replace functions around the net but they're slow. I'm talking 20% increase after passing maybe 500-900 bytes through it. Any recommendations? I'm thinking about using preg_replace as it's native and compiled in so it might b...

Comparing and combining multidimensional array

Been messing with this for a while and i just cant get it! I am reading values from a wordpress database into an array. I am then plotting these to a google map. The problem is i have multiple items in the same location, and when plotted to the map i can only see one of them (i presume multiple entires are covering each other. My outp...

Displaying an item depending on user login

Hi! This is the situation: I have a list of items, and one of LI is: echo '<li><a href= "index.php" title="">Link</a></li>'; Now, I want to make an if statement here - if user is logged in, give home.php, else give index.php - but I'm kinda lost in all those "s and 's and .s so I'm asking for your help This code won't do :/ echo '<...

Anyone can provide uploadprogress.dll extension for php 5.3.0?

I need uploadprogress extension for php on windows. I downloaded dlls from here, but the version doesn't match with my php. I have php 5.3.0 build 20090626 VC++6. And I couldn't find a compatible uploadprogress.dll. I can't build it because I don't have php source of my version. Also I don't want to use APC extension. can anyone provide ...

Is it possible to auto refresh a DIV on MySQL change in: PHP or Java Script or AJAX

I have a facebook like system, I want the DIV containing the messages to automatically update when a new message is posted. Is this possible? If so, how would i go about doing this? <?php include('config.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt; <html> <head> ...