PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Iron Speed
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old April 9th, 2002, 04:17 PM
trunks trunks is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Canada
Posts: 7 trunks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP -> problem with my newsscript

Ok, I got a problem. I almost finished my news script but there's one bug.. that I can't find. When I try to add a pretty long news (25+ lines), the form just won't submit or it will cut a part of the news somewhere in the process. here are my scripts;
the form:
PHP Code:
<? include("config.php"); ?>
<FORM ACTION="<? echo "$script_path/addnews.php"?>" METHOD=post>
  <center>
  titre: <input type="text" name="titre" size="40" maxlength="40"><br><br>
  contenu: <textarea name="content" cols="50" rows="6" wrap="soft">
  </textarea>
 <input type="hidden" name="date" value="<?  $datee date("Y-m-d H:i"); echo "$datee"?>">  
 <input type="hidden" name="add" value="yes">
  <br><INPUT TYPE="submit" VALUE=" ajouter >> "></center>
</FORM>


the addnews function:
PHP Code:
function addnews($titre$content$date) {
    global 
$wnlogin$db_news$script_path;
     
$spl split(":"$wnlogin);
    
$_nom $spl[0];
    
$_password $spl[1];
    
$_email $spl[2];
    if (!
$content) {
          include(
"newsform.php"); 
      }
      else {
      
connect_db();
    
$query "insert into $db_news SET 
              titre =     \"$titre    \",
              content =    \"$content    \",
              date =    \"$date        \",
              auteur =     \"$_nom    \",
       email =    \"$_email\""
;
        @
mysql_query($query) or die(mysql_error());
        
header("Location: $script_path/cpanel.php"); 
      }
 } 

my table structure:
PHP Code:
 $query[] = "CREATE TABLE $db_news (
        id int(11) NOT NULL auto_increment,
            titre varchar(50) NOT NULL,
            content TEXT NOT NULL,
            date varchar(50) NOT NULL,
        auteur varchar(50) NOT NULL,
        email varchar(50) NOT NULL,
        PRIMARY KEY (id)
)"


TEXT should support 65k+ characters.. so hum..
I can't find what's wrong. (except that I don't really know this warp parameter in the form)
maybe it's the POST capacity?
hopyfully you can help me,
thx

Reply With Quote
  #2  
Old April 9th, 2002, 04:55 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
what field is causing the problem????

by the looks of things everything looks ok.

If you could tell me that it might narrow it down

Reply With Quote
  #3  
Old April 9th, 2002, 05:24 PM
trunks trunks is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Canada
Posts: 7 trunks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
a

it's the content part. I can't post a huge text (15+ lines).. :|
but I dunno if its the form or the script, I personnally don't think it's the script.. :|

Reply With Quote
  #4  
Old April 9th, 2002, 05:27 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
im at work atm so i cant test your script, but what ill ask you to do is this, on your add news page, add the line

echo $content;

and tell me if this prints out everything you typed???

Reply With Quote
  #5  
Old April 9th, 2002, 06:09 PM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
it shouldn't be the limit of the post size because that's fairly large. try changing your insert statement to this:

$query = "insert into $db_new(titre, content, date, auteur, email) values('$titre', '$content', '$date', '$date', '$_nom', '$_email')";

and the

echo $query;

just as ben said, is the $content variable showing in its entirety? if not then it's definetly a form problem (unlikely).

Reply With Quote
  #6  
Old April 9th, 2002, 07:37 PM
trunks trunks is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Canada
Posts: 7 trunks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
k

Ok I tried with this query (without the typos/repeats ;pp) and it looks like it's working (echo's everything and such). I'll confirm this later though. thanks guys

Reply With Quote
  #7  
Old April 9th, 2002, 07:56 PM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
no probs trunks, that's what we're here for let me know if it works 100%. sometimes php is weird in that you change one thing and everything works.

Reply With Quote
  #8  
Old April 9th, 2002, 08:40 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
yeah, php can be a bit bitchy sometimes, ive had problems with php, i was rippin my hair out, then i found the problem, a missing "

sometimes you slowly have to go back over your work

Reply With Quote
  #9  
Old April 9th, 2002, 09:13 PM
trunks trunks is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Canada
Posts: 7 trunks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
confirmation

everything works, yay!
weird that the SET... didn't make it.. heh
thanks again

Reply With Quote
  #10  
Old April 11th, 2002, 04:58 PM
trunks trunks is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Canada
Posts: 7 trunks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
new prob ;\

new problem, I try not to repeat the same code in all the files, so what I'm doing is require("v_login.php"); to put the verify login function. but it looks like my scripts just dont look if the person's logged in anymore and just displays the page...
here's v_login.php
PHP Code:
<?
 
function connect_db() {
     global 
$connection,$db_Hostname,$db_UserName,$db_Password  ,$db_Database;
      if (
$connection) { 
          return 
true
     }
      @
mysql_connect("$db_Hostname","$db_UserName","$db_Password") or die("Can not connect to database.");
      @
mysql_select_db("$db_Database") or die("Can not select database.");
      return 
true;
 }
 function 
verif_login($wnlogin) {
    global 
$db_users;
    
$spl split(":"$wnlogin);
    
$_nom $spl[0];
    
$_password $spl[1];
    
$_email $spl[2];
     
connect_db();
     
$requete "SELECT * FROM $db_users WHERE nom = '$_nom' ";
     
$resultat mysql_query($requete);
     
$r mysql_fetch_array($resultat);
     if (
$_email != $r['email']) { return false; }
     if (
$_password != $r['password']) { return false; }
     if (
$_email == $r['email'] && $_password == $r['password']) { 
          return 
true;
     }
 }
?>

and here's an example of a script using it..
PHP Code:
<?
 
require("config.php");
 require(
"v_login.php");
 if (!
$wnlogin) { 
    echo 
"vous devez être <a href=\"login.php\">login</a>"; exit();
 }
 if (
verif_login($wnlogin)) {
    echo 
"<center><b>Control Pannel<br><br>";
    echo 
"add a news:</b> <a href=\"newsform.php\">click</a><br><br>";
    echo 
"<b>edit a news:</b> <a href=\"editshow.php\">click</a><br><br>";
    echo 
"<b>delete a news:</b> <a href=\"delshow.php\">click</a><br><br>";
    echo 
"<b>see all news:</b> <a href=\"shownews.php\">click</a><br><br>";
    echo 
"<b>change news format:</b> <a href=\"newsformat.php\">click</a><br><br>";
    echo 
"<b>logout:</b> <a href=\"logout.php\">click</a><br><br>";
 }
 if (!
verif_login($wnlogin)) {
     echo 
"vous devez être <a href=\"login.php\">login</a>"; exit();
 }
?>

anyone know why it's not working? (p.s I tried if (verif_login($wnlogin)) alone and it doesnt work too...)

Reply With Quote
  #11  
Old April 13th, 2002, 11:09 AM
trunks trunks is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Canada
Posts: 7 trunks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
sorry, I want to put this on top because no one looks at the thread... and I need help.. :P

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP -> problem with my newsscript


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 | 
  
 

Iron Speed