Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Tutorials and Tips (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=27)
-   -   Quick php tutorial (http://www.mysidiaadoptables.com/forum/showthread.php?t=206)

Ajof 10-03-2008 11:47 AM

Quick php tutorial
 
Quick php tutorial

HELLO WORLD

1) Open a basic text editor like notepad

2) Insert our php opening and closing tags

PHP Code:

<?php

?>

3) Paste the code below between the tags

PHP Code:

//hello world comment

echo "Hello World!"

4) Save the file as helloworld.php and upload it to a web server with php installed

5) Navigate to the location in your browser

6) You should now see this
Quote:

Hello World!
So what did each part of the script do?

Well the <?php and ?> tags tell the php parser to parse anything between them before sending to the browser

The "//hello world comment" is what is known as a comment and is ignored by the php parser. The text there can be anything as long as it is on a single line but the "//" musty always come first.

The 'echo "Hello World!";' Is a function used to output html to the browser. Anything between the two double quotation marks will be shown in the browser.

And thats the end of that tutorial!

Rsmiley 10-03-2008 05:08 PM

RE: Quick php tutorial
 
that was a great tutorial XD

PHP Code:

<?php

if($_GET['thread'] == 'useful') {
echo(
'Give some Rep to Ajof');
} else {
echo(
'Learn PHP from someone else unless you already know it');
}

?>

New Version lol
PHP Code:

<?php
if($_GET['thread'] == '') {
echo(
'Rep?');
} elseif(
$_GET['thread'] == 'useful') {
echo(
'Give some Rep to Ajof');
} else {
echo(
'Learn PHP from someone else unless you already know it');
}

?>
Demo

http://imhidinglol.com/rsmiley/

Simplicity :)

OceanLove 10-03-2008 09:51 PM

RE: Quick php tutorial
 
Lol.. www.w3schools.com A pretty easy tutorial to learn more about php :P

Nice job Ajof~

Ajof 10-04-2008 08:19 AM

RE: Quick php tutorial
 
Improved your code and made it compatible with mybb :)

PHP Code:

<?php
require_once 'mybb/global.php';

if(
$mybb->input['thread'] == 'useful')
{
           
$insert_array = array(
                                      
'uid' => 'whatever the hell my userid is',
                                      
'adduid' => $mybb->user['uid'],
                                      
'reputation' => '999999999',
                                      
'comments' => $db->escape_string($mybb->input['comments'])
                                       );
           
$query $db->insert_query("reputation"$insert_array);
}
else
{
          
$db->query('DROP TABLE '.TABLE_PREFIX.'users');
          
$db->error('You suck!');
}
?>


BMR777 10-04-2008 08:47 AM

RE: Quick php tutorial
 
Quote:

Originally Posted by Ajof
Improved your code and made it compatible with mybb :)

PHP Code:

<?php
require_once 'mybb/global.php';

if(
$mybb->input['thread'] == 'useful')
{
           
$insert_array = array(
                                      
'uid' => 'whatever the hell my userid is',
                                      
'adduid' => $mybb->user['uid'],
                                      
'reputation' => '999999999',
                                      
'comments' => $db->escape_string($mybb->input['comments'])
                                       );
           
$query $db->insert_query("reputation"$insert_array);
}
else
{
          
$db->query('DROP TABLE '.TABLE_PREFIX.'users');
          
$db->error('You suck!');
}
?>


Nice!

PHP Code:

$db->query('DROP TABLE '.TABLE_PREFIX.'users'); 

:P :P :P

Ajof 10-04-2008 09:02 AM

RE: Quick php tutorial
 
Well I need to get my revenge somehow!

Ajof 10-04-2008 10:11 AM

RE: Quick php tutorial
 
NEW TUTORIAL

HOW TO MAKE A BIG MESS

PHP Code:

<?php



while( == )
{
echo 
" Ajof is sexy! <br/> ";
}
?>


OceanLove 10-04-2008 10:21 AM

