PHP - Form Gives Internal Server Error
I am trying to get this form to submit, but it doesn't go anywhere. I checked the browser console and I see "Failed to load resource: the server responded with a status of 500 (Internal Server Error)". Can someone help me resolve this error?
CODE: <html> <head> <title>PICK 5 :: 13 Ticket System (3 of 5 WHEEL)</title> <style> .wrap{ text-align:center; width:900px; margin: 0 auto; } .row{ margin: 18px 0; } .input{ border:1px solid #ccc; width:800px; float:left; margin:10px; } .output{ width:700px; margin:0 auto; text-align:left; } .output .str{ } .output .number{ font-weight:bold; margin-right:5px; } .clear{ clear:both; } </style> </head> <body bgcolor="#F5F5F5"> <div class="wrap"> <form method="post" action=""> <div class="row"><p><span style="font-weight: bold; color: #0000FF;">PICK 5 :: 13 Ticket System (3 of 5 WHEEL)</span></p> <p>(Guaranteed <span style="font-weight: bold; color: #0080ff;">3-WIN</span>, if 5 of the numbers drawn are in your set of 15 numbers)</p> <label>Please enter 15 numbers and separate them with a comma ","<br></label> <input type="text" name="num" value="<?= isset($_POST['num'])?$_POST['num']:'1,2,3,4,5,6,7,8,9,10,11,12,13,14,15' ?>" /> </div> <div class="row"><input type="submit" name="submit" value="Go" /> </div><br> <?php if(isset($_POST['submit'])){ $num = $_POST['num']; $num_array = explode(',',$num); $alpha_array = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O'); $array1 = array(); for($i=0; $i<15; $i++) { $array1[$alpha_array[$i]] = trim($num_array[$i]); } $array2 = array( array('A', 'B', 'C', 'L', 'M'), // Start 15# (3if5 Wheel) - 13 Lines array('A', 'B', 'D', 'H', 'I'), // Where .. (A1, B2, C3, D4, E5, F6, G7, H8, I9, J10, K11, L12, M13, N14, O15) array('A', 'C', 'G', 'H', 'O'), array('A', 'E', 'K', 'N', 'O'), array('A', 'F', 'G', 'J', 'L'), // LINE 5 array('B', 'D', 'F', 'L', 'O'), array('B', 'E', 'F', 'G', 'I'), array('B', 'H', 'J', 'K', 'N'), array('C', 'D', 'E', 'F', 'J'), array('C', 'I', 'K', 'L', 'N'), // LINE 10 array('D', 'G', 'K', 'M', 'N'), array('E', 'F', 'H', 'L', 'M'), array('F', 'I', 'J', 'M', 'O'), // LINE 13 ); $data = ""; foreach($array2 as $arr){ $data1 = ""; foreach($arr as $a){ $data1 .= $array1[$a] . ', '; } $data[] = rtrim($data1,', '); } ?> <div class="output"> <?php foreach($data as $k=>$v){ echo '<span class="number">'.($k+1) . '.</span><span class="str">' . $v . '</span><br>'; } } ?> </div> <div class="clear"></div> </form> </div> </body> </html> Edited February 25, 2019 by requinix please use the Code <> button when posting code. Similar Tutorialsi tried to access website from a shared network but i keep getting this error. Before this I can access the website through my local host. But since we have started using the shared server.. i cant access most of the websites.. i searched on google they mentioned about php.ini settings. No idea why did my superior changed to iis server.. definitely works on apache before. So I have some php code within an html page (using Apache v2.2, PHP v5.2) that uses MySQLI to connect to a database and fetch some rows from a database. Everything works fine so long as I limit the number of rows fetched, if I try to fetch all the rows, I get a 500 Internal Server Error in my browser. I am using GoDaddy Hosting -- has anyone encountered this problem/know what the hell is going on? test.php: <?php class Forall{ public $var_a=100; function process(){ echo 'This is for testing'.'<br>'; echo '$var_a: '.$this->var_a.'<br>'; } } $obj=new Forall(); $obj->process(); <form action='post' method='insvideo.php'> videotitle: <input type='text' name='nm_videotitle'/><br> description: <input type='text' name='nm_description' /><br> createddate: <input type='text' name='nm_createddate' /><br> image: <input type='text' name='nm_image' /><br> <input type='submit' /> </form> ?> error: Quote Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, admin@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. How can i know the line number for error? I have no idea why it's doing it. I know I'm missing something, but everything looks right to me. When you submit the registration form it just does the error, and properties say its the process page, so this code below. Sorry posting it all, I'm just not sure period. Code: [Select] <?php require('connect.php'); //check all the posted info function getInfo() { $error = array(); $fname = validateFirstname($_POST['fname']); $lname = validateLastname($_POST['lname']); $uname = validateUsername($_POST['uname']); $email = validateEmail($_POST['email']); $password = validatePass($_POST['password1'], $_POST['password2']); $phone = validatePhone($_POST['phone']); //check for errors error(); } function validateFirstname($str) { //This allows just alpha characters and must be at least 2 characters. if (preg_match('/^[a-zA-Z0-9]{2,}$/',$str)) { return preg_match('/^[a-zA-Z0-9]{2,}$/',$str); } else { $error[] = 'Please enter a valid first name!'; } } function validateLastname($str) { //This allows just alpha characters and must be at least 2 characters. if (preg_match('/^[a-zA-Z0-9]{2,}$/',$str)) { return mysql_real_escape_string($str); } else { $error[] = 'Please enter a valid last name!'; } } function validateUsername($str) { //connect to database $link = mysql_connect($db_host, $db_user, $db_pass); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db($db_name); //pull usernames to make sure new is unique $sql = "SELECT username FROM users WHERE username = '".$str."'"; if ($sql == "") { //This allows just alphanumeric characters and must be 4 - 15 characters. if (preg_match('/^[a-zA-Z0-9]{4,15}$/',$str)) { return mysql_real_escape_string($str); } else { $error[] = 'Please enter a valid user name!'; } } else { $error[] = 'This user name is already registered!'; } } function validateEmail($str) { //connect to database $link = mysql_connect($db_host, $db_user, $db_pass); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db($db_name); //pull usernames to make sure new is unique $sql = "SELECT email FROM users WHERE email = '".$str."'"; if ($sql == "") { if (preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$str)) { return mysql_real_escape_string($str); }else{ $error[] = 'Please enter a valid email!'; } } else { $error[] = 'This email is already registered!'; } } function validatePass($str, $str2) { //This allows just alphanumeric characters and must be 6-15 characters. if ($str == $str2) { if (preg_match('/^[a-zA-Z0-9]{6,15}$/',$str)) { return md5(mysql_real_escape_string($str)); } else { $error[] = 'Please enter a valid password!'; } } else { $error[] = 'Passwords do not match!'; } } function validatePhone($str) { //This allows just alpha characters and must be at least 2 characters. if (preg_match('/^[0-9]{0,11}$/',$str)) { return mysql_real_escape_string($str); } else { $error[] = 'Please enter a valid phone number!'; } } function error() { if ($error[] == '') { addInfo(); } else { echo "<a href='javascript: history.go(-1)'><-- Go Back</a><br>"; echo $error[]; } } function addInfo() { //setcookie("site_user", $Name, time() + 31536000, "/"); //setcookie("site_pass", $Password, time() + 31536000, "/"); //Connect to database from here $link = mysql_connect($db_host, $db_user, $db_pass); if (!$link) { die('Could not connect: ' . mysql_error()); } //activation link $a = md5(uniqid(rand(), true)); //select the database | Change the name of database from here mysql_select_db($db_name); $sql="INSERT INTO users (firstname,lastname,email,username,password,phone,active,ip,rank,acctcreated) VALUES ('$fname','$lname','$uname',$email','$lastpass','$phone',$a','$ip','$rank',NOW())"; } // Send the email: $message = " To activate your account, please click on this link:\n\n"; $message .= WEBSITE_URL . '/activate.php?email=' . urlencode($Email) . "&key=$activation"; mail($Email, 'Registration Confirmation', $message, 'From:'.EMAIL); // Flush the buffered output. // Finish the page: echo '<div class="success">Thank you for registering! A confirmation email has been sent to ' . $Email .' Please click on the Activation Link to Activate your account </div>'; ?> Hey guys,
So I making a basic website form to do CRUD operations on a database, and all of my components work, but I keep getting 500 - Internal server error on my index.php
Heres my code:
<?php require_once('config.php'); require_once('menu.php'); echo '<h1>View All Alien Interactions</h1>'; /* Start the table with the fields we want to display Remember $fields is now in config.php */ echo '<table> <tr>'; foreach($fields AS $label){ // th is a table header; the column's title or label. echo "<th>{$label}</th>"; } //Add the edit and delete columns at the end of the table echo '<th>Edit</th><th>Delete</th>'; echo '</tr>'; /* Select the fields we want, from all the rows The first line takes the array keys from our $fields array and implodes them, using backticks and commas. The end result will look like `first_name`, `last_name`, `phone_number`... The next line creates a SELECT query using that string. */ $fields_str = '`contact_id`, `'.implode(array_keys($fields), '`, `').'`'; $sql = "SELECT {$fields_str} FROM `aliens_abduction`"; foreach($dbh->query($sql) as $row) { echo '<tr>'; // Loop through the fields again to display them for this row. // Note: The tutorial originally contained an error here, this has been updated. foreach($fields AS $field=>$value){ // if the field is blank, we want to empty a blank space, otherwise the HTML won't work properly echo '<td>'.(isset($row[$field]) && strlen($row[$field]) ? $row[$field] : ' '.'</td>'); } echo '</tr>'; echo '<td><a href="edit.php?contact_id='.$row['contact_id'].'">Edit</a></td>'; echo '<td><a href="delete.php?contact_id='.$row['contact_id'].'">Delete</a></td>'; echo '</tr>'; echo '</table>'; ?>and heres my config.php code (idk if this is the root of the problem, i dummied out my credentials): <?php //Connect to the database $dbh = new PDO('mysql:host=xxxxxxxxx;dbname=db_demo', 'xxxxx', 'xxxxx'); //Set the default fetch mode to be an associative array. $dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); //Define the fields for our CRUD application $fields = array( 'first_name' => 'First Name', 'last_name' => 'Last Name', 'when_it_happened' => 'When it happened', 'how_many' => 'How many', 'alien_description' => 'Alien description', 'what_they_did' => 'What they did', 'fang_spotted' => 'Fang spotted', 'email' => 'Email' ); ?> Edited by tekkenfan2, 30 June 2014 - 11:56 AM. Hi guys, This has been bothering me for quite some time. I have a piece of code that works absolutely fine on my local XAMPP setup but causes a 500 internal server error when I run it on my host (hostgator). $source = "marketplace_feed_v1.xml"; $xml = simplexml_load_file($source,'SimpleXMLElement', LIBXML_NOCDATA); SimpleXML is enabled on hostgator marketplace_feed_v1.xml is located in the same directory as this script I don't understand why this won't work Any help at all is much appreciated. Whenever I hit submit I get an internal server error. Here is the code:
<?php $modsToBeChecked = str_replace( "\r", "\n", str_replace( "\r\n", "\n", $_POST[ 'modsToBeChecked' ] ) ); $modsToBeChecked = explode( "\n", $modsToBeChecked ); var_dump( $modsToBeChecked );?>$modsToBeChecked is passed in from a textarea form. It is suppose to treat each line in the textbox as one element of the array. Here is the form code in case you need it: <form action=""><textarea name="modsToBeChecked" rows="25" cols="50"></textarea> <input type="submit"> </form> Hi. I had this form all working, but then I commented out some echo's and changed the name of my custom error variables now all of a sudden when I hit submit without all fields I get an INTERNAL SERVER ERROR PAGE. Code: [Select] Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Apache/1.3.33 Server at www.fusionfashionhair.com Port 80 I don't know what else would have causes this as I had it working yesterday? My code: <?php session_start(); ?> <?php $submit = $_POST['submit']; // Form Data $email = $_POST['email']; $password_old = $_POST['password_old']; $password_new = $_POST['password_new']; $password_new_con = $_POST['password_new_con']; $errorcount = 0; // Edit anything inbetween the " " for the display error message $errormsg['sErrEmail'] = "Email Entered is not in our database"; $errormsg['sErrOldPass'] = "Old Password Entered is Incorrect. Please check your Email"; $errormsg['sErrNewPass'] = "New Password must be between 6 and 32 characters"; $errormsg['sErrNewPassCon'] = "New Passwords do not match."; $errormsg['sErrSecCode'] = "Security Code is Invalid"; $errormsg['sErrdbPass'] = "Invalide Email or activation code. Please Contact <a href='mailto:webmaster@fusionfashionhair.com?subject=Fusion Fashion Hair - Member Activation Error%20Request'>Admin</a>"; $errormsg['NoErr'] = "No Errors, Continue"; $errormsg['PlaceHold'] = ""; $errortrack[] = $errormsg['PlaceHold']; if ($_POST[submit]){ if ($errorstop = "go") { $errorstop="go"; while ($errorstop<>"stop") { //Check for security code if ($_SESSION[key]==$_POST[user_code]){ // echo "True - Continue 0"; // echo "<p>----------</p>"; $_SESSION[key]=''; } else { // echo "False - Stop 0"; $errortrack[] = $errormsg['sErrSecCode']; $errorcount++; $errorstop="stop"; } // check email verification if (!checkEmail($email)) { // echo "False - Stop 1"; $errortrack[] = $errormsg['sErrEmail']; $errorcount++; $errorstop="stop"; } else { // echo "True - Continue 1"; // echo "<p>----------</p>"; } // check for existance if (strlen($password_old)>5) { // echo "True - Continue 2"; // echo "<p>----------</p>"; } else { // echo "False - Stop 2"; $errortrack[] = $errormsg['sErrOldPass']; $errorcount++; $errorstop="stop"; } // check for existance if (strlen($password_new)>32||strlen($password_new)<6) { // echo "False - Stop 3"; $errortrack[] = $errormsg['sErrNewPass']; $errorcount++; $errorstop="stop"; } else { // echo "True - Continue 3"; // echo "<p>----------</p>"; } // check for existance if ($password_new_con==$password_new) { // echo "True - Continue 4"; // echo "<p>----------</p>"; $errorstop="stop";//Get Out of loop } else { // echo "False - Stop 4"; $errortrack[] = $errormsg['sErrNewPassCon']; $errorcount++; $errorstop="stop"; } }//End While Loop // Check database require('dbConfig.php'); // Encrypts old password to check with Database Encryped Password $password_old = md5($password_old); $check = mysql_query("SELECT * FROM {$usertable} WHERE email='$email' AND password='$password_old'"); $checknum = mysql_num_rows($check); if ($checknum==1) { // echo "True - Continue 5 Set password"; // echo "<p>----------</p>"; // Encrypts new password $password = md5($password_new); //run a query to update the account $acti = mysql_query("UPDATE {$usertable} SET password='$password' WHERE email='$email'"); } else { // echo "False - Stop 5"; $errortrack[] = $errormsg['sErrdbPass']; $errorcount++; $errorstop="stop"; }//End if checknum // echo "True - Continue 6 GO TO HEADER PAGE"; // Thank you Page $insertGoTo = "changepass.php"; header(sprintf("Location: %s", $insertGoTo)); //send confirmation email $to = $email; $subject = "Password Changed for Fusion Fashion Hair"; $headers = "From: webmaster@fusionfashionhair.com"; $server = "mail.fusionfashionhair.com"; //change php.ini and set SMTP to $server ini_set("SMTP",$server); $body = " Password Successfuly changed for $email, \n\n Please click on the link provided below to activate the account with Fusion Fashion Hair http://www.fusionfashionhair.com/activate.php?id=$lastid&code=$random \n\n Thank you, Customer Service Contact webmaster for any concerns regarding this email. <a href='mailto:webmaster@fusionfashionhair.com?subject=Fusion Fashion Hair - Password Change Error%20Request'>Admin</a>. "; //function to send email mail($to, $subject, $body, $headers); } else { while($errorcount>=0) { // Test display all error messages // echo "<p>----------</p>"; // echo "<p>Error Count = '$errorcount'</p>"; } $errormsg['MissAll'] = "Please Enter in ALL Fields!"; die ("PLEASE FILL IN ALL FIELDS"); }// End If Error Go }// End if Submit ?> <?php // LINUX PLATFORM OPTION 3 // checkEmail function checks standard email format same as preg_match() // checkEmail function checks DSN records using checkdnsrr Use list() to seperate name and domain using split function // checkdnsrr ONLY WORKS on LINUX PLATFORM // Check to see if domain and username is active // uses fsockopen() to check if its in use using port 25 function checkEmail($email) { // checks proper syntax if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/" , $email)) { // gets domain name list($username,$domain)=split('@',$email); // checks for if MX records in the DNS if(!checkdnsrr($domain, 'MX')) { return false; } return true; } return false; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Fusion Fashion Hair, Loop Hair Extensions Winnipeg, MB </title> <link href="css/thrColLiqHdr.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="css/p7exp.css"/> <link rel="stylesheet" type="text/css" href="css/loginforms.css"/> <!--[if lte IE 7]> <style> .content { margin-right: -1px; } /* this 1px negative margin can be placed on any of the columns in this layout with the same corrective effect. */ ul.nav a { zoom: 1; } /* the zoom property gives IE the hasLayout trigger it needs to correct extra whiltespace between the links */ </style> <![endif]--> </head> <body onLoad="document.getElementById('user_code').focus();"> <body> <div class="container"> <div class="header"><img src="mainlogo3.gif" width="824" height="353" alt="Fusion Fashion Hair" /> </div> <!-- end .header --> <div id="menuwrapper"> <ul id="p7menubar"> <li><a href="#">Home</a></li> <li><a href="#">Products</a></li> <li><a href="#">Shipping</a></li> <li><a href="#">Instructions</a></li> <li id="LastItem"><a href="#">Contact Us</a></li> </ul> </div> <!-- end menuwrapper --> <div class="sidebar1_login"> <h1 class="left">Welcome to Fusion Fashion Hair</h1> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <!-- end .sidebar1 --></div> <div class="content_login"> <p> </p> <div class="divider"><!--Page From Divider Line--> <p> </p> </div> <!--End of Divider--> <p> </p> <form action='newpassform.php' method='post' id="regform"> <fieldset> <legend>Change Password</legend> <p><?php foreach ( $errortrack as $value) { //( $errortrack as $key => $value) echo "<span class='errorcode'>$value</span>";}?> </p> <p> <label for='email'>Email:</label> <input name='email' type='text' maxlength="25" value='<?php echo $email; ?>'/> </p> <p> <label for='password_old'>Old Password:</label> <input name='password_old' type='password' maxlength="32" /> </p> <p> <label for='password_new'>New Password:</label> <input name='password_new' type='password' maxlength="32"/> </p> <p> <label for='password_new_con'>Confirm Password:</label> <input name='password_new_con' type='password' maxlength="32"/> </p> <p><span class="required">*</span> Note, username and password are case sensitive</p> <p>Forgot your password? <a href="forgot_password.php">Click Here</a></p> <p>Login <a href="login.php">Here</a></p> <h2>Security Check</h2> <p>Enter letters below exactly how they are displayed. Letter are case sensitive. </p> <br /> <img src="captcha.class.php?usefile=1" /> <!--OR--> <!--<img src="image.php" />--> <input id='user_code' name='user_code' type='text' size='10' > <p> </p> <input class="reset" type='reset' value='Cancel' name='reset'> <input class="submit" type='submit' value='Continue' name='submit'> </fieldset> </form> <!--End of Form--> <!-- end .content --> </div> <div class="sidebar2_login"> <p> </p> <p> </p> <p> </p> <p> </p> <!-- end .sidebar2 --></div> <div class="footer"> <!-- end .footer --></div> <!-- end .container --></div> </body> </html> Hello, So I have a weird error where if I fetch more than a certain number of rows from a mysql table, it triggers a 500 Internal Server Error. I am using Apache Web Server (through GoDaddy) and the offending code is below: Code: [Select] set_time_limit(0); $this->Connect(); $Output = array(); $search = "SELECT * FROM <table> WHERE user_id = ?"; if($Statement = $this->MySQLi->prepare($search)){ $Statement->bind_param("i", $UserId); $Statement->execute(); $Statement->bind_result(<result variables>); $count = 0; while($Statement->fetch() && $count++ < 70){ ChromePhp::log(<result variables>); } $Statement->close(); } $this->Disconnect(); ChromePhp::log is a way of dumping things to the Javascript Console in your browser from within a PHP script just as a heads-up. So when I set the stop number as 70, everything is fine. If I try to fetch more than that it triggers a 500 internal server error on Apache Server port 443. I have looked through the error logs and can't figure out the cause but this is almost certainly a server configuration issue? I'd appreciate any feedback, especially anyone familiar with GoDaddy's hosting services Thanks Hello, I am using the Pear Mail and Mail_Mime packages to send SMTP authenticated HTML formatted emails. I was successfully sending emails when I started getting the following error: sendmail: 451 Internal Error I check out the sendmail logs at /var/log/mail.log but that only says the same thing. I am running Linux-Ubuntu and sending emails from an address on a remote server (godaddy hosted). The interesting thing is that this exact same code will run to completion and fail. Any thoughts? Anyone with Pear Mail experience, is there any way to end the SMTP session, maybe that is the problem. I also think an issue might be that the server thinks my IP is sending too many emails, any way to provision against that? Thanks for any insight and please let me know if other information might be helpful to debug this.
Dear all, try{ $excelContent = chr(255).chr(254).@mb_convert_encoding($excelContent, 'UTF-16LE', 'UTF-8'); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } Do you have any idea about this code? I try to catch the error but it's not work Edited June 28 by nitiphone2021According to I would like to try to use JWT for my PHP and these are my step
on domain/app/
so I have
and on the login.php try{ echo "1"; require_once('vendor/autoload.php'); use firebase\JWT\JWT; echo "2"; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; }
It's not show any thing and error "HTTP ERROR 500" That's my first time to see this kind of issue.
The PROD environment: Godaddy, IIS7, PHP5.4.30
The Local environment: Linux, PHP 5.5.X
The framework: CodeIgniter 2.2.0
Process:
I have view have form to update multiple files.
echo form_open_multipart('admin/UploadFiles');The controller will do an initial check, if( isset($_SERVER["CONTENT_LENGTH"]) && ($_SERVER["CONTENT_LENGTH"]>((int)ini_get('post_max_size')*1024*1024))) { $this->session->set_flashdata('upload_error', 'Your file is too big to handle.'); redirect($_SERVER['HTTP_REFERER']); } else { if($_FILES['files']['error'][0] != 0) { $this->session->set_flashdata('upload_error', 'There are no files selected.'); redirect($_SERVER['HTTP_REFERER']); } else { $photo_info = array(); $photo_info = $_FILES['files']; $this->load->model('uploadfile'); $results = $this->uploadfile->UploadImages($photo_info); // My debug echo "<pre>"; print_r($results); echo "</pre>"; // redirect($_SERVER['HTTP_REFERER']); }In my model file, for debug purpose, I only put these lines. Since I have traced the code line one by one, finally found the 500 error happens here. if (!empty($this->CheckFileError($images))) { $results['fail'] = $this->CheckFileError($images); foreach($this->CheckFileError($images) as $err) $error_idx[] = $err['index']; }It happens on empty($this->CheckFileError($images)) //$this->CheckFileError($images) is an arrayIf I just "return $this->CheckFileError($images)", it has no error at all. But If I do the code above, it will give me Internal 500 error. After I change to count($this->CheckFileError($images)) == 0everthing works. All the other logics in the actual model are remain same. I only change this line. It has no problem at all in my local. Only when I run it on my Godaddy IIS share hosting. Initially I thought the temp folder to hold the files is not writable. I even spent whole night to talk to Godaddy guys, but no progress. Even I tried create .user.ini to change the "upload_tmp_dir", it still gave me 500 error. Tonight, I debugged my code lines one by one, tested it in local first, then tested in Godaddy. Finally I found the root cause for my internal 500 error. However, I don't know why empty() will cause this issue. Can anyone explain it? I Googled, but didn't find any userful information. The reason why I use IIS is because I write my most of the services in WCF. Thanks! Edited by TFT2012, 01 October 2014 - 12:33 AM.
According to I have a project need to use PHP 5.6.40 connect to mysql version 5.7.34
when I try to connect it by below coding $servername = "localhost"; $username = "user"; $password = "pass"; $db_database = 'db_unelr'; $db_port = '3306'; // Create connection $conn = mysqli_connect($servername, $username, $password,$db_database,$db_port); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "Connected successfully";
it's show 500 internal error.
This topic has been moved to Apache HTTP Server. http://www.phpfreaks.com/forums/index.php?topic=351923.0 ok this is killing me!!!!! I have a form with serveral fields but I'm only going to show one field for now <?php include('/Connections/dbconnect.php'); ?> <?php if(isset($_POST['long'])){ $name = trim($_POST['fullname']); $insertq = ("INSERT INTO customer_details (`full_name`,) VALUES (`$name`) "); $insert = mysql_query($insertq) or die (mysql_error); $url = "/index.php"; header("Location: $url"); } ?> <form action="" method="POST" name="longform1" id="longform1" > <input name="fullname" type="text" id="fullname" size="25" maxlength="50" /> <input type="submit" name="long" id="long" value=" Submit " /> </form> in the data base I have a table called "customer_details" which has customerID, full_name simple stuff so far!!!!!!!!!!! the database conntect file has............... $hostname_superconnect = "localhost"; $database_superconnect = "connect"; $username_superconnect = "name"; $password_superconnect = "password"; $superconnect = mysql_pconnect($hostname_superconnect, $username_superconnect, $password_superconnect) or trigger_error(mysql_error(), mysql_select_db($database_superconnect); when I enter a name into the field the page comes back blank and says only.... mysql_error When I check the server error logs i get..... [Wed May 11 16:17:25 2011] [error] [client ] File does not exist: /home/sites/site.com/public_html/none [Wed May 11 16:17:38 2011] [error] [client ] PHP Warning: include(../Connections/dbconnect.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/sites/site.com/public_html/index.php on line 1, referer: http://www.site.com/index.php [Wed May 11 16:17:38 2011] [error] [client ] PHP Warning: include(../Connections/dbconnect.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/sites/site.com/public_html/index.php on line 1, referer: http://www.site.com/index.php [Wed May 11 16:17:38 2011] [error] [client ] PHP Warning: include() [<a href='function.include'>function.include</a>]: Failed opening '../Connections/dbconnect.php' for inclusion (include_path='.:/usr/share/pear5') in /home/sites/site.com/public_html/index.php on line 1, referer: http://www.site.com/index.php [Wed May 11 16:17:38 2011] [error] [client ] PHP Warning: mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: Access denied for user 'sit'@'localhost' (using password: NO) in /home/sites/site.com/public_html/index.php on line 14, referer: http://www.site.com/index.php [Wed May 11 16:17:38 2011] [error] [client ] PHP Warning: mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: A link to the server could not be established in /home/sites/site.com/public_html/index.php on line 14, referer: http://www.site.com/index.php Does anybody know whats wrong here. It must be a server error but thats just a beginners guess Hi all, I have an ajax comment system that is meant to be quite simple! This works fine on localhost, but when on my vps for some reason its throwing a 500 error. I have checked the logs but nothing is mentioned. I am wondering if anyone can throw some light on where to start? Chrome shows this: Request URL:http://www.buy2earn.co.uk/submit.php Request Method:POST Status Code:500 Internal Server Error Request Headers Accept:application/json, text/javascript, */* Content-Type:application/x-www-form-urlencoded Origin:http://www.buy2earn.co.uk Referer:http://www.buy2earn.co.uk/viewm.php?m_id=1 User-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 X-Requested-With:XMLHttpRequest Form Data name:admin merchant:1 body:gjgjkgj Response Headers Connection:close Content-Length:0 Content-Type:text/html; charset=UTF-8 Date:Tue, 23 Nov 2010 19:48:22 GMT Server:Apache/2.2.3 (CentOS) X-Powered-By:PHP/5.2.13 submit.php exists at the location shown hello when i put in my script i get a server error The website encountered an error while retrieving http://www.webiste.com/storeadmin/admin_login.php. It may be down for maintenance or configured incorrectly. Here are some suggestions: Reload this webpage later. HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request. Code: [Select] <?php session_start(); if (isset($_SESSION["manager"])){ header("location:index.php"); exit(); } //check if their loged in ?> <?php if (isset($_POST["username"])&&isset($_POST["password"])){ $manager = preg_replace('#[^A-Za-z0-9]#i',",$_POST["username"]); $password = preg_replace('#[^A-Za-z0-9]#i',",$_POST["password"]); //connect to db include"../storescripts/connect.php"; $sql = mysql_query("SELECT id FROM admin WHERE username ='$manager' AND password='$password' LIMIT 1"); //make sure manager exsits $exsitCount = mysql_num_rows($sql);//counts the rows nums if($exsitCount == 1){ while($row = mysql_fetch_array($sql)){ $id= $row["id"]; } $_SESSION["id"]=$id; $_SESSION["manager"]=$manager; $_SESSION["password"]=$password; header("location:index.php"); exit(); }else{ echo 'That information is incorrect, try again <a href="index.php">Click here</a>'; exit(); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <div align="center" id="mainWrapper"> <?php include_once("../header.php");?> <div id="pagecontent"><br /> <div align="left" style="margin-left:24px;"> <h2>Please Log In To Manage The Store</h2> <form id="form1" name="form1" method="post" action="admin_login.php"> User Name:<br /> <input name="username" type="text" id="username" size="40"/> <br /><br /> Password:<br /> <input name="password" type="password" id="password" size="40"/> <br /> <br /> <br /> <label> <input type="submit" name="button" id="button" value="Login" /> </label> </form> <p> </p> </div> <br /> <br /> <br /> </div> <?php include_once("../footer.php");?> </div> </body> </html> Hi. I'm trying to build a sort of blog where users have to register to post questions/comments. My problem is with the registration part. Here is part of the code: Code: [Select] <form name="registration" method="post" action="registration.php"> <tr><td align="left">Nume</td> <td align="right"><input type="text" name="name" onKeyUp="validare()"></td></tr> <tr><td align="left">Email</td> <td align="right"><input type="text" name="email" onKeyUp="validare()"></td></tr> <tr><td align="left">Username</td> <td align="right"><input type="text" name="username" onKeyUp="validare()"></td></tr> <tr><td align="left">Parola</td> <td align="right"><input type="password" name="password" onKeyUp="validare()"></td></tr> <tr><td align="left">Confirmare parola</td> <td align="right"><input type="password" name="pass_conf" onKeyUp="validare()"></td></tr> <tr><td align="left">Anti-spam</td> <td><script type="text/javascript">DrawBotBoot()</script></td></tr> <tr><td></td><td><input type="submit" name="register" value="Inregistreaza-te" disabled="true"></td></tr> </form>... </html> Code: [Select] <?php $host="mysql3.***************"; $username="a7129718_root"; $password="hello2"; $db_name="a7129718_site"; $tbl_name="members"; // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT MAX(id) AS Maxa_id FROM $tbl_name"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); if ($rows) { $Max_id = $rows['Maxa_id']+1;} else { $Max_id = 1;} $name=$_POST['name']; $email=$_POST['email']; $user=$_POST['username']; $pass=$_POST['password']; $sql2="INSERT INTO $tbl_name(id, name, email, username, password)VALUES('$Max_id', '$name', '$email', '$user', '$pass')"; $result2=mysql_query($sql2); if($result2){ header("location:login.html");} else{ echo "cannot insert into table";}} ?> The problem is: there is no error message. The server just redirects me to their error page, which doesn't contain any error code, just some ads. Can you tell me what the problem might be? Thank you in advance. Bye." Hi guys, I had my code working fine as a login page untill I added sprintf and mysql_real_escape_string and since then when i test the form to login, server keep loading and then come up with this msg Fatal error: Maximum execution time of 30 seconds exceeded in ../Dashboard/index.php on line 35 which is (Line 35) Quote while($row=mysql_fetch_array(mysql_query($getpin))){ I have my code below, can u please help me what is wrong? im coding in dreamweaver and it doesnt have any error in there. Code: [Select] <?php include ('includes/db/db.php'); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title></title> <link rel="stylesheet" href="./css/reset.css" type="text/css" media="screen" title="no title" /> <link rel="stylesheet" href="./css/text.css" type="text/css" media="screen" title="no title" /> <link rel="stylesheet" href="./css/form.css" type="text/css" media="screen" title="no title" /> <link rel="stylesheet" href="./css/buttons.css" type="text/css" media="screen" title="no title" /> <link rel="stylesheet" href="./css/login.css" type="text/css" media="screen" title="no title" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head> <body> <div id="login"> <h1>Dashboard</h1> <?php if (isset($_POST['login']) && $_POST['login']){ $email=addslashes(strip_tags($_POST['email'])); $in_password=addslashes(strip_tags($_POST['password'])); $pin=addslashes(strip_tags($_POST['pin'])); $password=md5($in_password); if (!$email || !$in_password || !$pin) echo "<div class='error'>Please fill all required fields</div>"; else{ $getpin=sprintf("SELECT * FROM users WHERE UserEmail='%s' AND UserPassword='%s'", mysql_real_escape_string($email) , mysql_real_escape_string($password)); while($row=mysql_fetch_array(mysql_query($getpin))){ $pin_email=$row['UserEmail']; $pin_id=$row['UserId']; $pin_company_id=$row['company_id']; $pass=$row['UserPassword']; } $get=sprintf("SELECT pin FROM company WHERE company_id='%s' AND active='%s'", mysql_real_escape_string($pin_company_id), mysql_real_escape_string(1)) ; while($row=mysql_fetch_array(mysql_query($get))){ $pin_num= $row['pin']; } if($password==$pass && $pin_num==$pin && $email==$pin_email) { echo"success"; } else { echo "<div class='error'>Login Failed, Login details are incorrect!</div>"; } } } ?> <div id="login_panel"> <form action="" method="post" accept-charset="utf-8" /> <div class="login_fields"> <div class="field"> <label for="email">Email</label> <input type="text" name="email" value="" id="email" tabindex="1" placeholder="email@example.com" /> </div> <div class="field"> <label for="password">Password <small><a href="forgotpassword.php">Forgot Password?</a></small></label> <input type="password" name="password" value="" id="password" tabindex="2" placeholder="password" /> <div class="field"> <label for="pin">Pin Number</small></label><input type="password" name="pin" value="" id="password" tabindex="2" placeholder="pin"/> </div> </div> </div> <!-- .login_fields --> <div class="login_actions"> <input type="submit" name="login" value="Login" class="btn btn-grey"/> </div> </form> </div> <!-- #login_panel --> </div> <!-- #login --> </body> </html> thanks you all in advance. |