LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-08-2005, 11:22 PM   #1
newuser455
Member
 
Registered: May 2004
Location: Texas
Posts: 277

Rep: Reputation: 30
PHP form takes forever to submit


I am using a script from http://www.nicecoder.com called indexu lite. The script is a link directory. Whenever I try to submit the form to add a link, the page loads forever (literally). If you don't understand what I am talking about, or want to see for yourself, go to http://www.o7e.net/dir and submit a test link. Does anyone know what is wrong? Thanks alot.
 
Old 06-09-2005, 01:07 AM   #2
lowpro2k3
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Rep: Reputation: 30
Wow, thats so slow it leads me to believe its a misconfigured server. But for the heck of it you might want to post the source of add.php in the [ code ] [ / code ] tags, but if its a commercial system being sold I doubt its their code, unless they missed a bug before release. I took a quick peek at the website, it looks like a paid service, is it? Because if it is you should ask them for support, nobody, I repeat -nobody- is gonna hang around and wait for that thing. I gave it the entire time it took me to write this post and it didnt finish so I exited.

Which PHP/Apache/MySQL configuration are you running? I might be wrong but I think PHP isnt set up correctly, but Im tired and guessing. I'm going to bed, good luck with that
 
Old 06-09-2005, 02:49 AM   #3
newuser455
Member
 
Registered: May 2004
Location: Texas
Posts: 277

Original Poster
Rep: Reputation: 30
It is their free version. Add.php is not the only form that does this. One in the admin section does the same thing. Add.php is as follows:

Code:
<?php

include("application.php");

function ShowFormAddLink() {
  global $template_path;
  global $cat,$title,$url,$category,$description,$contact_name,$email,$bid,$ma,$HTTP_POST_VARS;  
  global $error_msg;

  if(empty($url)) { $url = 'http://'; }
  if(empty($bid)) { $bid = '0.00'; }
  
  $title = $HTTP_POST_VARS['title'];
  
  $title = stripslashes($title);
  $url = stripslashes($url);
  $description = stripslashes($description);
  $contact_name = stripslashes($contact_name);
  $email = stripslashes($email);
  
  if($ma=='1') {
    $category = "\n<input type=hidden name=ma value=1> ";
    $category .= "\n<input type=hidden name=cat value=$cat>\n";
    $category .= ShowCategoryPath($cat);  
  }
  else {
    $category = ShowDropDownCategoryList($cat);
  }
  
  DisplayTemplate($template_path."add_form.html",
    "\$error_msg,\$title,\$url,\$category,\$description,\$contact_name,\$email,\$bid"); 
}

function ProcessFormAddLink() {
  global $template_path,$site_url,$admin_email;  
  global $cat,$title,$url,$category,$description,$contact_name,$email,$bid,$HTTP_POST_VARS;
  global $error_msg,$error_msg_1150,$error_msg_1151,$error_msg_1152,$error_msg_1153,
    $error_msg_1154,$error_msg_1155,$error_msg_1156,$error_msg_1157,
    $msg_2001,$msg_2002,$msg_2003,$msg_2004;

  $title = $HTTP_POST_VARS['title'];
    
  if(empty($title)) { $error_msg = $error_msg_1150; }
  elseif(empty($url) || $url == 'http://') { $error_msg = $error_msg_1151; }
  elseif(empty($description)) { $error_msg = $error_msg_1152; }
  elseif(empty($cat)) { $error_msg = $error_msg_1156; }
  elseif(empty($contact_name)) { $error_msg = $error_msg_1153; }
  elseif(empty($email)) { $error_msg = $error_msg_1154; }
  elseif (!IsEmailAddress($email)) {  $error_msg = $error_msg_1155; }
  elseif (!empty($bid) && !Ismoney($bid)) {  $error_msg = $error_msg_1157; }
  
  if(empty($error_msg)) {
  
    $bid = str_replace(",","",$bid);
 
    $query = "insert into validate (title,url,description,category_id,contact_name,email,
      date,bid) values 
      ('$title','$url','$description','$cat','$contact_name','$email',now(),'$bid')";
    $result = mysql_query($query);
    DisplayTemplate($template_path."add_ok.html","\$novar");
  
  
    // send email to link owner
	
    $category = ShowCategoryPath($cat);

    $title = stripslashes($title);
    $description = stripslashes($description);
    $contact_name = stripslashes($contact_name);
	

    $email_body = EvalTemplate($template_path."add.mail",
	 "\$title,\$url,\$description,\$category,\$contact_name,\$email,\$bid");
   
    mail("$email",$msg_2001,$email_body,
     "From: $msg_2002\nX-Mailer: INDEXU_X-Mailer/1.0");


    // send email to site administrator
	
    $category = ShowCategoryPath($cat);
	
    $email_body = EvalTemplate($template_path."add_to_admin.mail",
	 "\$title,\$url,\$description,\$category,\$contact_name,\$email,\$bid,\$site_url");
    
    mail("$admin_email",$msg_2003,$email_body,
     "From: $msg_2004\nX-Mailer: INDEXU_X-Mailer/1.0");
  
  }
  else {
    ShowFormAddLink();
  }
}


// ---------------
//  main program
// ---------------

ConnectDB();
$title = $title_1104;
DisplayTemplate($template_path."header.html","\$title,\$cat,\$ma");

if (empty($pflag)) {  
  ShowFormAddLink();    
}
  elseif($pflag=='add') {
  ProcessFormAddLink(); 
}
DisplayTemplate($template_path."footer.html","\$cat,\$ma");
?>
 
Old 06-09-2005, 04:17 AM   #4
newuser455
Member
 
Registered: May 2004
Location: Texas
Posts: 277

Original Poster
Rep: Reputation: 30
Yes, It was a server problem... I am not sure where the error came from. After rebooting the server, the script works fine.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
submit a form with javascript djgerbavore Programming 6 06-01-2005 02:46 PM
is this php automatic form submit post wriiten correctly? fsock error.. verbatim Programming 1 05-11-2005 10:24 AM
startup takes forever maybbach Linux - Newbie 5 07-07-2004 09:07 PM
Authentication by Submit Form in Apache??????? ruiseixas Linux - Security 1 11-22-2003 11:02 PM
shell script form submit precioso77 Linux - General 2 05-18-2003 11:50 AM


All times are GMT -5. The time now is 05:03 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration