![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Alex
Staff Alumni-
Posts
2,467 -
Joined
-
Last visited
Everything posted by Alex
-
Creating a .htaccess file with this in it and putting it in the same directory should work. <Files "picture.png"> AddType application/x-httpd-php .png </Files> Just rename your php script "picture.png", and the code above should enable picture.png to be parsed as a php file.
-
if(strlen($_POST['pass']) < 6) { ... } strlen
-
SMF, phpBB and other forums written in PHP are open-source, why not download them and take a look at the code?
-
reading a file with a lot of spaces between words
Alex replied to x_maras's topic in PHP Coding Help
You can do this using preg_split. In the code I put some examples so you can see how you would access the data from the $records array. $file = <<<FILE 67160 99999 19960101 57.0 24 52.7 24 1002.5 24 1000.7 24 6.0 24 10.1 24 22.0 30.9 61.5 53.6* 167160 99999 19960102 57.3 23 49.5 23 1003.6 23 1001.8 23 7.9 23 3.3 23 7.0 999.9 62.6 51.8* 167160 99999 19960103 54.9 24 45.7 24 1002.6 24 1000.8 24 7.6 24 8.4 24 15.0 999.9 57.9 51.8* FILE; //$file = file_get_contents('somefile.txt'); $rows = explode("\n", $file); foreach($rows as $row) $records[] = preg_split('~\s+~', $row); echo $records[0][0]; // 67160 echo $records[0][2]; // 19960101 echo $records[1][1]; // 99999 -
preg_match() [function.preg-match]: No ending delimiter '^' found
Alex replied to bikeria's topic in Regex Help
You need to add delimiters to all your patterns, your patterns are $mail_pat, $domain_pat, etc.. There are a lot of things you can use as delimiters, for the most part it's just down to use preference. Example: $mail_pat = '^(.+)@(.+)$'; Should be: $mail_pat = '~^(.+)@(.+)$~'; Notice the ~ at the start and the end of the pattern. -
preg_match() [function.preg-match]: No ending delimiter '^' found
Alex replied to bikeria's topic in Regex Help
In PCRE functions you need to use delimiters in your regular expressions. Show us your pattern and we can help you correct it. -
$keys = array_rand($text, 3); echo $text[$keys[0]] . "<br />\n"; echo $text[$keys[1]] . "<br />\n"; echo $text[$keys[2]]; array_rand
-
It's not a good idea to use the same password for everything.
-
Using "and" is perfectly correct syntax.
-
rand() is fine.
-
String theory is actually quite interesting. It just seems to be all over the place, but it's only a work in progress so I guess that's to be expected. There aren't people smart enough to solve the equations in string theory, so I'm not sure how that's going.. Of course none of this can be proven, that's why it's called theoretical physics. Theories like String Theory and Relativity are under theoretical physics because although they can't be proven they're based on proven physics, unlike these other theories keldorn is talking about.
-
Use array_combine: $arr1 = Array('key1', 'key2'); $arr2 = Array('val1', 'val2'); $new = array_combine($arr1, $arr2); print_r($new);
-
$allfiles = array_reverse($allfiles); array_reverse
-
Make sure you remove any white-space before the php tags.
-
$card = rand(1,52); rand returns a random number, this just makes $card a variable that holds a number 1-52, so the elements $card[1], $card[2], etc.. don't exist.
-
You have a scope problem. $database_actionrpg is not defined within the scope of that function.
-
As I said before, $fedid isn't defined anywhere. You're just passing a null value into the query. Are there values for the fedid in the database?
-
Any errors messages?
-
No, I'm still here Well, your error handling indicates that it did upload successfully.. I know this might sound stupid.. but can you double check to make sure it wasn't uploaded? (Perhaps refresh FTP if that's what you're using to view the directory). Edit: It might be because of this: if (!empty ($_POST['header'])) You should really be checking $_FILES['header']
-
Do you get any of your error messages like 'File not moved'?
-
Oh wait , you should be print_r'ing the $_FILES array, since that's the one that's giving you trouble. But I think I found your problem.. You forgot to set an enctype in your form. Inside your <form > element add enctype="multipart/form-data".
-
Because you're using it in this query: $query = "SELECT h.password as password, h.enabled as enabled FROM efed_handler as h WHERE h.login = '$uname' and h.fed_id = '$fedid'"; I also just realized that right under that query you're trying to use mysql_numrows(), which is a function that doesn't exist. It's mysql_num_rows. I suggest you put error_reporting(E_ALL); at the top of your file.
-
Right above: if (isset ($_POST['Submit'])) { Would probably be best, so that it's sure to run.
-
There's no need for the echo as print_r prints the results by default.