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.





Identifying If The User Has Placed Invalid Characters


what would the code look like if you wanted to tell the user their info they submitted into a form had invalid characters? would you use ereg?




View Complete Forum Thread with Replies

Related Forum Messages:
Identifying Non-Supported Characters In A TTF File With GD?
I've managed to get GD working (mostly anyway) on my site - and am utilising the "imagettftext" function.

I am using this function to display individual characters on my website - with a nominated Font.

However, sometimes the characters in my StringText are not supported by the particular font that I am using ...

Directly from http://www.php.net/manual/en/function.imagettftext.php

imagettftext - "If a character is used in the string which is not supported by the font, a hollow rectangle will replace the character."

Can anyone suggest some code that would:

1) compare/look at the StringText supplied within the "imagettftext" function (in my case the StringText will comprise of a single character only)

2) where the supplied StringText (ie character) is NOT supported by the font, then I need for that character to be reported as not supported. ie. either; return a flag or skip the non-supported character entirely - rather than displaying the standard "hollow rectangle".

View Replies !
Identifying The Logged On User
is there a way (in php) to identify the user name used when logging onto a mySQL database? I want to know this so that I can program a basic audit trail on edited records.

View Replies !
Bad Request + Invalid Characters
I have a problem with ordering system I've made with PHP.

When user wants to remove items from shopping cart he/she choose the following link:

<a href=remove.php?confirm=yes&name=$name&item_id=$item_id>Yes</a>

One user claimed that he gets the error message below when using NN 6.2. For me everything works fine both with NN 6.2 and IE.

" Bad Request
Your browser sent a request that this server could not understand.
The request line contained invalid characters following the protocol string."

What could cause this error message? Is there someting wrong with the variables in URL? What are the limitations when sending variables in URL?

Where I could find more information about the issue?

View Replies !
Session Id Contains Invalid Characters
I am getting this error with php 4.4.0 (cgi mode), apache 1.3.26 on debian
woody:

[01-Nov-2005 03:31:06] PHP Warning: session_start(): The session id
contains invalid characters, valid characters are only a-z, A-Z and 0-9 in
/home/m2004018/DOMAIN.de/shop1/includes/application_top.php on line 270
[01-Nov-2005 03:31:07] PHP Warning: Unknown(): The session id contains
invalid characters, valid characters are only a-z, A-Z and 0-9 in Unknown on
line 0
[01-Nov-2005 03:31:07] PHP Warning: Unknown(): Failed to write session data
(files). Please verify that the current setting of session.save_path is
correct (/home/m2004018/tmp) in Unknown on line 0

The PHPSESSID in the browser address bar looks normal:
index.php?cPath=3&XTCsid=cdfb58872455c72c81dafa5026e6dd92

This is an oscommerce (actually xt:commerce) shop and currently it fails to
send order-mails (to shop owner) or sends empty mails to the customer.

View Replies !
Invalid Characters In URLs
I'm trying to develop my own sitemap generator. If I have a (1 quarter) symbol in the URL to be generated, I need to convert the symbol to a URL friendly equivalent. Previously, the 3rd part sitemap generator converted this symbol to &#188; yet I can only convert to &frac14; using htmlspecialchars/htmlentities which Google rejects.

View Replies !
Escapce Invalid Characters
We know when we add text into database, we always need to escapce the unvalid charactors. But why it is not done automatically by database.

View Replies !
How Can I Check My Username Of Invalid Characters
i wanna check my usernam of invalid caracters
the valid caracters are a-z 0-9.

View Replies !
Scanning A String For Invalid Characters
Does anyone know a way of scanning a string to find invalid characters such as Ð or Ô and return a true or false?

I thought it was the "htmlentities" function, but all that does is convert invalid characters to the ascii code.

View Replies !
PHP Calls To MySQL Using Invalid Characters
I have the following PHP code which constructs a MySQL call: PHP Code:

View Replies !
Check For Length And Invalid Characters?
I currently have JavaScript functions checking the validation for certain text fields in a form, although with recent browsers you can turn third party scripts off. I want to check the validation with PHP on the other end, before the information gets processed.

