Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,344 members, 7,819,211 topics. Date: Monday, 06 May 2024 at 12:49 PM

Php Class For Beginners. Question Will Be Treated With High Priority. - Webmasters (8) - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Php Class For Beginners. Question Will Be Treated With High Priority. (35174 Views)

How Should Archive And Label Pages Be Treated? / Blogging Advice For Beginners / Designing A Website: For Beginners (2) (3) (4)

(1) (2) (3) ... (5) (6) (7) (8) (9) (10) (11) ... (13) (Reply) (Go Down)

Re: Php Class For Beginners. Question Will Be Treated With High Priority. by feelme3(m): 1:18pm On Apr 03, 2010
Please people,
I am just starting the course. Special thanks to quadrillo for this wonderful humanitarian gesture.
Can anybody give me a guide on how to install php on my system. I have downloaded xammp as advised by someone and php but after installation, I wanted to access http://localhost and its requesting username and password I never put in the first place. Even when I tried running a sample script, it  brought out the download box. I guess maybe I didn't get something right so I have uninstall both.
Please ppl, I know that there are great minds here and am eager to learn this php thingy.
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by 4peace(m): 5:32pm On Apr 04, 2010
@all
Happy Easter to you.
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by quadrillio(m): 12:48pm On Apr 07, 2010
Binary:

I must compliment  your efforts u are doing the best. how do i get the book?

send me a mail, I will gladly blast your mail with ebooks, thanks guys for understanding.
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by Binary(m): 5:49am On Apr 09, 2010
quadrillio:

send me a mail, I will gladly blast your mail with ebooks, thanks guys for understanding.


pls can u send me ur mail or send it to my box. clintionjr@yahoo.com. I will be glade to hear from You.
We hv many things to discus ok, i wud nt want to be talking about it here.just mail me. tanx.
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by quadrillio(m): 1:55pm On Apr 09, 2010
^^^^^a mail has been sent to your box.


- SAFE
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by quadrillio(m): 2:57pm On Apr 12, 2010
feel_me:

Please people,
I am just starting the course. Special thanks to quadrillo for this wonderful humanitarian gesture.
Can anybody give me a guide on how to install php on my system. I have downloaded xammp as advised by someone and php but after installation, I wanted to access http://localhost and its requesting username and password I never put in the first place. Even when I tried running a sample script, it  brought out the download box. I guess maybe I didn't get something right so I have uninstall both.
Please ppl, I know that there are great minds here and am eager to learn this php thingy.


if that installation is giving you too much problem, kindly download WAMP SERVER 2.0

I believe that should do, after which u can type "http://localhost/" in ur browser, u should get the right response.

- SAFE
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by majesty12(m): 4:20pm On Apr 12, 2010
@ quadrillio,pls can you help with a lecture on how to create a simple database to connect with my web page.Thanks.olisa.araka@gmail.com
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by jjjkkkooo: 7:31pm On Apr 18, 2010
majesty12, has anyone replied u on creating a simple database to connect to ur site? if not, mail me on niyioke2000@yahoo.com. i ll help u with dat
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by ro8127: 7:59pm On Apr 18, 2010
jjjkkkooo:

majesty12, has anyone replied u on creating a simple database to connect to your site? if not, mail me on niyioke2000@yahoo.com. i ll help u with dat

They're plenty tutorials out there, try w3schools, Tizag and Google.
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by fxmaxony(m): 4:56pm On Apr 22, 2010
@ quadrillio, I need the ebooks pls send to maxwelliweh@yahoo.com


I am making progress but there are still small things i am missing.

thanks
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by quadrillio(m): 1:43pm On Apr 26, 2010
fxmaxony:

@ quadrillio, I need the ebooks pls send to maxwelliweh@yahoo.com


I am making progress but there are still small things i am missing.

thanks
the books has been sent.

Hi fellow nairalander,

sorry for the long break, I thank everyone that called my phone to ask after me, it was very encouraging.

am pleased to start my tutorial with full force. but b4 i start let refresh our brain on d last lesson. (me sef don forget where I stop. LOL)

quadrillio:


OK, let's continue,

Creating and Using Objects

To create an instance of an object from a class, you use the "new" keyword in PHP, as follows:

$myObject = new myClass;

In this example, myClass is the name of a class that must be defined in the scriptusually in an include fileand $myObject becomes a myClass object.

Multiple Objects You can use the same class many times in the same script by simply creating new instances from that class but with new object names.

