PHP - Internal Ip?
Hey guys quick question.
I have one static ip address that if i put in the broswer it will forward to the internal ip of my server and will display my website which is located on my server. In my house i also have a development pc which is accessibal within my local network and i would like to be able to view it from my website in an iframe or something. My goal is to just go to my website have a page which will load the local internal ip of my dev pc and display my wamp folder. so i can show my clients the progress on their site. I know this is now good practice but this is just and simplified example of what i am trying to achieve. I would like to display te internal ipaddress on my webserver so that when im on the road i can simply click a link on my website and display the content of my dev pc wamp server? Is ther a special link that i need to use? Is this possible with or without PHP? Should i use an iframe? Similar TutorialsHi guys! I'm having a problem with my search bar on my company website. I don't know what's going on, I think that everething is ok. But I'm not a master with php. If anyone can help me with this, I'll be very apprceitte it. Here is the code.
<!-- SEARCH --> hi, sorry if is a very noob question in this site http://thevalley.org.au/index.php I have changed the info in the link contact us, I know is there changed, cause if I hit the open in new tab contact us, or go to http://thevalley.org.au/contact.php it opens the link in the actual content, but, when it opens the contact us in the side menu, I see the old info how to refresh it, as F5 doesnt seem to work?? thank you! Hey guys and gals!
I am currently working on implementing the following functionality in one of my pages:
Whenever a person with a specific IP address visits the page, an internal countdown timer of 2 hours should be started. Until that timer is active, the only response from the page ANYONE can get would be a predefined echo value. Once the timer has run out, the normal script execution of the rest of the page should be restored.
Any pointers and tips on how to approach that would be greatly appreciated.
Only thing I really miss from PHP is "internal" access modifier. Before I was making libraries and extensions in C# (like game frameworks, Tiled implementations, GUI loaders). Now, when I am working on my own PHP framework, I really miss internal, I was using it a lot in C#. Is internal planned to be added in PHP 7 or is it already in PHP 5.6 or it will never be added?
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? i 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. 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. I look at my phpinfo() output, and it has ISO-8859-1 and ISO-8859-15 all over it. UTF is not listed once.
Furthermore, mb_internal_encoding() displays it as ISO-8859-1.
For the most part, I stick to the default settings unless I have a specific reason to change.
Should I be changing php.ini to use UTF-8? If so, any specific advice how to do so? This whole encoding issue has been causing me major grief today
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?
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 nitiphone2021Hi All "mb_internal_encoding()" sets internal encoding. What actually this internal encoding is used for? Is input(POST, GET, data from DB, cookies) transformed into this internal encoding? Or this internal encoding is used only as a default encoding for string processing? Thank you. 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. The following links propose two different versions https://docs.phpdoc.org/3.0/guide/references/phpdoc/tags/internal.html https://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.inlineinternal.pkg.html Respectively
{@internal} The second link, in particular, mentions CitazioneUnlike other inline tags, {@internal}} may contain other inline tags due to its purpose. To terminate an {@internal}} inline tag, you must use two ending brackets "}}" Which is the correct one? 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. Is there a way to get the mysql's internal pointer position? I have searched Google, found this: Code: [Select] <?php function mysql_pointer_position($result_set) { $num_rows = mysql_num_rows($result_set); $i = 0; while($result = mysql_fetch_array($result_set)) { $i++; } $pointer_position = $num_rows - $i; //Return pointer to original position if($pointer_position <= $num_rows - 1) { mysql_data_seek($result_set, $pointer_position); } return $pointer_position; } ?> But I don't really like it. Is there a better way to find the current position of the internal pointer? 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. According 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" 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 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. 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> |