Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Tutorials and Tips

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 10-03-2008, 11:47 AM
Ajof Ajof is offline
Member
 
Join Date: Jun 2008
Posts: 79
Credits: 5,790
Ajof
Send a message via MSN to Ajof
Default 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!
Reply With Quote
  #2  
Old 10-03-2008, 05:08 PM
Rsmiley Rsmiley is offline
Member
 
Join Date: May 2008
Posts: 90
Credits: 4,240
Rsmiley
Default 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 :)
Reply With Quote
  #3  
Old 10-03-2008, 09:51 PM
OceanLove OceanLove is offline
Member
 
Join Date: Aug 2008
Posts: 76
Credits: 5,635
OceanLove
Default RE: Quick php tutorial

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

Nice job Ajof~
Reply With Quote
  #4  
Old 10-04-2008, 08:19 AM
Ajof Ajof is offline
Member
 
Join Date: Jun 2008
Posts: 79
Credits: 5,790
Ajof
Send a message via MSN to Ajof
Default 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!');
}
?>
Reply With Quote
  #5  
Old 10-04-2008, 08:47 AM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 10,551
BMR777 is on a distinguished road
Default 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
Reply With Quote
  #6  
Old 10-04-2008, 09:02 AM
Ajof Ajof is offline
Member
 
Join Date: Jun 2008
Posts: 79
Credits: 5,790
Ajof
Send a message via MSN to Ajof
Default RE: Quick php tutorial

Well I need to get my revenge somehow!
Reply With Quote
  #7  
Old 10-04-2008, 10:11 AM
Ajof Ajof is offline
Member
 
Join Date: Jun 2008
Posts: 79
Credits: 5,790
Ajof
Send a message via MSN to Ajof
Default RE: Quick php tutorial

NEW TUTORIAL

HOW TO MAKE A BIG MESS

PHP Code:
<?php



while( == )
{
echo 
" Ajof is sexy! <br/> ";
}
?>
Reply With Quote
  #8  
Old 10-04-2008, 10:21 AM
OceanLove OceanLove is offline
Member
 
Join Date: Aug 2008
Posts: 76
Credits: 5,635
OceanLove
Default RE: Quick php tutorial

Lolz.. php fight!
Reply With Quote
  #9  
Old 10-04-2008, 02:40 PM
Rsmiley Rsmiley is offline
Member
 
Join Date: May 2008
Posts: 90
Credits: 4,240
Rsmiley
Default RE: Quick php tutorial

Woo! FIGHT!

If i knew Mybb i would :D lol

but bleh
Reply With Quote
  #10  
Old 10-04-2008, 02:57 PM
Ajof Ajof is offline
Member
 
Join Date: Jun 2008
Posts: 79
Credits: 5,790
Ajof
Send a message via MSN to Ajof
Default 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?";
}
?>
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[tutorial] Using Mysidia with x10Hosting! CallumCharlton Tutorials and Tips 0 03-09-2015 12:32 PM
Gradient Map Tutorial Whimsy Art Gallery 0 10-20-2014 03:55 PM
OOP Tutorial request Ruinily Suggestions and Feature Requests 4 02-09-2013 12:42 PM
PHP/MySQL Tutorial HIddenPanda Tutorials and Tips 0 01-27-2011 04:30 PM
Quick help, and I mean QUICK! trollis76 Questions and Supports 4 02-19-2009 09:30 PM


All times are GMT -5. The time now is 12:33 PM.

Currently Active Users: 464 (0 members and 464 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636