![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
zq29
-
Posts
2,752 -
Joined
-
Last visited
-
Days Won
1
Posts posted by zq29
-
-
This should work [code]if(!eregi("[a-z0-1_]",$username)) echo "Invalid";[/code] [a href=\"http://www.regularexpressions.info/\" target=\"_blank\"]Click here for a good regular expressions information source.[/a]
-
Sounds like a server config issue.
-
Try the file_exists() function - Check the manual for more information.
-
I don't think your syntax is correct here, well, I have never seen ternary expressions written like that before...
[code]$mpurpose = (!empty($purpose)) ? " AND purposes = '".$purpose."'" : "";[/code] -
Heres a list of functions that you could use to write your script...
file() - To dump the contents of your text file into an array, loop through it with a foreach loop.
strpos() - To see if your search term is found in the current line in the loop.
array_push() - To put any matching lines into an array. Or, you could just use the $var[] = "string" method.
explode() - To split up your matched lines into an array of words and define an index to return the correct word.
Hope that helped some, I would write a demo script but I can't imagine it being quick to write, plus its nearly midnight here... Give it a go, any problems, post up your script and I'm sure you will be helped. -
I don't think you can do this with the php.ini nor the httpd.conf file. You [i]may[/i] be able to do it with a .htaccess but I don't know.
One solution may be to change the permissions on the files straight after the upload with the chmod() function. -
Like this?
[code]<script type="text/javascript">
function ShowPrices(node) {
var prices=node.value;
document.getElementById('price').value=prices;
document.getElementById('price').style.visibility="visible";
}
function Hideprice() {
document.getElementById('price').style.visibility="hidden";
}
</script>
<form name="test">
Please, select an option:
<input type="radio" name="pricing" value="£5.00" onclick="ShowPrices(this);">price A
<input type="radio" name="pricing" value="£10.00" onclick="ShowPrices(this);">price B
<br/><input type="text" id="price" value="£0.00"/>
<br>
<input type="submit" name="Request" value="Submit">
<br><br>
<input type="reset" name="Clear" value="Clear form" onclick="Hideprice()">
</form>[/code] -
If you're not using any advanced rules for your replacements it would be better to use str_replace() instead of preg_replace(). In which case, you can use it like this:
[code]<?php
$search = array("old1","old2","old3");
$replace = array("new1","new2","new3");
$str = "old1 old2 old3";
echo str_replace($search,$replace,$str);
//The above will echo "new1 new2 new3"
?>[/code] -
Could you post up your code so far, or even an explination of what you are trying to acheive with your matryoshka-like arrays - Maybe it could be done without all of the nested arrays.
-
No PHP is required at this stage...[code]<input type="file" name="photo_filename[]" size="30"> [/code]
-
Have you read the [i]two[/i] pinned topics in this forum regarding header problems?
-
Here, [strike]have a screenshot[/strike]. Does it on my computers at home too...
-
As far as I can work out, the 11 character ASCII string [b]'m741007ë,W[/b] would only convert to a 33 character hexadecimal string. Printable ASCII characters are 3 hex characters long I think. Can you post up any code that you are using to receive the user data?
-
Please be aware that this forum is not for requesting people to write you scripts - It is for requesting help with scripts that you are writing. But as this is a pretty easy task, here's something that will get you started:
[code]<?php
$data = "";
$result = mysql_query("SHOW COLUMNS FROM `table`") or die(mysql_error());
while($row = mysql_fetch_array($result)) {
$data .= $row[0].",";
}
$data = substr($data,0,-1)."\r\n";
$result = mysql_query("SELECT * FROM `table`") or die(mysql_error());
while($row = mysql_fetch_assoc($result)) {
foreach($row as $r) {
$data .= "$r,";
}
$data = substr($data,0,-1)."\r\n";
}
$handle = fopen("data.csv","wb")
fwrite($handle,$data)
fclose($handle)
echo "DONE.";
?>[/code]
Please note, I have had to leave off the semi-colons after the file functions as there is a bug in the forum that refuses to post a reply with them on. -
I'm seeing the whole forum sitting inside one big frame, I have a pair of scroll bars to the right of the window. Is there a second "hidden" frame here somewhere doing something which hasn't been set to hide the scrollbars or something?
-
psworkshop.net links to lots of good Photoshop tutorials.
-
[!--quoteo(post=370432:date=May 2 2006, 01:24 AM:name=askjames01)--][div class=\'quotetop\']QUOTE(askjames01 @ May 2 2006, 01:24 AM) [snapback]370432[/snapback][/div][div class=\'quotemain\'][!--quotec--]is that TechTV avatar because it look like the same.[/quote]Thats the logo for the Hip-Hop group Hieroglyphics.
-
As long as people make a fair effort, I don't mind - Providing they get the point across clearly.
-
And this must be done by creating a new image? If not, you could just use a HTML table with repeating backgound images to get the same effect...
-
Topic moved to Misc forum.
Core hacking is hacking PHP itself, not PHP scripts. Core hackers create PHP modules et cetera, its done at a low(er) level in C++ I think (I know its one of the C varients). -
You could try something like this...
[code]<?php
//Loop through all text files in a directory
foreach(glob("path/to/files/*.txt") as $file) {
$content = file($file);
//Loop through each line in the file
foreach($content as $line) {
//Seperate the line by the pipe symbol into an array and display
$temp = explode("|",$line);
echo "<p>Image: $temp[0]<br/>Title: $temp[1]<br/>Flash: $temp[2]</p>";
}
}
?>[/code] -
I'll move this to our JavaScript forum. Please be aware, Java and JavaScript are two very different languages!
-
First of all, the PHP Help forum is for specific PHP scripting problems, so I'll be moving this to a more relevent forum.
Yes, I have done it - I have FreeBSD installed on an old machine: 800MHz CPU; 128Mb RAM; 10Gb HDD. But I mainly use this for learning the command line for FreeBSD as I have a couple of dedicated servers with the same OS on, if I want to do something on my live servers I test it out on my test one first so that I know what I am doing!
For testing my PHP projects on, I just use my development machine which is running a WAMP set-up. -
Looks more like JavaScript, remember - PHP is a server side language.
problem formatting search results
in PHP Coding Help
Posted