Delphi
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Tutorialized ForumsDesktop ProgrammingDelphi

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old May 23rd, 2005, 06:11 AM
sun sun is offline
Junior Member
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 16 sun New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
can you evaluate my code

Hi everybody

I'm writing PHP code to develope a web site. This work is for me just to learn the PHP language in order to get a new job.

I need a help from you just to evaluate my work if I'm going in the right way or there is another good solutions .

Note I didn't finish the work till now so I know still much work. So I hope that you can understand it easily and I will be thankfull for your help.

First of all I supposed that my web site is a forum to discuss the varities of cooking and recipes

The following four pages are navigated one by one. Now I will give the main code only:


1) forum.php
First of all this the first page that contains the list of all food types as a hyperlink such soups, sweets, etc.

Code:
<? 
$username=$_POST["username"];
?>


<TR>
<TH align = left>Soups,Mazza, and juices</TH>
</TR>

<TR>
    <TH align = left>Pasta</TH>
.
.
.


2)viewForum.php
this page will display the forum that be selected from the page forum and passed f_no, username variables using GET.

Code:
<?
$fno=$_GET['f_no']; 
$username=$_GET['username']; 
?>

<form method="get" action="PostTopic.php">


 <input type="hidden" value="newtopic"  name = "mode"> </p>


 <input type="hidden" value="<? echo $fno ?>" name = "f_no"> </p>


 <input type="hidden" value="<? echo $username ?>" name = "username"> </p>


<input type="submit" value="New Topic" name="newtopic"></p>
</FORM>

<?
$database="formdb";
mysql_connect(localhost);
@mysql_select_db($database) or die ("Unable to select database");
$query="select * from forums where f_no = '$fno'";
$res=mysql_query($query);
$fname=mysql_result($res,0,"f_name");
?>

// here to display Forums -> Soups,Mazza, and juices

 Forums -> 
<?
echo "    ".$fname."
";
?>


3) posttopic.php

here to post a new topic

Code:
// to get username, f_no (forum no)
<?
extract($_GET);
?>

<FORM METHOD=POST ACTION="postnew.php">
<INPUT TYPE="text" NAME="Ttitle">

<TEXTAREA NAME="texta" ROWS="20" COLS="60"></TEXTAREA>

<input type = "hidden" name ="f_no" value ="<? echo $f_no ?>" >
<input type = "hidden" name ="username" value ="<? echo $username ?>" >
<input type="submit" name ="submit" value ="Submit">

</FORM>


4) postnew.php

to apply the topic
Code:


your topic is applied</p>

<?
extract($_POST);
$database="formdb";
mysql_connect(localhost);
@mysql_select_db($database) or die ("Can not connect to database");

$sql="insert into topics values('','$f_no','$username',now(),'$Ttitle','$te  xta','1')";
mysql_query($sql)or die ('cannot insert because  '.mysql_error());
mysql_close();
?>


Thank you for your understanding

Reply With Quote
  #2  
Old May 24th, 2005, 04:11 AM
mrpradhan mrpradhan is offline
Junior Member
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 3 mrpradhan New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to mrpradhan Send a message via Yahoo to mrpradhan
good start

you can get help from php mannual extensively.
URL

Enjoy using PHP !

Reply With Quote
  #3  
Old June 1st, 2005, 03:01 AM
sun sun is offline
Junior Member
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 16 sun New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you

Reply With Quote
  #4  
Old June 1st, 2005, 07:18 AM
Acecool Acecool is offline
Senior Member
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 117 Acecool New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Extract is deprecated.

Also, you should check to make sure each variable is infact set, and before putting it into the database you need to make sure people arent trying to use DELETE strings etc..
__________________

If you plan on contacting me, please read this: Legal Terms & Conditions

Reply With Quote
  #5  
Old June 5th, 2005, 12:46 PM
sun sun is offline
Junior Member
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 16 sun New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Acecool

Thank you for your reply

Quote:
Extract is deprecated.



in which cases we can use it

Quote:
Originally Posted by Acecool

Also, you should check to make sure each variable is infact set,


Do you mean I must working with arrays.

Quote:
and before putting it into the database you need to make sure people arent trying to use DELETE strings etc..


sorry I couldn't understand.

Reply With Quote
Reply

Viewing: Tutorialized ForumsDesktop ProgrammingDelphi > can you evaluate my code


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway