Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Pointer Examples Of Cleaning


I have managed to create a very basic CMS, the CMS cover 6 pages and each page can have its title, pagetext, image link 1 and 2 altered.

I have doen the best I can but, I imagine that the code I have produced is somewhat ugly and could be clearer and slimlined. I have included the code for both the form page and the post page. Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Function Pointer?
Does PHP have anything like a C/C++ function pointer?

View Replies !
Moving Pointer
how move the resultset pointer to the next and previous record.

View Replies !
Mouse Pointer
I want to show that the page is loading and it doesn't look like it's frozen when a user selects a selection from my drop down menu. I thought the best way would be to make the mouse pointer change to an hour glass while it is getting the data and back to a pointer when it displays the information from the db.

View Replies !
Array Pointer
I want to iterate over an array of commands, but some loop commands need to move
the pointer back to a specific key. Iterating with an index variable ($i) would work, but it involves looking up each command.

View Replies !
Pointer Is Valid
is_file_pointer_valid() in php. Something which will tell me either "Yes, that's a file pointer" or "No, whatever that thing is it isn't a file pointer"

View Replies !
GD Module Examples
Anyone here used, or is using PHP's GD module in their web design? I would be real interested in seeing what anyone has done with it on their web site with perhaps some sample code which demonstrates how they did it.

View Replies !
E-Mailing Examples Help.
I have created a form, which will allow a person to upload a picture,
and leave me mail. What I am having problems doing is, having the
form actually upload the picture and attach it to an email that is
then sent to me. If anyone knows of any sample code I could look at,

View Replies !
Pagination Examples
Basically im asking if anybody knows of any example code or tutorials where i can learn how to paginate a PHP page. I have a mySQL news table which holds stories as mark up. Ive had a look at a few examples and tutroials but most seem to have the the pages of the story in seperate rows in the database. Im also just confusing my self now with the multitude of options. Im using e107 as the back end by the way.

View Replies !
Printing Examples
Does anyone have any examples of how to send web page content to the
printer? I've looked at the PHP manual and I think I know how to do it
but I'd like be sure:

I have to open the printer first
Then I use the print write call?
Then I close the printer

View Replies !
Pagination Tried Several Examples
I'm having some difficulties with php pagination. I tried several sample codes provided on the net but none worked.

View Replies !
Possible To Keep A Pointer To An Object In A PHP Variable?
Is it possible to keep a pointer to an object in a PHP variable? I'd like to
do this :

$obj1 = new myClass(...);
$obj2 = $obj1;
$obj1->name = "foo";
$obj2->name = "bar";

echo $obj1->name;

Which would display "bar" instead of "foo" with the current PHP behavior.

View Replies !
Find Name Of Domain Pointer
I have several domain pointers that point to my main domain. My
hosting company automatically redirects visitors to my main domain, if
a domain pointer is used, but how do I determine which domain pointer
the visitor used to get to my site? I was using
Request.ServerVariables("SERVER_NAME") in asp, but I can't find a php
equivalent.

View Replies !
Using Next() To Advance Array Pointer
Code:

I need to use next() to advance the array pointer...to select the next row in the recordset inside the inner while loop.

with my code above, it loops infinitely...not sure why, but probably because the pointer has not been advanced?

View Replies !
Looking For Examples Of Huge MySQL & PHP
Does anyone know of any existing operational web sites where a massive (ie. millions of records) MySQL database combines with PHP to provide a directory service? I'm thinking along the lines of the White or Yellow Pages or similar. I ask because I'm researching a project which provides a (large) web-based specialist directory service, and I'd like to be in contact with people who've already done it with MySQL and PHP. I use MySQL and PHP all the time for small applications, but I'm not sure how they compare (in terms of speed and reliability) in the commercial world against the expensive alternatives.

View Replies !
Examples Of Using Inherance And Interfaces In PHP 5
As many of you knows, Zend has relased the Beta version of PHP 5. I
have allready make some tests of interfaces, classes inherance, static
and public variables, etc, and everything looks ok. Now, when you work
with PHP the most common thing is to do something with databases, you
have somehow the "same kind of pattern" like: logins, update, add,
delete data from de db, show data and that is it.