Is there anyway to create functions in PHP to check for certain characters or would I need to use already built in string functions to check for length and invalid characters? Also, I have certain textareas that allows the user to input text, how can i restrict the use of codes other than html? I figured I could check for all the tags such as <?, <script> and <%, and others, but would that really restrict all the code?

View Replies !
Form Validation :: Invalid Characters
I understand very basic php, but I'm new to form validation. How would I check incoming form data for invalid characters such as - <^/>{}[]: and invalid strings such as - href, http, [/url] And would I have to check each var separately, or is there a way to check all the incoming var data in one pass (a more efficient way)? I found some help on this subject, but it is for specific things such as proper zip code and I'm to new to 'see'.

View Replies !
Preg_match() :: Remove Invalid Characters From The Uploaded File
regular expressions give me a lot of trouble. Here is my expression to remove invalid characters from the uploaded file's filename:

<?php
$subject = "/:*?"<>|`~!@#$%^&+={};' test01";
$pattern = "/s+|;|"|:|*|@|'|}|{|=|+|&|^|%|$|#||/|?|<|>|||`|~|!/";
echo "<font face='courier new'>".$subject."<br />";
echo preg_replace($pattern, "_", $subject)."</font>";

?>So far it works properly, and it did take some time to create. Basically what I am asking is if it looks like I am missing anything or if there is anything unnecessary in my expression.

View Replies !
Login Script Problem - Dosn't Recognize Invalid User/pass
I've been working on the login system for my site for a while now, it was working for a while but seems to have stopped after I fixed it to get all the user's info set properly, it no longer recognizes invalid username/password combos Code:

View Replies !
Escaping Characters In User Input
I am yet to stumble across the best practice solution for coping with dangerous characters in SQL, be it add_slashes, magic quotes, html_entities() etc.. i'm never quite sure what the best approach is.

What do other people do to peoples input to make sure it is SQL safe?

View Replies !
Force User To Enter Characters Into A Form Field?
I have a form that our visitors need to use to sign up for our newsletter... Country is a required field on this form.. and I have it set up for PHP to check and make sure some thing was entered but what I am finding is that lot of visitors are just putting in several spaces. I have it validating to make sure something was put it in and to make sure that it wasnt just one space.. but if they enter multiple spaces the form processes. Is there any way or built in function that anyone knows about that will make sure that characters are entered and just not a series of spaces? or will I have to look to javascript for that?

View Replies !
Ensure That The User Can Only Enter A Certain Amount Of Characters In A Text Area.
I have managed to create a script in javascript to ensure that the user can only enter a certain amount of characters in a text area. If users have javascript turned off how can I check for this in PHP?

View Replies !
Remove Extra Characters From A Title That The User Types In To Make It More URL-friendly.
I am trying to remove extra characters from a title that the user types in to make it more URL-friendly. I am trying to use preg_replace() for it, but I keep getting errors. Here's my code: Code:

$urlFriendlyTitle = preg_replace("/[/", "", $_POST['title']);
$urlFriendlyTitle .= preg_replace("/]/", "", $urlFriendlyTitle);
$urlFriendlyTitle .= preg_replace('/ /', '_', $urlFriendlyTitle);

When I remove the space it's fine, but trying to remove brackets just doesn't work. I haven't tried to remove Quotaion Marks or Slashes/ other characters yet(ex @, #, $, &, etc..), but hopefully I can figure that out once I fix the bracket problem.

View Replies !
Identifying Browser
Is there a way to identify the brwser a visitor to my site is using? I would like to include site style based on the visitor's browser. If their us IE show layout one way, if their using Firefox show it another way...etc...etc.

View Replies !
Identifying People
on my website i'm finding people are coming back and signing up again and again... how can i log them so i know who has logged in before. was thinking IP but does this not change per session online with dial up?

View Replies !
Identifying A Value Range
i have a form that submits to a php file, the form basically has a hidden field called number:

<input type="hidden" name="number" value="12">