Methods and Properties
The methods and properties defined in myClass can be referenced for $myObject. The following are generic examples:

$myObject->myValue = "555-1234";
$myObject->myMethod();

The arrow symbol (->winkmade up of a hyphen and greater-than symbolindicates a method or property of the given object. To reference the current object within the class definition, you use the special name $this.

The following example defines myClass with a method that references one of the object properties:

class myClass {
var $myValue = "Jelly";

function myMethod() {
echo "myValue is " . $this->myValue . "<br>";
}
}

$myObject = new myClass;
$myObject->myMethod();
$myObject->myValue = "Custard";
$myObject->myMethod();



This example makes two separate calls to myMethod. The first time it displays the default value of myValue; an assignment within the class specifies a default value for a property. The second call comes after that property has had a new value assigned. The class uses $this to reference its own property and does not care, or even know, that in the script its name is $myObject.

If the class includes a special method known as a constructor, arguments can be supplied in parentheses when an object is created, and those values are later passed to the constructor function. This is usually done to initialize a set of properties for each object instance, and it looks similar to the following:

$myObject = new myClass($var1, $var2);

Using a Third-Party Class
The best way to learn how to work with classes is to use one. Let's take a look at a popular third-party class written by me, which provides a comprehensive way to validate email addresses.

see you in the next class, where we work around some classes that I've written.


Thanks


Thanks once again for your understanding. Nigeria: Great People, Great Nation.
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by quadrillio(m): 3:34pm On Apr 27, 2010
you people should please come and encourage me nah. LOL
BRB
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by Nobody: 6:12pm On Apr 27, 2010
am here 2 encourage u. . .keep up da gud job mahn
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by quadrillio(m): 2:03pm On May 04, 2010
*dhtml:

am here 2 encourage u. . .keep up da gud job mahn

thanks bro
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by chikeaneke(m): 6:34pm On May 20, 2010
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by textmypage(m): 3:15am On Jun 02, 2010
can someone teach me how to create and upload bulk mailers and phpmailers?
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by HAydots: 8:36pm On Jun 03, 2010
Please i need someone to teach me php online. And also how to install and use WAMP local host server
Thanks
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by cmespeak: 12:34am On Jun 04, 2010
hey bro,pls i need yr ebook, email = sandy2nono@yahoo.com thanks for yr good work
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by textmypage(m): 12:39pm On Jun 04, 2010
I am still waiting for help.please email me the php thing.i mean the ebook.especially the one concerning bulk/php mailer of a thing.
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by weblite: 5:33pm On Jun 15, 2010
guy, u are doing a good job.
keep it up.
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by weblite: 5:37pm On Jun 15, 2010
but i will suggest you do it inform of chapters

short chapters that those who are following you will be practicing along with you.

and you are to carry them along. its a good job
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by eddygalvin: 1:55am On Jun 16, 2010
hello i would like to setup a bulk sms website where users will be able to do the following

1.users can recharge thier account with recharge vouchers
2.send credits to other users on my site and have a referrer system.
3.give a signup free sms to my users.

I have made some research and i learnt that i require a gateway API to send sms intranet. this i have already done. i would like to know which software or script to install on my webserver that will give those features listed above thanks.

thanks
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by lyndadev: 4:01pm On Jun 16, 2010
Hi Nairalanders!

Learn and teach yourself the nitty gritty of web design and web development the easy way using high quality video tutorials (dvd clearity) designed by experts with years of experience in various branches of web design and web development such as html,css,coldfusion,php/mysql and graphics design/preparation using world class softwares such as wampserver, dreamweaver cs4,fireworks cs4,photoshop (softwares included).
Each video series ships along with softwares used and exercise files so you can build along

see sample video

[flash=416,312]http://www.motionbox.com/external/hd_player/type%253Dsd%252Cvideo_uid%253Dd498dcb61f15e8c55c%252Caffiliate_name%253Dmotionbox"[/flash]


Titles available include:
1- Php Essential Video training
2-CSS For Designers DVD
3-Dreamweaver CS4 Dynamic Development
4-Fireworks CS4 Essential Training DVD
5-Photoshop CS4 Extended For 3D DVD
6-PHP With MySQL Beyond The Basics DVD
7-Dreamweaver CS4 Essential Training DVD
8-Dreamweaver CS4 With CSS.DVD
9- Learning HTML


Click to see various videos available



Hurry now and gain the skills needed to make money as elections are coming up and politicians will be needing portals, so skill up now and make huge money.Remember knowledge is power
call: 08122968973 or 07064345719
or email lyndadev2010@yahoo.com
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by quadrillio(m): 10:05am On Jun 22, 2010
^^^^^this is called spaming, please stop it. you can as well open a new thread for this. jus because I don't ve much time for now to continue doesn't make it a dumping ground.


Please STOP.

-SAFE.
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by quadrillio(m): 2:16pm On Jun 22, 2010
weblite:

but i will suggest you do it inform of chapters

short chapters that those who are following you will be practicing along with you.

and you are to carry them along. its a good job


NOTED, thanks
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by guru01(m): 8:12pm On Jun 24, 2010
Hello sir,
i am having problems with my login script, which i have tackle enough but i can't figure out the problem.
The problem is that after creating (loginpage.php, signup_page.php, welcome.php, welcome_logout.php) i tried to login through my loginpage.php after signing up to my dba,
but i found out that the loginpage.php still leads me to a signup_page.php instead of taking me to welcome.php.
But if i signup_page.php, it will take me to welcome.php.
Sir i don't know what to do again, so i brought my script for you to check if am mistaking something. Download it through the attachment.
Thanks

Re: Php Class For Beginners. Question Will Be Treated With High Priority. by guru01(m): 8:26pm On Jun 24, 2010
Seems the Nland don't allow such script.
Check this out for loginpage.php
<?php
$usern="";
$passwd="";
$errormessage ="";
//===========================================
//ESCAPING DANGEROUS SQL ATTACK,
//===========================================
function quote($value, $handle){
if (get_magic_quotes_gpc()){
$value=stripslashes($value);
}
if (!is_numeric($value)){
$value="'". mysql_real_escape_string($value, $handle). "'";
}
return $value;
}
if ($_SERVER['REQUEST_METHOD'] =='POST'){
$usern=$_POST['username'];
$passwd= $_POST['password'];

$usern= htmlspecialchars($usern);
$passwd=htmlspecialchars($passwd);
//=============================================
//CONNECTING TO THE LOCAL DATABASE,
//=============================================
$user_name="root";
$password="";
$database="mylogin";
$server="localhost";
$db_handle= mysql_connect($server, $user_name, $password);
$db_found= mysql_select_db($database, $db_handle);
if ($db_found){
$usern =quote($usern, $db_handle);
$passwd= quote($passwd, $db_handle);

$SQL= "SELECT * FROM log WHERE username=$usern AND password=md5($passwd)";
$result =mysql_query($SQL);
$num_rows= mysql_num_rows($result);
//================================================
//CHECK TO SEE IF $result VARIABLE IS True
//================================================
if (isset($_POST['submit'])==$result){
if($num_rows >0){
session_start();
$_SESSION['login']= "1";
header("location: welcome.php"wink;
}
else{
session_start();
$_SESSION['login']="";
header ("location: signup_page.php"wink;
}
}
else{
$errormessage= "Error logging in, please signup here!!";
$errormessage= "<a href=signup_page.php>Click Here</a>";
}
mysql_close($db_handle);
}

else{
$errormessage=" Invalid login details";
}
}

?>

<html>
<head><tittle><font color=blue size=15>BASIC TEST LOGIN PAGE</font></TITTLE>
</head>
<body>
<form name="login" method="POST"
action="loginpage.php">
USERNAME<input type="text" value=""
name="username" maxlength=20>
PASSWORD<input type=text value=""
name="password" maxlength=18><br>
<input type=submit value="Login"
name=submit ></form>
<p>
<?php echo $errormessage; ?>
</body>

This is for signup_page
<?php
$usern="";
$passwd="";
$errormessage="";
$num_rows= 0;
//session_start();
//if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
//header ("Location: login.php"wink;
//}

//set the session variable to 1, if the user signs up. That way, they can use the site straight away
//do you want to send the user a confirmation email?
//does the user need to validate an email address, before they can use the site?
//do you want to display a message for the user that a particular username is already taken?
//test to see if the u and p are long enough
//you might also want to test if the users is already logged in. That way, they can't sign up repeatedly without closing down the browser
//other login methods - set a cookie, and read that back for every page
//collect other information: date and time of login, ip address, etc
//don't store passwords without encrypting them
function quote($value, $handle){
if(get_magic_quotes_gpc()){
$value= stripslashes($value);
}
if(!is_numeric($value)){
$value ="'". mysql_real_escape_string($value, $handle). "'";
}
return $value;
}
if ($_SERVER['REQUEST_METHOD'] =='POST'){
//=================================================================
// GET THE CHOSEN U AND P, AND CHECK IT FOR DANGEROUS CHARCTERS
//===============================================================
$usern= $_POST['username'];
$passwd=$_POST['password'];
$usern= htmlspecialchars($usern);
$passwd=htmlspecialchars($passwd);
//=================================================================
// CHECK TO SEE IF U AND P ARE OF THE CORRECT LENGTH
//A MALICIOUS USER MIGHT TRY TO PASS A STRING THAT IS TOO LONG
// if no errors occur, then $errorMessage will be blank
//=================================================================
$ulength= strlen($usern);
$plength= strlen($passwd);
if($ulength >=10 && $ulength<=20){
$errormessage="";
}
else{
$errormessage =$errormessage. "Username must be 10 to 20 characters";
}
if ($plength >=8 && $plength <=16){
$errormessage="";
}
else{
$errormessage =$errormessage. "Password must be 8-16 characters";
}
//test to see if $errorMessage is blank
//if it is, then we can go ahead with the rest of the code
//if it's not, we can display the error

//====================================================================
// Write to the database
//====================================================================
if ($errormessage== ""wink{
$user_name="root";
$password="";
$server= "localhost";
$database= "mylogin";
$db_handle= mysql_connect($server, $user_name, $password);
$db_found= mysql_select_db($database, $db_handle);
if($db_found){
$usern =quote($usern, $db_handle);
$passwd=quote($passwd, $db_handle);

//========================================================
// CHECK THAT THE USERNAME IS NOT TAKEN
//========================================================
$SQL ="SELECT * FROM log WHERE username=$usern";
$result= mysql_query($SQL);
$num_rows=mysql_num_rows($result);
if($num_rows >0){
$errormessage= "Username already taken";
}
else{
$SQL= "INSERT INTO log (username, password) VALUES($usern, md5($passwd))";
$result =mysql_query($SQL);
mysql_close($db_handle);
//=================================================================================
// START THE SESSION AND PUT SOMETHING INTO THE
//SESSION VARIABLE CALLED login
// SEND USER TO A DIFFERENT PAGE AFTER SIGN UP
//=================================================================================
session_start();
$_SESSION['login']="1";
header ("location: welcome.php"wink;
}
}
else{
$errormessage= "Database NOT found";
}

}

}

?>

<html>
<head><tittle color=red size=12>
SIGN UP PAGE.com</tittle>
</head>
<body>
<form name="signup" method="POST"
action="signup_page.php">
USERNAME<input type=text
name=username value='' maxlength=20>
PASSWORD<input type=text value=''
name="password" maxlength=16><br>
<input type=submit name="submit_signup"
value="REGISTER">
<P>
<?PHP PRINT $errormessage; ?>
</body>
</html>

This is for welcome
<?php
session_start();
if (!(isset($_SESSION['login']) && $_SESSION['login'] !='')){
header ("location: loginpage2.php"wink;
}

?>
<html>
<head><tittle size=15>WELCOME <BR>
YOU'RE NOW LOGIN</tittle>
</head>
<body>
Welcome back!!
<p>
<a href="welcome_logout.php">Logout</a>
</body>
</html>

And this is for welcome_logout
<?php
session_start();
session_destroy();

?>
<html>
<head><tittle>LOGOUT PAGE</tittle>
</head>
<body>
User loged out!!<br>
<a href=loginpage.php>Click here to login</a>
</body>
</html>
Thanks
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by ajaxphp7: 5:08pm On Jun 25, 2010
that is my email please i need the book anone4all2010@yahoo.co.uk [size=8pt][/size][color=#000099][/color]
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by onlysose(m): 9:27pm On Jun 26, 2010
Nice lecture visit www.easyebookz.org
Re: Php Class For Beginners. Question Will Be Treated With High Priority. by savenaija: 7:34pm On Jul 02, 2010
pls help. i can design a normal simple dynamic site but my problem is that i want a flash envelop type of design like what they have here www.gwwebdesign.com look at the right hand , there is one design in form of an envelop when mouse points there it opens the advert or so. please how can i achieve that design.

(1) (2) (3) ... (5) (6) (7) (8) (9) (10) (11) ... (13) (Reply)

best BULK SMS provider in Nigeria ? / When You Are A Computer Guru And Your Girlfriend Needs Your Assistance / The Meaning Of CAPTCHA & 6 Types Of CAPTCHA

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 62
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.