PHP - Moved: Reaching Htdocs In Network Using Ftp
This topic has been moved to Other Web Server Software.
http://www.phpfreaks.com/forums/index.php?topic=318962.0 Similar TutorialsThis topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=327407.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=331047.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=345560.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=347192.0 Hey! I have a small code where I want to check if one variable matches the other when the other is sent through a function. The function, for practical reasons, is included with a separate PHP-file. And I cant seem to apply a variable to the function which processes the other variable. Its really wierd to me. Here is the code for the main PHP-file: Code: [Select] <?php include 'function.php'; $unformatted = "FORMATTING AY ..."; $formatted1 = "formattingay..."; $formatted2 = test_format($unformatted); if ($formatted1 == $formatted2) { echo "Success, formatted!"; } else { echo "Fail, unformatted."; } ?> And here is the code for "function.php": Code: [Select] <?php function test_format($var) { strtolower(str_replace(array(" "), array(""), $var)); } ?> Does anybody have a clue to why this simply wont work? Any answers and help is highly appreciated! I have a while loop in a script that is running for a very long time due to the large values that are passing through it. Below is the link to the pastebin code and code embedded in this forum. Loop Statement Snipet if (!$user_class->invincible) { if (!$defender->invincible) { while ($yourhp > 0 && $theirhp > 0) { $damage = round($defender->moddedstrength) - $user_class->moddeddefense; $damage = ($damage < 1) ? 1 : $damage; if (!$wait) { $yourhp = $yourhp - $damage; ++$number; $log[] = $number . ": " . $defender->formattedname . " hit you for " . prettynum($damage) . " damage using their " . $defender->weaponname . ". <br />"; } else $wait = 0; if ($yourhp > 0) { $damage = round($user_class->moddedstrength) - $defender->moddeddefense; $damage = ($damage < 1) ? 1 : $damage; $theirhp = $theirhp - $damage; ++$number; $log[] = $number . ": " . "You hit " . $defender->formattedname . " for " . prettynum($damage) . " damage using your " . $user_class->weaponname . ". <br />"; } } $log = array_slice($log, -10, 10, true); foreach($log as $text) echo $text; } else $yourhp = 0; } else $theirhp = 0;
My issue is that $yourhp and $theirhp can be in the 100's of thousands causing this to loop half a million plus times. I was curious if there was a way to only show the first few lines and last few lines of this but still retain the increment value that's created? Thanks so much in advance. NICON I installed Xampp on my Windows computer. It actually works well, but one thing that is a bit annoying is the fact that when you want to show the output of a PHP document, then it is necessary for the site to be located in the htdocs folder of C:\xampp. Or is it necessary? Is there a way to sort of "redirect" to another folder on the computer? I have my system (Windows 7) on my C drive and my data on my D drive. Sometimes I clone my C drive to keep it up to date and fast. Is there a way to have my website files on the D drive and Xampp installed in the default location on C:\xampp and still be able to test my site locally?
Erik
hello, please i need ur help!!!! when i enter this url in my browser:http://localhost:10080/ntop/dumpData.html?language=php&proto i get: $ntopHash = array( 'ff02::1:2' => array( 'index' => '0', 'hostNumIpAddress' => 'ff02::1:2', 'hostResolvedName' => 'ff02::1:2', 'firstSeen' => '1337008485', 'lastSeen' => '1337009340', 'minTTL' => '0', 'maxTTL' => '0', 'pktSent' => '0', 'pktRcvd' => '15', 'ipBytesSent' => '0', 'ipBytesRcvd' => '0', etc...... so i'm writing a script to extract these informations and put them in a new web interface in a table. my script is: Code: [Select] <HTML> <HEAD> <LINK REL=stylesheet HREF=http://localhost:3000/style.css type="text/css"> </HEAD> <BODY BGCOLOR=red> <?php $host="localhost"; $port=10080; $url="http://localhost:10080/ntop/dumpData.html?language=php&proto"; $fp = fsockopen ($host, $port); if (!$fp) { echo "$errstr ($errno)<br>\n"; } else { $outStr = ""; fputs($fp, "GET $url HTTP/1.1\r\nHost: $host\r\n\r\n"); while (!feof($fp)) { $out = fgets($fp,128); if($out == "\n") $begin = 1; else if($begin = 1) $outStr = $out; } fclose ($fp); #echo "<pre>$outStr</pre>"; eval($outStr); } echo "<center>\n<table border>\n"; echo "<tr><th BGCOLOR=white>Sessions</th><th BGCOLOR=white>Values</th></tr>\n"; while (list ($key, $val) = each($ntopHash)) { echo "<tr><th align=center BGCOLOR=white>$key</th>\n"; echo "<td><table border>\n"; while (list ($key_1, $val_1) = each ($val)) if(gettype($val_1) == "array") { echo "<tr><th align=left>$key_1</th><td><table border>\n"; while (list ($key_2, $val_2) = each ($val_1)) { echo "<tr><th align=left>$key_2</th><td align=right> $val_2</td></tr>\n"; } echo "</table></td></tr>\n"; } else if($val_1 != "0") { if($key_1 == "sessionState") { if($val_1 == 0) $val2 = "SYN"; else if($val_1 == 1) $val2 = "SYN_ACK"; else if($val_1 == 2) $val2 = "ACTIVE"; else if($val_1 == 3) $val2 = "FIN1_ACK0"; else if($val_1 == 4) $val2 = "FIN1_ACK1"; else if($val_1 == 5) $val2 = "FIN2_ACK0"; else if($val_1 == 6) $val2 = "FIN2_ACK1"; else if($val_1 == 7) $val2 = "FIN2_ACK2"; else if($val_1 == $val2 = "TIMEOUT"; else if($val_1 == 9) $val2 = "END"; echo "<tr><th align=left>$key_1</th><td align=right> $val2</td></tr>\n"; } else echo "<tr><th align=left>$key_1</th><td align=right> $val_1</td></tr>\n"; } echo "</table></td></tr>\n"; } echo "</table>\n"; // echo "<pre>$outStr<pre>"; ?> </center> </body> </html> and i'm having this error: Sessions Values Warning: Variable passed to each() is not an array or object in C:\xampp\htdocs\projet\sessions.php on line 33 please i need your helpppp I have 2 issues happening, first one I need to get resolved is, line 60 is giving me a 'Notice: Undefined variable: delete'. This codes had multi issues but was able to resolve all but this one and my table not filling in with the data from my database. If you need any other info please let me know, Again I am new at this.
<tr> <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete value="delete"></td> </tr> <?php // Check if delete button active, start this *line 60* -----> if ($delete){ for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $sql = "DELETE FROM $tbl_name WHERE id='$del_id'"; $result = mysqli_query($sql); } // if successful redirect to delete_multiple.php if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete_multiple.php\">"; } } mysqli_close($con); ?> Hell Every one , there is some problem in this code one line 54,117,129 and 133
please help me
l attached
registration.php 5.72KB
1 downloads file .please download the attached file.
I am getting these errors . This is my complete HTML page. Everything seems to work fine but when i retweet a message these error show up. Here is my tweet.php and the errors are at line 32 and 41. Previously there was an error at line 24: It was like this: '.((!empty($tweet->retweetMsg) && $tweet->tweetID === $retweet['tweetID'] or $tweet->retweetID > 0) ? ' I changed it to this and the error went away '.((isset($retweet['retweetID']) ? $retweet['retweetID'] === $tweet->retweetID OR $tweet->retweetID > 0 : '') ? ' Maybe this could help! I will really appreciate any suggestion coming my way! I have a PHP app that I wrote that requires a new IP address each time that it is run. Currently I use Tor on my desktop and the Vidalia app to change the Tor identity each time I run the script but I want to automate this. Can anyone help with switching Tor identities with PHP? Essentially after my script runs I need to call a function that switches to a new Tor identity. I have the following code but it doesn't seem to work, and I am not sure why. I am running this from XAMPP on OSX, Tor is running locally (client not server)... in my Tor settings I have 127.0.0.1 and port 9051, set to "no password"... Code: [Select] <?php function tor_new_identity($tor_ip='127.0.0.1', $control_port='9051', $auth_code='') { $fp = fsockopen($tor_ip, $control_port, $errno, $errstr, 30); if (!$fp) { return false; //can't connect to the control port } fputs($fp, "AUTHENTICATE $auth_code\r\n"); $response = fread($fp, 1024); list($code, $text) = explode(' ', $response, 2); if ($code != '250') { return false; //authentication failed } //send the request to for new identity fputs($fp, "signal NEWNYM\r\n"); $response = fread($fp, 1024); list($code, $text) = explode(' ', $response, 2); if ($code != '250') { return false; //signal failed } fclose($fp); return true; } tor_new_identity(); ?> Hi, I'm a bit of a newbie when it comes to PHP. I'm a thirs year music/music tech student and for my disseration I took a very ambitious task. I want to create a sort of social networking site for musicians. But I wanted to create it dynamically using PHP and MySQL. I want to basically allow users to register and sign up with their details basically. But the first problem I came across was actually making a custom registration page, I wanted things such as post codes (zip codes) so that I would then have a Google Maps overlay showing where users were. So that you could 'see' you local music 'scene'. So far I've been playing around with Joomla, Drupal and WordPress. I tried writing the PHP from scratch but after following various tutorials, but I had no luck what-so-ever with that approach. So I started using content management systems, which got me a lot closer, but I found I couldn't really edit custom registration pages etc. And the I would have no idea how to get the Google maps idea working. If anyone could nudge me in the right direction and give me a few tips and ideas as to how I'm most likely to achieve this then please reply, I would be highly grateful for you responses. Thanks, Ewan Valentine. Hi all, I am trying to create a socket that can read from and write to a client. This is my first attempt at it and the code in question is based more or less on a python script a friend sent me as well as some php tutorials google supplied. The problem is (and this seems to be a reoccurring one) when I run it from the command line Code: [Select] php -q server.php nothing visibly happens. Can anyone see what the problem might be? Code: [Select] <?php $host = "localhost"; $port = 50007; set_time_limit(0); // no timeout $socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n"); // create $result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n"); // bind $result = socket_listen($socket, 3) or die("Could not set up socket listener\n"); // listen echo "Waiting for connections...\n"; $contact = socket_accept($socket) or die("Could not accept incoming connection\n"); // accept $input = socket_read($contact, 1024) or die("Could not read input\n"); // read $input = trim($input); // clean $output = "Greetings, you have connected to a socket.\n"; socket_write($contact, $output, strlen ($output)) or die("Could not write output\n"); // return socket_close($contact); // close socket socket_close($socket); // close socket ?> Hi Guys.
Doing an assignment for uni, and stuck on an error. Ill attach some files to show the problem and any help very much appreciated.
Error and the screen it comes on
Code
<?php $select = mysqli_query($con, "SELECT * FROM categories");
while ($row = mysqli_fetch_assoc($select)) { }
function dispsubcategories($parent_id) {
}
function getnumtopics($cat_id, $subcat_id) {
and the structure of the database
Edited March 28, 2020 by Ben555 Hi,
I'm not sure if this is possible, however I'm sure somebody will be able to point me in the right direction. Relativley new to php here.
I would like to write a small app that will change my IP/Subnet Mask/Gateway depending on a selection made from a dropdown list. I will have a tota; of 50 different IP settings & drop downs (each drop down will represent a different location)
I have yet to start writing the app, just on paper so far - can this be done?
I have seen examples of batch scripts like the one below that work, would I need to incorporate something like this into my php?
netsh int ipv4 set address name="Local Area Connection" source=static address=10.127.86.25 mask=255.255.255.240 gateway=10.127.86.30This is just a personal project, I'm trying to further my knowledge! Thanks J Is there a way to write a file to a directory on my network? I tried creating a shortcut called automated and pointed it to the network path. I also set up a virtual directory called automated in IIS and still could not make it work. I gave it read and write permissions. error Warning: fopen(C:\Inetpub\wwwroot\dompdf\automated\resource.pdf) [function.fopen]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\date.php on line 69 Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\Inetpub\wwwroot\date.php on line 70 Warning: fclose() expects parameter 1 to be resource, boolean given in C:\Inetpub\wwwroot\date.php on line 71 code Code: [Select] require_once("dompdf/dompdf_config.inc.php"); $html = '<html><body>'. '<p>Put your html here, or generate it with your favourite '. 'templating system.</p>'. '</body></html>'; $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->render(); $pdfoutput = $dompdf->output(); $filename = "C:\\Inetpub\\wwwroot\\dompdf\\automated\\resource.pdf"; $fp = fopen($filename, "a"); fwrite($fp, $pdfoutput); fclose($fp); Hello, Greetings! I have php application for restaurant, basically there are two types of orders Kitchen Items and Bar items. A cashier enters a order from customers from computer A (say). We have two computers in kitchen, Computer B and in Bar, Computer C. When cashier from computer A clicks a button, depending upon the order type i need to print a chit on Computer B and/or Computer C. COmputer A, B, C are in same network. All computers have laser printer which can print any type of content. Well i tried to search the forum, i couldn't find anything that would be of my help. Can anyone tell me what would be the starting point for this?? Thanks watsmyname My user needs me to update the database on their server from data contained in a text file but do not want me to upload the text file to the server but rather read the file from wherever it exists. Across the intranet. Uploading the file means that whomsoever needs to do this update requires write permission to a folder on the server & my user does not want that. Suggestions on how I should solve this problem would be greatly appreciated. BTW My code works fine if I upload the file and do the update in place on the server.
Hello all, <?php // Connect to Phpmyadmin database localhost. $hostname = "localhost";//"";127.0.0.1 $username = "root"; $password = "password";//"password"; $dbname = "test"; $conn = new mysqli($hostname, $username, $password, $dbname); if($conn -> connect_error) { die("Connection failed: " . $conn -> connect_error); } // USED to CHANGE the db. - (mysqli_select_db($con, "test") or die()); /* Check to make all fields entered -make sure submitted- #2*/ if(isset($_POST["register"])) { if(!$_POST["email"] | !$_POST["password"] | !$_POST["password2"]) { die("You did not fill in all the fields"); } /* do escape strings for SQL injection */ $emailsafe = mysqli_real_escape_string($conn, $_POST["email"]); $passsafe = mysqli_real_escape_string($conn, $_POST["password"]); $pass2safe = mysqli_real_escape_string($conn, $_POST["password2"]); /* Check and see if email EXISTS in db. */ /* Insert email in db if does not exist */ $sql = "SELECT email FROM users WHERE email = '$emailsafe'";//limit 1 $result = $conn->query($sql) or die("invalid email check " . mysqli_error($conn)); $numrows = mysqli_num_rows($result); if($numrows != 0) { die("Sorry the email " . $_POST["email"] . "is already in use"); } // check if passwords both match if($_POST["password"] != $_POST["password2"]) { die("Passwords did NOT match"); } // if passwords match encrypt $hashedpass = password_hash($passsafe, PASSWORD_DEFAULT); // With everything escaped and hashed INSERT into db. $sqlINSERT = "INSERT INTO users(email, password) " . "VALUES('" . $emailsafe ."','". $hashedpass ."')"; if($query = $conn->query($sqlINSERT)=== TRUE) { echo '<script type="text/javascript">alert("Successfully INSERTed");</script>'; } else { die("Unsuccessful"); } $conn->close(); ?>
I ran my php with ajax and it creates the file successfully so i know it runs. I wanted to setup PHP debugging with atom or visual studio but i have not been able to successfully do that... I tried with xdebug so i just use the network tab inchrome to find if errors exist. |