i know how to read the value of that, its simply putting <?php echo $_POST['number']?> but what i want to do is check if the number is between 1 and 25 and if it is then echo A else if it is between 25-75 then echo B else if it is anything above 75 then echo C .

View Replies !
Identifying SSL Clients
I have a site that uses PHP sessions through SSL, my employer does not wish the site to require cookies so I have switched on the use_trans_sid option for users who have cookies disabled. The problem I have is stopping session hijacking.

If I am on a page "https://secure.mysite.com/page.php?PHPSESSID=XXXXX"

And I email the url to someone else they can get onto the site without being challenged for a logon. I am trying to find a way to check that the connection is still coming from the same SSL connection, e.g. by checking the clients public key, but I can't find a way to get any information about the SSL connection from PHP.

View Replies !
Identifying An Image
Ive got a tracking system which tracks how many times a user clicks on an advert on my site. At the moment all the listings are set as one so when a user clicks on that advert it gets one click. However, one of the adverts is now going to contain two images advertising two separate companies.

Ive set it up so the images and urls are different and they go to their own websites and in my tracking table i have just added an extra column called image and the number 1 goes in if image 1 is clicked on or 2 if image 2 is clicked on. However, to display this is the bit im not sure about. At the moment its displayed in a table like this:

Advert Name Category Number of clicks

Advert 1 Shopping 257

However, if advert 1 has two images, meaning two separate companies, how can I show this in the above table?

View Replies !
Identifying The Clicked Record
i already know how to load the my list of suppliers using
mysql/php/apache, but what i would like to do now is put a link for
each and every supplier and when someone clicks it, they will
automatically go to that supplier's list of products.

i want something like this:

SUPPLIERS TABLE
supplierID, Name, Address,

AA Alfin21 1506 w. 66th street <>EDIT<>

View Replies !
Identifying Search Engines
my website is pretty much database driven and i've typically parsed the data in PHP and just output flat HTML. however, i'm trying to save some badwidth by spitting out just the critical information, and have javascript parse out the data.

however, i'm kinda worried how search engines would react to this. (especially google) would search engines ignore the keywords if they are inside javascript tags? how do i detect search engines? maybe i can just setup a special script that output's "search-engine-friendly" output.

View Replies !
Identifying Black Images
I would like to be able to identify completely black images in order that I can exclude them. I am thinking I could use gdlib but I cannot find a suitable function. If I can find the rgb of the image then I can exclude it.

View Replies !
Identifying Individual Users
I know that you can identify users using an ip address. But what if you have several users with different computers in one room sharing the same ip address. Is there anyway to differentiate each individual. Is there a unique signature from the computers that can be used?

View Replies !
Identifying Parts Of A String
$url = /blah/elephant/spaghetti/page.php

This gives you the whole path.

But how can you identify each directory in the url individually?

ie. I want $one to equal 'blah', $two to equal 'elephant' etc.

View Replies !
Identifying Off-site Links
Is there an easy way to identify off-site links using php? For example, on a forum site like phpbuilder.com, I'm looking for code to flag posts that contain: Code:

