oni-kun
Members-
Posts
1,984 -
Joined
-
Last visited
-
Days Won
1
Everything posted by oni-kun
-
You're right! I did not notice him running it off a folder, especially .html. OP, download something such as WAMP to run PHP code. Once installed you can access your pages from http://127.0.0.1/index.php provided your php files are in C:\easywamp\www\index.php or similar. A good thing about WAMP is it includes Apache linked to PHP/SQL so you do not need to endlessly configure it to run on your machine. This is a simple way to test PHP files which are compatible when you upload them online.
-
You can always use a PHP resource file. Such as <img src='image.php?image=file.jpg'/> Retrieving thus masking it from the other url.
-
Try writing this script in NOTEPAD, and run it again: <?php echo '<h1>HTML tags hate me</h1>'; ?> <h1>HTML tags hate me</h1> I'm not sure if your code editor converts the < to < or otherwise but it shouldn't perform as so. EDIT: PHP is serverside, it shouldn't matter which browser it's on. Firefox usually hides PHP tags. It might be the problem I thought. In IE+FF, What does the source code say when you view it? Is part of the PHP code there?
-
You can always include "/home/username/private/index.php" from /public_html/index.php.
-
trigger_error is a useful function rather than using 'die' for mySQL queries, as it can log errors for later. As for your file handling, file_exists, etc. Not specific enough to really answer more. Using REGEX and filtering data via escaping is a must while transferring data between interfaces, so there's another start.
-
Nope. An Alias is all that'll do.
-
A lot of newbs who come to these forums put code in plaintext, code tags or even quotes. O_o; It just makes more sense to have an easily available PHP button there, as the most posted type of code is PHP. I was surprised this brought much attention!
-
Unidentified index error in a simple form
oni-kun replied to Calamity-Clare's topic in PHP Coding Help
Your code is way off, You're checking if they exist after you call them. if (isset($_POST['title']) && isset($_POST['name']) && isset($_POST['response']) && isset($_POST['comments']) { $title = $_POST['title']; $name = $_POST['name']; $response = $_POST['response']; $comments = $_POST['comments']; } else { die('One of the forms is empty, please hit back and re-enter.'); //Or create your own error system } print "Thank you, $title $name for your comments."; //Will only display if it is set. print "You stated that you found this response to be $response and added: $comments "; Or something similar, Easy enough. -
All of them. POST / GET are the only methods of passing variables between forms.
-
Thank you a WHOLE lot. This is kinda fun to use, It helps me a lot.
-
I've got a page with roughly 500KBs of data, Basically I need it all on one page. I've tried adding 'ob_start('compress')' and 'ob_end_flush();' but it gives me an error at the end and i'm not sure if this is the best way. Would adding ob_start('gzcompress') work well? Would I need to add a flush at the bottom? Thanks.
-
email isnt getting through to some sites like hotmail.
oni-kun replied to seany123's topic in PHP Coding Help
First of all, You may want to add proper headers to the message for the recieving SMTP server filters to assume it's a real message: $header .= 'MIME-Version: 1.0' . "\n"; $header .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; And for the spam problem, It's almost impossible to fix on your own. If the incoming e-mail address is not too long, and has a subject. Than that is all you can do. If your site is on shared hosting (aka you do not own your own SMTP server) all it takes is one spam site on your network to blacklist it, basically never allowing it to go to inbox. This is a standard problem basically, as many many many good sites, even big ones wind up in spam for little reason, The best practise would be to tell them to add 'admin@test.com' to their contact list. -
I read on your other thread you were requiring? That's not really what you're supposed to do, use the AJAX handler to get the response (i.e. ajax.response) and place it into what you wish the result to be: document.lblmacaddress.value=ajax.response; ,placing the result of your php file when it is DONE, into your code. See how easy ajax is?
-
while ($variable) { //Do somehting } That's better. Use '!$variable' if you want to run something when it's empty
-
Yeah! You mean the [ m ] [ /m ]? I just just thought of that and wanted to reply here. I don't think it'd be hard to add at all, I mean all it does is uses JS to wrap a tag around selected text, It'll be very fun to use.
-
Meh, you can do something like this: for ($i=0; $i>=12;$i++) { //echo "5 x $i = ". ($i*5). "<br/>"; echo '<img src="'.($i*5).'.png"/><br/>"; } Either way, you can set it to say or write dynamically using a loop, using 5.png, 10.png, 15.png etc.
-
I've come to love using the [ php ] tags, but noticed they don't seem to have a button for them. I manually have to add [ code ] tags and then switch them to php or write them myself.. It isn't the most convenient sometimes. Do you think it should be added?
-
What doesn't work of it, what errors does it give you? It seems to use the EXACT same method to pull out the OS. By the way, what is your user agent string? If it contains 'win7' instead of NT 7.0, you can simply add /win7/i, to the array to match it.
-
Just add one line: // Loop through the array of user agents and matching operating systems foreach($OSList as $CurrOS=>$Match) { // Find a match if (preg_match($Match, $_SERVER['HTTP_USER_AGENT'])) { // We found the correct match echo $CurrOS; break; } } You can also wrap it in a function, and return $CurrOS instead of echoing it so you can place it in a variable.
-
You can only find the OS using the client's UA (User Agent). Note this is sent by the client and may be blank, or spoofed. $OSList = array ( // Match user agent string with operating systems 'Windows 3.11' => '/Win16/i', 'Windows 95' => '/(Windows 95)|(Win95)|(Windows_95)/i', 'Windows 98' => '/(Windows 98)|(Win98)/i', 'Windows 2000' => '/(Windows NT 5.0)|(Windows 2000)/i', 'Windows XP' => '/(Windows NT 5.1)|(Windows XP)/i', 'Windows Server 2003' => '/(Windows NT 5.2)/i', 'Windows Vista' => '/(Windows NT 6.0)/i', 'Windows 7 ' => '/(Windows NT 7.0)/i', 'Windows NT 4.0' => '/(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)/i', 'Windows ME' => '/Windows ME/i', 'Open BSD ' => '/OpenBSD/i', 'Sun OS ' => '/SunOS/i', 'Linux' => '/(Linux)|(X11)/i', 'Mac OS' => '/(Mac_PowerPC)|(Macintosh)/i', 'QNX' => '/QNX/i', 'BeOS' => '/BeOS/i', 'Search Bot'=>'/(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves/Teoma)|(ia_archiver)/i' ); // Loop through the array of user agents and matching operating systems foreach($OSList as $CurrOS=>$Match) { // Find a match if (preg_match($Match, $_SERVER['HTTP_USER_AGENT'])) { // We found the correct match break; } } I rewrote an example I found to be more up to date for you.. This should work, and is the only possible method.
-
How can i steam a video on my PHP site? (non YouTube)
oni-kun replied to jakubsnm's topic in PHP Coding Help
You can use an open-source solution such as this: http://www.longtailvideo.com/players/jw-flv-player/ It's a simple free .flv/mp4 streamer via rtcp/http. EDIT: You can store the filenames in a database and create your own sharing site if you wish, without much trouble. But it works fine for simple streaming. -
if ($_SERVER['HTTP_HOST'] == "mysite.com") { $image = readfile('./image.jpg'); header('Content-type: image/jpeg'); imagejpeg($image); imagedestroy($image); //free resources } else { $image = readfile('./theft.jpg'); header('Content-type: image/jpeg'); imagejpeg($image); imagedestroy($image); } Like this? Very simple method, will only echo the actual image if the host is your own. EDIT: Fixed code a bit
-
Use JS to separate the css callings. Hacking for IE is a must!
-
I haven't really gotten into yet, but I was just thinking of something weird.. Lets say you have a session element $_SESSION['is_admin'].. Is that easy to modify the cookie or whatnot and change it to true? Or is it hashed or something weird or serverside.. I just never really thought about it before.