Now, I will like to use the new PHP 5 features in my next project. I
was trying to desing some clases and inferfaces for the "pattern" that
PHP use to have, and have not come with any good worthy idea. I know
Java too, so I was very happy about the the new features in PHP5 and
looking to use object model features. Im looking for very clear
examples on, how you have used the new features in PHP5 to do the "old
PHP thing"?

View Replies !
PHP Tutorial Or Project Examples
I've worked with ASP, ASP.NET and
WebSpeed in the past, but now I'd like to learn PHP. I've already
gotten a Fedora web server up and running with Apache and MySQL.

I'm looking for some examples - or even better a free project - to look
over and see how other are using PHP to read/write records to and from
MySQL. I'm trying to create a very simple web based contact management
system that will store data in a couple of tables.

Can someone recommend any examples or web sites to refer to? I'm about
to dive into the PHP manual, but I'd like some other material to study
as well.

View Replies !
Printing Code Examples
I am building a tutorial site, all is working apart from 1 thing.

If i type in some php code even basic stuff like

<?php echo date ('Y'); ?>

then when its submitted into the database the php gets stripped away i'm using the tinymce editor if that helps make it clear.

I need to be able to show code examples as my tutorials are for web design does anyone know a way of showing code.

I can disable the tinycme editor and type code right into the textfeild and use the html safe values like: &lt;?php echo date ('Y'); ?&gt;

but thats not a good solution as i want to use the tinymce editor as my members will be able to write some tutorials.

View Replies !
Examples Of Autoloading Object
I'm a bit confused with autoloading objects.

This is only for PHP5, correct?

All autoloading functions start with "__" correct?

And can someone give me a easy to understand example of an autoloading object? I googled, but I still have questions about it.

View Replies !
MySQL Transactional Examples
Does anyone have any examples of using Transactional processing of
MySQL with PHP? I'm not sure if the BEGIN statement needs to be in
front of my SELECT statement or processed before hand by itself.

View Replies !
Pointer Of Mouse And Text Form.
Anybody know wether one can create such text-form that pointer of mouse
will be automatically set in the text field of form? It means that user
can type text immediately after page has been loaded, without putting
pointer of mouse by hand in the text field.

View Replies !
Setting Array Internal Pointer
I was wondering if there was a way to set an array internal pointer to the array element in one step rather than running a loop where you use next() or prev() until you stop at the point you want?

View Replies !
Array Pointer For Internal(?) Functions
This:

function foo()
{
$a = array('a' => 'b', 'c' => 'd');
return array_keys($a);
}
while ($a = each(foo()))
{
echo 'dummy'
}

produces an infinite loop. Probably since the result of array_key doesn't
support an array pointer or so, I don't know how this is internally
implemented.

View Replies !
Examples To Display Day Calendar Schedule?
I am trying to find some code to help me along with dsiplaying a day
schedule. For example, a linear time-line with appointments blocked out or
colored differently.

View Replies !
Examples Of Well Written Large PHP Projects
To improve my PHP I've decided to study the source code of a medium to large open source PHP application. Can anyone recommend any applications that they would consider prime examples of well written PHP? The sort of attributes I'm interested in are basically just good software engineering such as clean internals, being well designed, good use of abstraction and also perhaps being well tested (things where there is a lot of room for improvement in my code ).

View Replies !
Searching For PDFLIB Working Examples
Can someone help me or point me to a place where I can find examples about PDFLIB that are written in PHP5.

The Examples that are provided with PDFLIB are not working. Missing fonts, images,...

View Replies !
When Is A Database Resource Pointer Not Valid, And What Test Can Be Run?
I posted before, but have now narrowed my problem down to this method.
At the start of the method, I test to make sure that I have a
resource, a pointer to data returned from a database. This test is
coming back true, so the next line runs, which attempts to get the
next row from the dataset. This brings back nothing. On the queries
I'm running right now, the first row will be fetched, but then no
further rows. If I expect 20 rows back, I get one, then 19 errors. I
use phpMyAdmin to run the query in another environment, to be sure of
what I should be expecting..