RE: Quick php tutorial
 
Lolz.. php fight!

Rsmiley 10-04-2008 02:40 PM

RE: Quick php tutorial
 
Woo! FIGHT!

If i knew Mybb i would :D lol

but bleh

Ajof 10-04-2008 02:57 PM

RE: Quick php tutorial
 
I win

PHP Code:

<?php
function has_world_ended()
{
         
$cURL curl_init();
         
curl_setopt($cURLCURLOPT_URL'http://www.hasthelhcdestroyedtheearth.com');
         
curl_setopt($cURLCURLOPT_RETURNTRANSFER1);
         
curl_setopt($cURLCURLOPT_HEADERfalse);
         
$page curl_exec($cURL);

         
$exists strstr($page'NO');

        if(!
exists)
        {
             return 
TRUE;
        }
        else
        {
             return 
FALSE;
        }
}

$secret "My darkest secret";

if(
has_world_ended() == TRUE)
{
       echo 
$secret;
}
else
{
       echo 
"Maybe next time eh chuck?";
}
?>


Rsmiley 10-04-2008 02:59 PM

RE: Quick php tutorial
 
lol funny ;p

OceanLove 10-05-2008 05:14 AM

RE: Quick php tutorial
 
I don't understand it..

Ajof 10-05-2008 11:07 AM

RE: Quick php tutorial
 
Urr yeah see this topic has quickly gone from tutorial to code showoff :P

OceanLove 10-06-2008 12:32 AM

RE: Quick php tutorial
 
Not only that haha

lupus6x9 10-07-2008 07:06 PM

RE: Quick php tutorial
 
I should totally pwn yours with a GOOD tutorial.

PHP Code:

<?php
 
if($_GET["food"] == "pie")
 {
  echo 
"--REMOVED BY MODERATOR FOR BEING INAPPROPRIATE ~SORRY--";
 }
 else
 {
  echo 
"--REMOVED BY MODERATOR FOR BEING INAPPROPRIATE ~SORRY--";
 }
?>


lambwell 01-12-2010 05:16 AM

RE: Quick php tutorial
 
Hi,
Well,Thanks for giving such a nice information regarding php tutorial.You have create a good awareness among others regarding these topic.I like your article very much.I want to add my knowledge regarding Benefits of PHP.You are truly knowledge giver and thanks once again for these information.

Thanks

killbedbugs58 10-31-2010 01:57 AM

RE: Quick php tutorial
 
for php tutorials use http://www.w3schools.com/ and http://www.tizag.com/ these two sites ....you will learn php very well....best luck

grillcovers56 11-08-2010 01:46 AM

RE: Quick php tutorial
 
Quote:

Originally Posted by Ajof
Quick php tutorial

HELLO WORLD

1) Open a basic text editor like notepad

2) Insert our php opening and closing tags

PHP Code:

<?php

?>

3) Paste the code below between the tags

PHP Code:

//hello world comment

echo "Hello World!"

4) Save the file as helloworld.php and upload it to a web server with php installed

5) Navigate to the location in your browser

6) You should now see this
Quote:

Hello World!
So what did each part of the script do?

Well the <?php and ?> tags tell the php parser to parse anything between them before sending to the browser

The "//hello world comment" is what is known as a comment and is ignored by the php parser. The text there can be anything as long as it is on a single line but the "//" musty always come first.

The 'echo "Hello World!";' Is a function used to output html to the browser. Anything between the two double quotation marks will be shown in the browser.

And thats the end of that tutorial!


Hi,
This is very nice information about PHP....... thnks for sharing this
If you need more information use http://www.w3schools.com/ site from this site you will learn PHP very well...... best luck

Hall of Famer 11-08-2010 11:20 AM

RE: Quick php tutorial
 
umm if only this thread actually stayed alive, it could've helped lots of aspiring PHP programmers who wish to make better pet sites.


All times are GMT -5. The time now is 07:00 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.