View Replies !
Identifying A Page Via Hyperlink
I have a page (product_wide.php) that displays sale items. In that page, I "include" a 2nd page that contains hyperlinks to general item categories. The hyperlinks in filternavbar point to product_wide, and display items from the category selected. I need a way, using the same hyperlinks I am using now in filternavbar, to tell, from product_wide, that it was from filternavbar that the link was clicked (as opposed to some other page in the site that takes you to product_wide. I can't change the configuration of the filternavbar url because of duplicate content issues with google.

View Replies !
Identifying Dynamic Form Fields
User goes to page which is a form that asks for some basic info regarding returning products for credit/exchange, and also asks for how many products are going to be returned. Upon submitting, a return authorization form is presented to them with the specified number of product fields. I now want to take the input from this form and email it to myself, as well as, display a confirmation page to the user. The problem I have is a can't say, for instance, echo "$field_name"; because field_name will get created dynamically after the user specifies how many products to return. For example, say the user says 5 products, this will generate a form with field names like:

return_code0 inv_num0 qty0 product0 cre_exch0 stockout0
return_code1 inv_num1 qty1 product1 cre_exch1 stockout1
return_code2 inv_num2 qty2 product2 cre_exch2 stockout2 and so on....

These get created with a for() loop. Once this form is submitted, how can I address the field names? Code:

View Replies !
Identifying Opening Link For Database Query?
I've got a tricky problem i need to solve, i'm building a banner exchange type site in which there are already about 100 banners so i've had to code things around what already exists to a certain extent.

Now each of the banners that go out on other sites have a link on the banner which pops open a window with details of the banner. this would be fine if all my banners were gifs and jpgs but there are also swf and dcr banners so i have no real control over the actual link on the banner. up until now each banner had a html page made for it so when you clicked on a banner it would open a page banner_1.html which had the details of that banner. for obvious reasons i'm going to replace all these redundant pages and put a htaccess redirect at their url to all redirect to a common page popup.php so all details will be dealt with in one file.

ok this is fine but my problem is in this page popup.php i need to identify the link that just opened the window so that i can then get the info from the database to put on the page..

remember i can't use the url like so...
bannerpage.php?thisbanner=1

but all existing links have unique addresses, is there a way to do this, i'm pretty sure there must be but i can't get my head around it?

View Replies !
Identifying Auto Increment Values For Each Of The Fields
I have set up a database i mysql, identifying auto increment values for each of the fields (eg AdminID). I was wondering how i can set up a form which will, when i go to add a new member, have the autoincrement value already present in the field and i can continue to input the rest of my data as usual.

View Replies !
Identifying User's Pick From Selection List
I have an application that uses PHP to access a MySQL table and
extract rows which match the user's search entry. Data from the
matching rows are loaded into an HTML selection list, and the user can
scan the list and highlight a selected item.

My question: In PHP, what is the syntax for identifying which row is
highlighted?

My goal is to pass the unique row ID of the selected item to a
subsequent form where all the fields will be displayed for the user to
edit.

I already have the code that loads the selection list and the code
that displays the fields. I just need to know how to determine the
highlighted item.

I have two PHP books, and both discuss loading the selection list, but
there is no mention of what to do next.

View Replies !
Form, Type=file And Identifying By Isset()
Windows XP
PHP 4.4.2
Apache 2.2
Register_Globals = Off
Safe_Mode = On
-----------------------
Hi All,

I am having a problem getting a file browse input field to be recognized on the next page. Let me show you...

page1.php Contains a web form with a file input to attach a file using a browse button.

<form method='POST' action='page2.php' enctype='multipart/form-data'>
<input name='uploadFile1' type='file' id=uploadFile1'>

page2.php contains a validator to check the input and perform an action based on whether or not the browse input field has been populated.

// IF THE POST CONTAINS A FILE UPLOAD, PROCESS SECTION 1 IF NOT PROCESS SECTION 2.

if (isset($_POST['uploadFile1'])) {
echo "File is attached so print this.";
}

if (!isset($_POST['uploadFile1'])) {
echo "File is NOT attached so print this.";
}

If the user uses the browse button on the form page to populate the field with a file path to a file on his pc, then I expect to see the "File is attached message". However, regardless of whether someone does or does not browse a file, the message is always that they have NOT browsed a file and the variable "uploadFile1" is effectively left unpopulated.

OUTPUT
File is NOT attached so print this.

Conversley, I thought I might be able to use the _FILES variable instead of _POST, but I get the exact opposite, that the browse field is populated all the time whether or not someone has browsed a file or left the browse field blank.

if (isset($_FILES['uploadFile1'])) {
echo "File is attached so print this.";
}

if (!isset($_FILES['uploadFile1'])) {


OUTPUT

File is attached so print this.

So, I am missing something. Can someone give me some direction so that I can simply identify (with register_globals = Off) whether or not an input field (input type=file) has been populated or left blank? Is this even possible? What am I missing?

View Replies !
Voting System - Identifying Voter And Integrity Of The Vote
I am trying to setup a voting system for our intranet (staff awards - free text fields). I have the database adding the votes no problem. What I would like to do however is the following:

1. It's our intranet, there is no need for each person to login so it just uses "user/user". However I need to capture the person's login on the vote record so I can identify who voted.

2. restrict the users to one vote each. I have done some research and it looks like I have to create a cookie.

View Replies !
Identifying Different Unicode/utf-8 Types Inside A Text String
I am dealing with a script that reverses a string that is in hebrew, so I can display it properly when I write that string onto an image, however sometimes the string might be half hebrew half english, so I need a way to identify what language is in the string and only reverse the hebrew parts.

in technical terms the hebrew text is encoded in utf-8, and the english text will be encoded in the normal encoding for english, (anscii, latin-swedish whatever, i dont know the name of that encoding)

so the simple question is how do I identify different types of encoding within a string?
that way I can break up the parts that i identify as being utf-8 and reverse only those

(yes I am well aware of methods to display hebrew properly in php, but when writing to an image this is another story, only method i found so far is reversing the hebew text string)

View Replies !
Special Characters - Convert To Html Code The Characters ã, á, à, é, ç, ...
How ould i convert to html code the characters ã, á, à, é, ç, ...

View Replies !
Although English Characters Appear Correctly Into The String, The Greek Characters Are All Replayed By '?'.
I am using php 5.2.2. I implement a web site that invokes a java web service (using nusoap.php).

The web service queries a table from an sql server 2000 database and returns a string with the records returned. The problem is that although english characters appear correctly into the string, the greek characters are all replayed by '?'.

The reason must be that the web service returns multibyte charecters (greek characters) and php cannot read them.


View Replies !
Perform Redirection Of The User's Browser If The User Isn't A Valid User.
I'm running PHP on Windows, but that's just the local test... in production
it will be on Apache.

I am not using PHP as a CGI. I want to perform redirection of the user's
browser if the user isn't a valid user. I don't want to use the refresh
meta tag or javascript to do this. I want to do this with some sort of
server command.

Does anyone know how to make this work? Here's my code...
<?php
session_start();
$goal = "";
if (array_key_exists('goal', $_GET)) { $goal = $_GET['goal']; }

if (isset($HTTP_POST_VARS['userid']) && isset($HTTP_POST_VARS['password']))
{
$userid = $HTTP_POST_VARS['userid'];
$password = $HTTP_POST_VARS['password'];
$db_conn = mysql_connect('localhost', 'webauth', 'webauth');
mysql_select_db('auth', $db_conn);
$query = "select * from auth where name='$userid' and
pass=password('$password')";
$result = mysql_query($query, $db_conn);
if (mysql_num_rows($result) > 0) {
$HTTP_SESSION_VARS['valid_user'] = $userid;
}
}

View Replies !
Session Id Contains Illegal Characters, Valid Characters Are A-z, A-Z, 0-9 And '-,'
Unknown: The session id contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,'

I'm getting this appear fairly frequently in my logs. Each time it appears it seems to be a different client (i.e. IP) but that client will cause 40+ errors in my logs. Is this an attempted hack?

View Replies !
Replace All Characters In String Except Keyboard Characters
I've been trying to figure this one out for a few hours and I'm not making much headway. Hoping someone here knows the quick solution...

I'd like to replace all characters in a string except for the set of keyboard characters. I figure this can probably be done with a preg_replace and some regex, but I'm afraid I need to bone up on my regex some...

View Replies !
NOW() Invalid
$datatime=NOW()it show invalid..

View Replies !
Invalid Use
Can anyone tell me why this isn't working?

SELECT DISTINCT (stat_listing)
FROM listing_stat
ORDER BY COUNT(stat_listing) DESC;

I have a table with the same values in one table (stat_listing) & I want to return distinct tables sorted by the value that appears the most. I hope you understand what I mean.

View Replies !
IIS+PHP: The Directory Name Is Invalid.
I have recently migrated from win98+PWS to winXP+IIS, and after that an
problem has occured. When I open some of my PHP pages, I get this
instead of the page I shlud get:

<html><head><title>Error</title></head><body>The directory name is
invalid. </body></html>

Now, the interesting part is the fact that this doesn't happen every
time I try to open a specific page (it happens in 80% of cases, but
sometimes it (the page) just opens like nothing's wrong) and that it
happens on all of my PHP pages! I presume I have misconfigured IIS...
but I don't know where to start searching for a problem... does IIS have
logging? Does PHP have logging?

Or, has anybody encountered similar problem?

I use:
IIS 5.1
PHP Version 4.3.0
IE 6.0

View Replies !
Invalid Query
I want to create a MySQL table from PHP.

$sql = "CREATE TABLE table_name (something VARCHAR(13), something INT)";
$result = mysql_query($sql)

This table is never created. Do you know why? Are there any limitations at making tables from PHP?

View Replies !
PHP Returns Invalid XML Because Of '&'
I'm writing a PHP script to query a database table and return the result as XML. If the result contain the letter '&', the XML is corrupted. How can I fix this problem?

<xml>
<record id='2' text='jjjj&kkkk'>any</record>
</xml>

View Replies !
Invalid Token?
Im trying to parse an XML file that validates/Snytax is fine but i get "XML error: not well-formed (invalid token) at Line 2" i cant see any problems at all.

View Replies !
Invalid Document End?
I am trying to parse an xml file but i keep getting a invalid doc end error! and I cannot figure out what is wrong. Some phantom white space? Code:

View Replies !
Returns Invalid XML Because Of '&'
I'm writing a PHP script to query a database table and return the result as XML. If the result contain the letter '&', the XML is corrupted. How can I fix this problem?

<xml>
<record id=&#392;' text='jjjj&kkkk'>any</record>
</xml>

View Replies !
Special Characters - Foreign Characters
I'm experiencing a strange problem in displaying some text I have extracted from an XML file that I haven't had much success in solving. I am retrieving some remote XML, placing it in an array, and extracting the data I need, then inserting that into a MySQL database so it can be manipulated and merged with other data.

Some of the data includes location names, such as the one below, which include foreign characters that have been translated into a special character. For some reason, these are actually being displayed in the form shown below. For example and ampersand appears as &amp; and not as &. PHP Code:

C&#244;te d'Ivoire

View Replies !
Another Invalid Result Resource
Sorry to ask a debugging question, but I've been fooling with this thing all day, and I can't see what the problem is. $query is passed from search form:

$result = mysql_query("select id, date, title, text, reviewer, email, score, cover, url, url_title, hits, type, creator, release, upc, quote from one7_reviews where title LIKE '%$query%' OR description LIKE '%$query%' OR creator LIKE '%$query%' OR url_title LIKE '%$query%' ORDER BY title ASC");

$num = mysql_num_rows($result);

I keep getting "Supplied argument is not a valid MySQL result resource "

View Replies !
Invalid Argument Supplied ?
i am somewhat of a newbie and and having hell with this Script. WHen i run it i get :
Warning: Invalid argument supplied for foreach() in C:InetpubwwwrootKubemailWWWaspedit1.php on line 20

And i cant figure out WHY.
Please help!
Code pasted Below.

<?
$Reg = new COM("IISSample.RegistryAccess");

$Aliases="HKEY_LOCAL_MACHINESOFTWAREIpswitchImailDomainskubemail.comUsers\_aliases";
?>

<?

function EchoValues($strKeyName){

echo "<h3>Get values of ".$strKeyName."</h3>";

$reg->Values[$strKeyName];
echo "<b># subkeys = ".$Values.$Count."</b><br>";

echo "<table>Values Collection";
echo "<TR><TH align=left>Name</TH>".
"<TH align=left>Value</TH></TR>";

foreach($Values as $k){

echo "<TR><TD>".$k.$Name."</TD>";
}

}
?>
<? EchoValues($Aliases); ?>

View Replies !

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