/**
* 11-04-03 - it is important that the resource which points to the
returned dataset gets passed into this method
* by reference, not by copy, or else, in the outside code that is
calling this method, the pointer in that resource
* will never advance to the next resource row.
*/
function dsRowIntoArrayWithStringIndex(&$dsResult) {
// 11-04-03 - this first lines test to see if anything came back
from the datastore
if (is_resource($dsResult)) {
$row = mysql_fetch_array($dsResult, MYSQL_ASSOC);
$row = $this->stripslashesFromEntryWithKeyIndex($row);
return $row;
} else {
$this->resultsObject->addToErrorResults("In
dsRowIntoArrayWithStringIndex(), in the class McFormatResultsMySql, we
expected the method to be handed a pointer to a database return
resource, but we were not.");
}
}

View Replies !
Mysql Fetch Row Data Without Moving The Pointer
Is there any way to get data from a row without moving the pointer?

View Replies !
Changing Absolute Position Pointer Location
I am currently working on a GD script that uses x and y coordinates to display a little message saying "<--You are here" on a map. Now traditionally it seems the pointed is located always to the left side of any text I add to it, which is fine, EXCEPT when i get close to the right edge of the map I need it to switch from "<--you are here" to "you are here-->", this is simple enough, but the pointer is still located on the left side of "you are here-->".

View Replies !
Looking For Recent Visitor Code Examples/ideas
I am working on updating my content management page and wanted to overhaul my "recent visitor" code. The code that tracks who has been and is still on my pages.

I have not been able to find some examples I saw here a few months ago and was wondering if anyone could point me to some examples.

The more versatile the better.

View Replies !
File Upload :: Good Working Examples?
I want to make a file upload using php, but everytime i get an error
"File name not given". Any hints why this is happening? I used a sample
from php.net, and other php sites, but all samples are basically the
same. Maybe someone from you has a good and working example?

View Replies !
Any Good Examples (applications) Of Advanced PHP Code Out There?
I'm a perl programmer interested in a good application or two to
download and examine in order to learn from. Anyone know of any such
things?

View Replies !
Real Life Examples Of Mysql+session_set_save_handler
In my test setup using my own session handlers with session_set_save_handler and mysql, the session handler opens and close mysql connections.

But what if my page also requires some mysql queries? Should I open a new connection or use the already opened one (opened by the session handler)?

I have made it a good practice to close a connection after a query but if I do it with only connection open no session data will be written to my mysql table.

I have seen some scripts using persistent connections but are not sure what would be the best for a real world environment.

View Replies !
Unique Number Generator - Problem With Variables As Array Pointer In While Loop
I'm trying the make a script that creates a 15 random but unique numbers between 11 and 99 and puts them in an array, once the script has created a random number it will get the korean words for those numbers and put them in another array so I'd end up with something like Code:

View Replies !
Cleaning Up
I've made the roomlist for my server but as you can see the topics look pretty out of it with all the colour codes and what not. Is there a code that can clean it up a little.

View Replies !
Cleaning Forms
I want to stop people inserting characters into forms (such as !"£$%^&*()><?.,).

What's the best way of doing this? Can I stop them from doing it to return a message, or is it better to just wipe the characters before inserting into a database, or both?

The only symbols I need is for an e-mail field, which are   . - @    otherwise it's just numbers 0-9 and letters A-Z. I found a script to disable input but it doesn't stop people from finding other ways of inputting bad characters.

View Replies !
Cleaning Up An Array
I was trying to filter the contents in an array, and it seems to work, but I've got an issue with the indexes. When I unset() an element, if I count() the number of elements, I still get the same number that I had before filtering. I'd also like to make my indexes go back to 0,1,2,3... Code:

View Replies !
Data Cleaning
I'm making a php XML parser that loads data into mysql database. I'm using just the basic XML functions. The files I'm parsing are uber huge, so I can't use one of the easier XML parsing methods that load the whole file into memory. So anyway, I read a file line by line, and pass each line into the parse. I keep getting invalid character errors. I use the utf8_encode() function and it got a little further. I added a function to replace all &'s with &amps; (which apparently is a bug in the XML file, that this isn't already done) and it got a little further. But its still not making it nearly all the way through the file.

This particular is 256 MB that I'm trying to parse, though once this is squared away, I'm going to have an even bigger one I want to build a parser for to run once a week. So what I really need, is a way to clean the xml data before giving it to the parser. With MySQL, i use the myql_real_escape_string() function before giving it data, and it works nicely. Is there any function or technique I can use to do the same kind of cleaning to lines of XML files? Even if it just deletes "illegal" characters?

View Replies !
Cleaning Up Text
I have a text variable that I want to strip of a section of each line. below is a sample of the text I have for the variable Quote:

Richfield (pop. 34,439)
Robbinsdale (pop. 14,123)
Rochester (pop. 85,806)
Rosemount (pop. 14,619)
Roseville (pop. 33,690)
Sartell (pop. 9,641)
Sauk Rapids (pop. 10,213)

what I am wanting to strip out is the end area the.

View Replies !
Cleaning An Array
I have a form that submits an array. Such as:

<input type="text" name="aName[]">
<input type="text" name="aName[]">
<input type="text" name="aName[]">
<input type="text" name="aName[]">

I need to "clean" this info before inserting it into a database, etc. Code:

View Replies !
Cleaning Up A QUERY
$limitvalue = $page * $limit - ($limit); 
    $query  = "SELECT * FROM Feed_3PT_SF, View_Member, View_Office WHERE Feed_3PT_SF.TOWN_NUM = '$id' AND Feed_3PT_SF.LIST_AGENT = View_Member.MLS_ID AND Feed_3PT_SF.LIST_OFFICE = View_Office.MLS_Number ORDER BY LIST_PRICE ASC LIMIT $limitvalue, $limit";         
    $result = mysql_query($query) or die("Error: " . mysql_error());

Is there anyway I can clean up this query? It takes way too long for 100 or so results to display on the page.

View Replies !
Cleaning Up After Php Build And Install
I've compiled a custom version of php with extensions persuant to my
needs, but now want to clean up the files used in the compilation.

When the php cgi is compiled, are all the extensions compiled into the
one file, or does the cgi reference libraries pointed to in the php
configure statement? If it references other files, how do I know which
ones it points to, so as to know what I can and can't delete.

View Replies !
Cleaning MS Word Input
I have a problem with a form, and I have tried various permutations of
htmlentities() and html_entity_decode() to resolve, but without success.

Here is the workflow.

1: User pastes MS Word formatted text into form field.
2: Server uses mail() to send input text to mail client.
3: Recipient pastes text into html file.

The problem is that MS Word contains peculiar characters for things like
bullets, which come out as tabs, which then come out as different, but
spurious, html characters in the html translation.

Does anyone know of a function(s) that can clean up MS Word input into
something that can be simply pasted as plain text without spurious
characters?

View Replies !
Cleaning Customer Data
At what point is it wise to clean the data entered into a form by your customer, and to what extent?

For example, can malicious scripts be sent via a simple e-mail form, or only when data is collected and stored in the database? And is the use of stripslashes() and strip_tags() sufficient to remove any threat, or is there something else I would need to do?

View Replies !
Cleaning Up Session Cookies
I have a problem where session cookies get left inside
the temporary folder. Is this a common problem or is
there perhaps something I've over looked - there a
way to make sure the session variables get cleaned up?

View Replies !
Cleaning Html Tags
somebody knows any way to put off all html tags from a file. I want to store cleaning pages for information purposes.

View Replies !
Cleaning Up Array After Unset()
I'm working on an e-commerce site, and one of the things I need to do is split an existing order into two orders. The problem I'm having is not
creating the new order, but getting the remaining items from the original order cleaned up in the array. What I've tried to do so far is:

1) The data is stored in a serialized array in the order_data field in the orders table. When the order is selected, it is unserialized and called
$order_data. Each item is a three item array containing price, quantity, and sku (i.e. $order_data[$i]['price'], $order_data[$i]['quantity'], etc.).

