Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

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 Codewalkers Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old May 30th, 2003, 06:07 PM
neliconcept neliconcept is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 neliconcept User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to neliconcept
tutorial question on news script part 1

hello im trying to embedd this script into a page im working on and im wondering if its possible to add another part on the form such as title for the title of the news box as im trying do do here

URL

its hard for me to explain but i added another

php Code:
Original - php Code
  1. if(!$HTTP_POST_VARS['title']) {
  2.             echo "You must enter a title";
  3.             exit;
  4.         }         


and for the other part too

but it is not working rightly and i was wondering if anyone could help me

ill show you all of the code

addnews.php code
php Code:
Original - php Code
  1.  
  2. <?
  3. if($HTTP_POST_VARS['submit']) {
  4.     if($HTTP_POST_VARS['password'] == 'test') {
  5.     if(!$HTTP_POST_VARS['title']) {
  6.             echo "You must enter a title";
  7.             exit;
  8.         }       
  9.     if(!$HTTP_POST_VARS['name']) {
  10.             echo "You must enter a name";
  11.             exit;
  12.         }
  13.         if(!$HTTP_POST_VARS['news']) {
  14.             echo "You must enter some news";
  15.             exit;
  16.         }
  17.     if(strstr($HTTP_POST_VARS['title'],"|")) {
  18.             echo "Name cannot contain the pipe symbol - |";
  19.             exit;
  20.     }
  21.         if(strstr($HTTP_POST_VARS['name'],"|")) {
  22.             echo "Name cannot contain the pipe symbol - |";
  23.             exit;
  24.         }
  25.         if(strstr($HTTP_POST_VARS['news'],"|")) {
  26.             echo "News cannot contain the pipe symbol - |";
  27.             exit;
  28.         }
  29.         $fp = fopen('news.txt','a');
  30.         if(!$fp) {
  31.             echo "Error opening file!";
  32.             exit;
  33.         }
  34.         $line = date("m.d.y") . "|" . $HTTP_POST_VARS['name'];
  35.         $line .= "|" . $HTTP_POST_VARS['news'];
  36.         $line = str_replace("rn","<BR>",$line);
  37.         $line .= "rn";
  38.         fwrite($fp, $line);
  39.         if(!fclose($fp)) {
  40.             echo "Error closing file!";
  41.             exit;
  42.         }       
  43.     } else {
  44.         echo "Password is incorrect, Please try again!";
  45.     }
  46. }
  47.  
  48. ?>
  49. <FORM ACTION="<?=$PHP_SELF?>" METHOD="POST" NAME="newsentry">
  50. Title:<BR>
  51. <INPUT TYPE="text" SIZE="30" NAME="title"><BR>
  52. Your name:<BR>
  53. <INPUT TYPE="text" SIZE="30" NAME="name"><BR>
  54. The News:<BR>
  55. <TEXTAREA NAME="news" COLS="40" ROWS="5"></TEXTAREA><BR><BR>
  56. News Password:<BR>
  57. <INPUT TYPE="password" SIZE="30" NAME="password"><BR>
  58. <INPUT TYPE="submit" NAME="submit" VALUE="Post it!"><BR>
  59. </FORM> 


here is my news box code
php Code:
Original - php Code
  1.  
  2. <td background="newstitlebar.gif" width="434" height="28"><table width="434" cellpadding="2"><tr><td width="6%"></td><td>
  3. <?PHP
  4. $data = file('news.txt');
  5. $data = array_reverse($data);
  6. foreach($data as $element) {
  7.     $element = trim($element);
  8.     $pieces = explode("|", $element);
  9.     echo $pieces[0];
  10. }
  11. ?>
  12. </td></tr></table></td>
  13. </tr>
  14. <tr>
  15. <td background="newspersonbar.gif" width="434" height="21" valign="top"></td>
  16. </tr>
  17. <tr>
  18. <td background="newspost.gif" width="434"><table width="434" cellpadding="2"><tr><td>
  19. <?PHP
  20. $data = file('news.txt');
  21. $data = array_reverse($data);
  22. foreach($data as $element) {
  23.     $element = trim($element);
  24.     $pieces = explode("|", $element);
  25.     echo $pieces[3] . "<BR>" . "<b>Posted by " . $pieces[2] . " on " . $pieces[1] . "</b><BR><BR>";
  26. }
  27. ?>
  28. </td></tr></table></td>
  29. </tr>
  30. <tr>
  31. <td background="newsbot.gif" width="434" height="2"></td>
  32. </tr>
  33. </table>


if anyone could help me i would be grateful

Reply With Quote
  #2  
Old May 31st, 2003, 03:31 AM
neliconcept neliconcept is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 neliconcept User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to neliconcept
RE: tutorial question on news script part 1

seems like it writes to the news.php file now thank god

but still having trouble figuring out how to transfer it to the tables on the page

anyone out there that can help around here would be appreciated

thanks

Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > tutorial question on news script part 1


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





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