2) On the order details page, the items in the order are listed using the price, quantity, and sku fields. There is a checkbox for each item that is
used to indicate the items to be split into the new order. The name is split[] (to create an array of just the selected items), and the value is the
sku. The $order_data array is put into a session variable.

3) On the page that processes the split, $old_order = $_SESSION['order_data']. So now I have two arrays: $old_data contains the entire original
order, and $split contains just the selected items.

4) I then go through and compare each item in $split[] against each item in $old_order. Once the current item in $split finds a match in $old_order,
it is put into $new_order, and I use unset() to remove that item from $old_order:

for ($i = 0; $i < count($split);$i++)
{
foreach ($old_order as $key => $value)
{
if (array_search($split[$i],$value))
{
//add item to new order array
$new_order[$new_counter]['attribute_sku'] = $value['attribute_sku'];
$new_order[$new_counter]['price'] = $value['price'];
$new_order[$new_counter]['quantity'] = $value['quantity'];

//increment index counter
$new_counter = $new_counter + 1;

//increment order total
$new_order_total = $new_order_total + ($value['price'] * $value['quantity']);

//delete item from order_data array
unset($old_order[$key]);
}
else
{

View Replies !
Phpdig Cleaning Index
Ive just taken over the hosting of a site which uses phpdig as a site
search function, a program I have absolutely no knowledge of. Does
anyone know how i can immediately clear the index of redundant data and
also how i can set up cronjobs to do this regularly or where to change
the frequency of these cronjobs which i believe are already in
existence (just too infrequent)

View Replies !
Cleaning Up Data In An Array
I have an array with 10 items in it. How do I go about clearing all spaces before the data?

Ex:
Before:         jacob
After: jacob

Also some of the data looks like this, World&#32;of&#32;Warcraft&#32;Guide

How do I go about checking each value for this &#32; and replacing it with a space if its there?

View Replies !
Cleaning Information Retrieved
I was reading through this PHP security book and it recommends cleaning/screening/sanitizing information retrieved from the db prior to displaying it. Is this something that everyone recommends, or is it considered overkill?

Like I know to use htmlentities() to clean up these fields for proper display, but do I need to run everything through some eregi() checks or something to validate the information again before displaying it? Or does this all depend on how secure the db server is?

View Replies !
Cleaning $ POST Values
I'm trying to clean up some POST variables in this form and running into some errors when doing this:

function cleanDB($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote if not a number or a numeric string
if (!is_numeric($value)) {
$value = "'" . mysql_real_escape_string($value) . "'";
}
return $value;

I keep getting an error at the foreach statement saying the '&' is unexpected and it was expecting a '$' but the PHP manual for 'foreach' has the same code. Is there something else going on here?

View Replies !
Cleaning Uploaded File Name
I have spent hours (literally) tring to figure out the regular expression to clean the name of an uploaded file. I find that my clients often try to upload non-images, so I can check if its a '.jpg', '.gif' etc, but what about if they name their files 'cupboard.html.jpg'? This is what I have so far (after checking the file): PHP Code:

$photo = 'cupboard and other illegal chars' here!@#$%^&*(.html.jpg'

    if (preg_match("/jpg|jpeg/i",$photo)){$image_type=".jpg";}
    if (preg_match("/png/i",$photo)){$image_type=".png";}
    if (preg_match("/gif/i",$photo)){$image_type=".gif";}

    // Don't process non-images
    if (eregi('.jpg|.jpeg|.gif|.png',$photo)) {    

        // Take out illegal char in name
        list($name)=explode($image_type, $photo);
................

View Replies !
Cleaning Up After A Script Runs
how do you clear all varialbles and arrays after a script is run?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved