Search Results

Search found 45255 results on 1811 pages for 'php connect'.

Page 78/1811 | < Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >

  • PHP Requests Being Blocked After Making About 25 in Ten Minutes

    - by Daniel Stern
    We have an administrative portal where we run PHP functions through a Javascript portal using ajax for administrative purposes. For example, we might have a function called updateAllDatabaseEntries() which would call AJAX functions in rapid succession, with those functions each executing numerous SQL queries. The problem is after making several successive requests from the same computer (not an excessive amount, maybe 30 in ten minutes) the system will stop responding to any PHP, HTTP requests ETC ONLY from my computer. From other computers in the office the panel can still be accessed, and access is restored to this computer after about 15 minutes. We believe this is not a glitch but some kind of security feature built into our server, possibly relating to Suhosin and likely well-intentioned but currently preventing us from running our system administration. Server Info: Linux 2.6.32-5-xen-amd64 #1 SMP Tue Mar 8 00:01:30 UTC 2011 x86_64 GNU/Linux Cheers - DS

    Read the article

  • Strange PHP output buffering

    - by radek-k
    PHP: header('Content-type: text/plain'); for ($i=0; $i<10; $i++){ echo "$i\r\n"; ob_flush(); flush(); sleep(1); } I tried script above on 2 different servers. Both respond numbers 0...9 in every line. In case of first server each number is received every second. In case of second server there is no output for 10 seconds and entire output is displayed at once. What might be wrong int second case? I tried various uutput control Functions but it didn't help. Set of response headers in both cases is pretty much the same: HTTP/1.1 200 OK Date: Mon, 03 Jan 2011 19:21:21 GMT Server: Apache X-Powered-By: PHP/5.2.14 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/plain

    Read the article

  • Ubuntu Server Edition (Jaunty) x64 Segmentation faults in PHP mysql package

    - by Deeksy
    I've been running Jaunty with Apache2, PHP & MySQL running drupal websites as well as python 2.6 and trac on the same server. I'm getting quite a few segmentation faults and suhosin warnings on my drupal websites which don't seem to be related to the amount of RAM the server has (3GB) as the trac site is running happily without issues. The issue seems to be related to PHP accessing mysql and I'm getting suhosin warnings. Has anyone else seen this problem? Any ideas on how to fix it? Funnily enough, it's not a consistent error, as restarts tend to fix the issue temporarily.

    Read the article

  • Some $_SERVER parameters missing when accessing PHP script via Cron

    - by Jakobud
    I have a script that I need to run with PHP via cron. The original author of the script made a lot of user of certain $_SERVER parameters (like REQUEST_URI). But it appears that certain variables don't exist when running PHP via command line or via CRON. For example, there is no request uri, so it makes sense that the REQUEST_URI parameter wouldn't be available. Is there any way around this other than to completely rewrite the script in order to avoid using special $_SERVER parameters that aren't universally available?

    Read the article

  • Whats the best way to deal with backups for my php/mysql application

    - by spirytus
    I'm creating php application for my client and now thinking what would be the best way to do backups, automatically if possible? I don't have much experience in this area and in case something goes wrong, or if I need to migrate, I would like to have fast way of getting it all back online. I understand "something goes wrong" is a very wide term, but lets say that someone hacks my site and wipes out database and all the files. My app. is written in php/mysql and I got access to cpanel (hosted with justhost.com if that makes any difference :). I used Joomla and it has JoomlaPack that does complete backup almost automatically and in case site fails, its easy to revert, or migrate if necessary. Is there anything like that for my configuration that would make reverting/migration, easy?

    Read the article

  • I can't see wordpress .php file?

    - by Alegro
    I installed WAMP server on win xp - it works. I installed Wordpress 3.4.2 into www.wordpress - no problem. In Dreamweaver CS5 I created a site with www.wordpress as root folder, and assigned a local test server - ok. In Dreamweaver, I opened twentyten theme - index.php - and pressed F12 to see the page in Firefox - and got: Fatal error: Call to undefined function get_header()... - on line 16 This is a completely new and clear wordpress installation. Why is the function (get_header) - undefined? To check the server I copied another .php file into the same folder - F12 - it works.

    Read the article

  • Linux PHP web server horribly slow when accessed from any windows browser

    - by Ed Harcourt
    I have a Linux server (Ubuntu 10.04) running apache2 and PHP. Everything runs fine when accessing a page from any browser from another Linux machine or Mac. But when I try to access a page from any combination of Windows machine and browser I get about a 30 second delay before the page comes back. Accessing a plain old HTML file from the Windows browser runs lickity split. So it seems to be just PHP. MySQL is installed but a simple test page that uses no MySQL is still slow. I don't think it is DNS because if I hard code the IP address in the URL nothing changes. There doesn't seem to be anything in the log files that I can tell. What could be causing this behavior on Windows clients?

    Read the article

  • Cent OS upgrade PHP

    - by greggory.hz
    I'm in the midst of resolving a bunch of security issues on a clients server to get them compliant with credit card laws and such. The first order of business is getting php from 5.2.14 to 5.2.16. When I run yum update php, this is the output I get: Excluding Packages from CentOS-5 - Addons Finished Excluding Packages from CentOS-5 - Base Finished Excluding Packages from CentOS-5 - Extras Finished Excluding Packages from CentOS-5 - Updates Finished Setting up Update Process No Packages marked for Update I'm fairly new to CentOS, but with Debian/Ubuntu, you can add PPAs to allow new software packages. Is there something similar for CentOS? This output makes it look like it's ignoring all the main package repos as well.

    Read the article

  • PHP errors not being displayed

    - by Mike
    I'm using PHP with Apache on Ubuntu 12.10. Errors are not being displayed to the browser for some reason and I can't figure it out. I have the following in my php.ini file: error_reporting = E_ALL & ~E_DEPRECATED display_errors = On display_startup_errors = On log_errors = On I am also positive that I have edited the correct ini file by verifying it with php_ini_loaded_file(). I can also verify that the values are correctly set by doing the following in my script: echo ini_get("display_errors"); // Outputs 1 echo ini_get("display_startup_errors"); // Outputs 1 echo ini_get("log_errors"); // Outputs 1 echo ini_get("error_reporting"); // Outputs -1 I have tried what seems like every possible combination of these settings (and restarting Apache after each change) and it is just not outputting errors. I am also not using ini_set anywhere in the script. It is being set only from the ini file. Any ideas why errors aren't being displayed?

    Read the article

  • PHP and load balancing

    - by StCee
    I have one major domain but the server spec behind it is not good enough. Hence I want to relay the traffic, in particular php-mysql queries to multiple smaller servers. How is that normally be done? (BTW I wonder how much traffic or number of php/mysql request a normal setup on ec2 micro instance can handle? ) I did have a look of EC2 load balancer. But is it only possible to load balance on machines of your own account?

    Read the article

  • PHP CPU utilization limit

    - by knightrider
    I have done some research on the net regarding the problem. My questions is NOT how to reduce cpu utilization by improving algorithm or improving the performance by using multitasking or limiting CPU per system user. I have a website where user logs in does some processing and logout. The site uses linux server, php and apache. The problem is that I cant control the amount of CPU allocated to each user. ie I want give a guarantee that a user will get say atleast 5% of CPU (assume total number of users is less than 20). How can I do this? Any solution (A php code, apache server settings, or any out of box soln) is welcomed. Thankyou very much for reading this :)

    Read the article

  • PHP/Oracle Connectivity randomly "drops out"

    - by user20555
    Hi! Here's the current situation - I have two web servers (for now named A and B) and two database servers (named C and D). The web servers are quite old, and are running an early version of Apache 2 + PHP4, while the DB servers are running Oracle 9i and 10g respectively. We're experiencing a strange problem connecting (via PHP code) to database A while on web server B only. Web server A has no issues at all... Randomly, web server B will report a "Not connected to Oracle" error (3114). I can't see a real pattern with this, but refreshing a few times seems to fix the issue. Apparently there are no drop-outs on the network interface, which leads me to believe that there's some misconfiguration between PHP/Apache and Oracle (which uses connection pooling). We're running SunOS 5.8... Any ideas?

    Read the article

  • How can I automate Photoshop easily from PHP?

    - by justtaffy
    I'm building a web service, and I can't seem to figure this out. I've Googled everywhere, but nothing seems to fit as I need it. The user enters details into the website, and then a PSD file is edited via ExtendScript with the details they've entered. The file is saved, and available to download to the user. I have the script complete, the PSD ready and the PHP set up as I want it, but I can't seem to figure out how I can launch the script automatically from PHP. I've tried a few things and nothing seems to work. Any ideas would be great, I think I've been staring at it for too long and am jsut confusing myself now.

    Read the article

  • php.ini settings change not taking effect for large file uploads

    - by user51347
    My server was just reprovisioned, and my application which uploads large (100M+) files now breaks upon re-installation. the symptom is quite consistent : smaller files (8mb in my tests) upload just fine. Larger files cut off at quite close to the same point every time given a particular computer. a file that fails at 26% will fail at just about the same every time. One that takes 1:40s to fail will take within 2 seconds of that every time, before failure. I have set my php.ini settings extravagently : post_max_size = 512M upload_max_filesize = 512M max_input_time = 3600 max_execution_time 3600 Is there possibly a setting at the Apache Level which would override PHP?

    Read the article

  • downgrading the php version

    - by aadiahg
    I used to upgrade my php from 5.3.5-1ubuntu7.11 to 5.3.18-1~dotdeb.0 I got a lot of problems after the upgrading process . My localhost/phpmyadmin displaying the blank screen. apache2 show me a warning message waiting [Sun Nov 04 12:11:21 2012] [warn] The Alias directive in /etc/apache2/conf.d/phpmyadmin.conf at line 3 will probably never match because it overlaps an earlier Alias. most of CMS cant installed and show me this error Required MySQL version for CMS is 5.x but this server has: mysqlnd 5.0.8-dev the Scripts that has been already installed some of there functions doesn’t work i've googled a lot to fix this problems also i ve googled about downgrading the php version from 5.3.18 to 5.3.x but it doesn’t work with me Can you help please Many thanks

    Read the article

  • Realtime website slowness (PHP/MYSQL)

    - by 3s2ng
    We got a website with realtime transactions. The past few days we experienced some slowness during a period of time. Usually the slowness last for 5 minutes. And also during the slowness we noticed that sometimes we can not connect to SSH and FTP or sometimes very slow to connect to those services. Currently we are trying to identify the issue. We already setup database monitoring tool. Now are about to signup with pingdom.com My question is. If the website is too slow due to the database (table or row lock) will it affect the other services like SSH and FTP? Does the ping correlates the page load and the connection between my PC and server? Thanks, Mark

    Read the article

  • Using a parser to locate faulty code

    - by ryan.riverside
    Lately I've been working a lot in PHP and have run into an abnormally large number of parsing errors. I realize these are my own fault and a result of sloppy initial coding on my part, but it's getting to the point that I'm spending more time resolving tags than developing. In the interest of not slamming my productivity, are there any tricks to locating the problem in the code? What I'd really be looking for would be a line to put in the code which would output the entire faulty tag in the parsing error, or something similar. Purely for reference sake, my current error is Parse error: syntax error, unexpected '}' in /home/content/80/9480880/html/cache/tpl_prosilver_viewtopic_body.html.php on line 50 (which refers to this): </dd><dd><?php if ($_poll_option_val['POLL_OPTION_RESULT'] == 0) { echo ((isset($this->_rootref['L_NO_VOTES'])) ? $this->_rootref['L_NO_VOTES'] : ((isset($user->lang['NO_VOTES'])) ? $user->lang['NO_VOTES'] : '{ NO_VOTES }')); } else { echo $_poll_option_val['POLL_OPTION_PERCENT']; } ?></dd> </dl> <?php }} if ($this->_rootref['S_DISPLAY_RESULTS']) { ?> <dl> <dt>&nbsp;</dt> <dd class="resultbar"><?php echo ((isset($this->_rootref['L_TOTAL_VOTES'])) ? $this->_rootref['L_TOTAL_VOTES'] : ((isset($user->lang['TOTAL_VOTES'])) ? $user->lang['TOTAL_VOTES'] : '{ TOTAL_VOTES }')); ?> : <?php echo (isset($this->_rootref['TOTAL_VOTES'])) ? $this->_rootref['TOTAL_VOTES'] : ''; ?></dd> </dl> <?php } if ($this->_rootref['S_CAN_VOTE']) { ?> <dl style="border-top: none;"> <dt>&nbsp;</dt> <dd class="resultbar"><input type="submit" name="update" value="<?php echo ((isset($this->_rootref['L_SUBMIT_VOTE'])) ? $this->_rootref['L_SUBMIT_VOTE'] : ((isset($user->lang['SUBMIT_VOTE'])) ? $user->lang['SUBMIT_VOTE'] : '{ SUBMIT_VOTE }')); ?>" class="button1" /></dd> </dl> <?php } if (! $this->_rootref['S_DISPLAY_RESULTS']) { ?> <dl style="border-top: none;"> <dt>&nbsp;</dt> <dd class="resultbar"><a href="<?php echo (isset($this->_rootref['U_VIEW_RESULTS'])) ? $this->_rootref['U_VIEW_RESULTS'] : ''; ?>"><?php echo ((isset($this->_rootref['L_VIEW_RESULTS'])) ? $this->_rootref['L_VIEW_RESULTS'] : ((isset($user->lang['VIEW_RESULTS'])) ? $user->lang['VIEW_RESULTS'] : '{ VIEW_RESULTS }')); ?></a></dd> </dl> <?php } ?> </fieldset></div>

    Read the article

  • oci_connect Blank Page in PHP

    - by Bryan
    UPDATE (3/8/2010) I installed Xdebug and have it tracing my code. This is the output I am getting: TRACE START [2010-03-08 17:53:05] 0.2090 327864 -> {main}() /data/aims3/http/octest.php:0 0.2091 327988 -> ini_set(string(14), string(1)) /data/aims3/http/octest.php:3 0.2093 327920 -> error_reporting(long) /data/aims3/http/octest.php:4 0.2094 328048 -> oci_connect(string(8), string(8), string(25)) /data/aims3/http/octest.php:6 The trace halts at that point. I have installed everything the same way on a local server and it works fine. To say I am at a complete loss would be putting it lightly. *NOTE: I ran make test and it returned FAIL on every test. I never ran this on my working machine to see if it reports the same errors. Any idea why make test would report FAIL but make doesn't report any error? I've installed the Oracle Instantclient with no reported errors along with the OCI8 PECL package and at a loss. Whenever I try to open a connection with oci_connect, it halts my entire PHP script. EXAMPLE: <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); echo "before"; $conn = oci_connect("username", "password", "host"); echo "after"; ?> Returns a complete blank page. The module is loaded (seen in phpinfo) and everything installed with no errors. I am at a complete loss. CentOS: 5.4 Apache: 2.2.3 PHP: 5.3.1 InstantClient: 11.2 oci8: 1.4.1 Any thoughts? NOTES Apache Error Log reports nothing Attempted Debugging: 1: <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); echo "before"; if(!function_exists('oci_connect')) die('Oracle Not Installed'); echo "after"; ?> Returns: beforeafter 2: Changing host to //host Returns: Same error

    Read the article

  • Secure, simple php faq creating/editing scripts?

    - by Tchalvak
    I'm looking to build a simple site centered around a simple faq system in php. The faq concept is simple, but I want to have an administrative-access backend for editing and creating the entries, and securing a login seems more complex and time-consuming, so I'm looking for suggestions for code to start me off. Does anyone know of any open source php scripts or snippets that would work for administrative login to some php scripts that could be used as a simple faq system? Or both, the faq php code + web administrative access code?

    Read the article

  • Creating an XML sitemap with PHP

    - by iMaster
    I'm trying to create a sitemap that will automatically update. I've done something similiar with my RSS feed, but this sitemap refuses to work. You can view it live at http://designdeluge.com/sitemap.xml I think the main problem is that its not recognizing the PHP code. Here's the full source: <?php header('Content-type: text/xml'); ?> <?xml version="1.0" encoding="UTF-8" ?> <urlset xmlns="http://www.google.com/schemas/sitemap/0.84" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd"> <url> <loc>http://www.designdeluge.com/</loc> <lastmod>2010-04-29</lastmod> <changefreq>daily</changefreq> <priority>1.00</priority> </url> <url> <loc>http://www.designdeluge.com/archives</loc> <lastmod>2010-04-29</lastmod> <changefreq>daily</changefreq> <priority>0.5</priority> </url> <url> <loc>http://www.designdeluge.com/about.php</loc> <lastmod>2010-04-29</lastmod> <changefreq>daily</changefreq> <priority>0.5</priority> </url> <?php include 'connection.php'; $entries = mysql_query("SELECT * FROM Entries ORDER BY timestamp DESC"); while($row = mysql_fetch_array($entries)) { $title = stripslashes($row['title']); $date = date("Y-m-d", strtotime($row['timestamp'])); ?> <url> <loc>http://www.designdeluge.com/<?php echo $row['title']; ?></loc> <lastmod><?php echo $date; ?></lastmod> <changefreq>none</changefreq> <priority>0.5</priority> </url> <?php } ?> </urlset> The problem is that the dynamic URL's (e.g. the ones pulled from the DB) aren't being generated and the sitemap won't validate. Thanks!

    Read the article

  • PHP session not working with JQuery Ajax?

    - by Bolt_Head
    Update, Solved: After all this I found out that I was calling an old version of my code in the update ajax. 'boardControl.php' instead of 'boardUpdate.php' These are the kinds of mistakes that make programing fun. I'm writing a browser gomoku game. I have the ajax statement that allows the player to play a piece. $(document).ready(function() { $("td").live('click',function(){ var value = $(this).attr('id'); $.get('includes/boardControl.php',{play: value, bid: bid}); }); }); value = board square location bid = board ID Before creating a user login for player identification, the server side php had a temporary solution. It would rotate the piece state for the squares when clicked instead of knowing what player to create them for. After creating login stuff I set a session variable for the player's ID. I was hoping to read the session ID from the php during the ajax request and figure out what player they are from there. session_start(); ... $playerId = $_SESSION['char']; $Query=("SELECT p1, p2 FROM board WHERE bid=$bid"); $Result=mysql_query($Query); $p1 = mysql_result($Result,0,"p1"); $p2 = mysql_result($Result,0,"p2"); $newPiece = 0; //*default no player if($playerId == $p1) $newPiece = 1; if($playerId == $p2) $newPiece = 2; For some reason when I run the full web app, the pieces still cycle though, even after I deleted the code to make them cycle. Furthermore, after logging in If i manually load the php page in the browser, it modifies the database correctly (where it only plays pieces belonging to that player) and outputs the correct results. It seems to me that the session is not being carried over when used with Ajax. Yet Google searches tell me that, sessions do work with Ajax. Update: I'm trying to provide more information. Logging in works correctly. My ID is recognized and I printed it out next to the board to ensure that I was retrieving it correctly. The ajax request does update the board. The values passed are correct and confirmed with firebug's console. However instead of placing pieces only for the player they belong to it cycles though the piece states (0,1,2). When manually browsing to boardUpdate.php and putting in the same values sent from the Ajax the results seen in the echo'ed response indicates that the corresponding piece is played each time as intended. Same results on my laptop after fresh load of firefox. Manually browsing to boardUpdate.php without logging in before hand leave the board unchanged (as intended when no user is found in the session). I've double checked the that session_start() is on the php files and double checked the session ID variables. Hope this extra information helps, i'm running out of ideas what to tell you. Should I load up the full code? Update 2: After checking the Ajax responce in fire-bug I realized that the 'play' request does not get a result, and the board is not updated till the next 'update'. I'm still looking into this but I'll post it here for you guys too. boardUpdate.php Notable places are: Refresh Board(line6) Place Piece(line20) function boardUpdate($turnCount) (line63) <?php session_start(); require '../../omok/dbConnect.php'; //*** Refresh Board *** if(isset($_GET['update'])) { $bid = $_GET['bid']; $Query=("SELECT turn FROM board WHERE bid=$bid"); $Result=mysql_query($Query); $turnCount=mysql_result($Result,0,"turn"); if($_GET['turnCount'] < $turnCount) //** Turn increased { boardUpdate($turnCount); } } //*** Place Piece *** if(isset($_GET['play'])) // turn order? player detect? { $squareID = $_GET['play']; $bid = $_GET['bid']; $Query=("SELECT turn, boardstate FROM board WHERE bid=$bid"); $Result=mysql_query($Query); $turnCount=mysql_result($Result,0,"turn"); $boardState=mysql_result($Result,0,"boardstate"); $turnCount++; $playerId = $_SESSION['char']; $Query=("SELECT p1, p2 FROM board WHERE bid=$bid"); $Result=mysql_query($Query); $p1 = mysql_result($Result,0,"p1"); $p2 = mysql_result($Result,0,"p2"); $newPiece = 0; //*default no player if($playerId == $p1) $newPiece = 1; if($playerId == $p2) $newPiece = 2; // if($newPiece != 0) // { $oldPiece = getBoardSpot($squareID, $bid); $oldLetter = $boardState{floor($squareID/3)}; $slot = $squareID%3; //***function updateCode($old, $new, $current, $slot)*** $newLetter = updateCode($oldPiece, $newPiece, $oldLetter, $slot); $newLetter = value2Letter($newLetter); $newBoard = substr_replace($boardState, $newLetter, floor($squareID/3), 1); //** Update Query for boardstate & turn $Query=("UPDATE board SET boardState = '$newBoard', turn = '$turnCount' WHERE bid = '$bid'"); mysql_query($Query); // } boardUpdate($turnCount); } function boardUpdate($turnCount) { $json = '{"turnCount":"'.$turnCount.'",'; //** turnCount ** $bid = $_GET['bid']; $Query=("SELECT boardstate FROM board WHERE bid='$bid'"); $Result=mysql_query($Query); $Board=mysql_result($Result,0,"boardstate"); $json.= '"boardState":"'.$Board.'"'; //** boardState ** $json.= '}'; echo $json; } function letter2Value($input) { if(ord($input) >= 48 && ord($input) <= 57) return ord($input) - 48; else return ord($input) - 87; } function value2Letter($input) { if($input >= 10) return chr($input += 87); else return chr($input += 48); } //*** UPDATE CODE *** updates an letter with a new peice change and returns result letter. //***** $old : peice value before update //***** $new : peice value after update //***** $current : letterValue of code before update. //***** $slot : which of the 3 sqaures the change needs to take place in. function updateCode($old, $new, $current, $slot) { if($slot == 0) {// echo $current,"+((",$new,"-",$old,")*9)"; return letter2Value($current)+(($new-$old)*9); } else if($slot == 1) {// echo $current,"+((",$new,"-",$old,")*3)"; return letter2Value($current)+(($new-$old)*3); } else //slot == 2 {// echo $current,"+((",$new,"-",$old,")"; return letter2Value($current)+($new-$old); } }//updateCode() //**** GETBOARDSPOT *** Returns the peice value at defined location on the board. //****** 0 is first sqaure increment +1 in reading order (0-254). function getBoardSpot($squareID, $bid) { $Query=("SELECT boardstate FROM board WHERE bid='$bid'"); $Result=mysql_query($Query); $Board=mysql_result($Result,0,"boardstate"); if($squareID %3 == 2) //**3rd spot** { if( letter2Value($Board{floor($squareID/3)} ) % 3 == 0) return 0; else if( letter2Value($Board{floor($squareID/3)} ) % 3 == 1) return 1; else return 2; } else if($squareID %3 == 0) //**1st spot** { if(letter2Value($Board{floor($squareID/3)} ) <= 8) return 0; else if(letter2Value($Board{floor($squareID/3)} ) >= 18) return 2; else return 1; } else //**2nd spot** { return floor(letter2Value($Board{floor($squareID/3)}))/3%3; } }//end getBoardSpot() ?> Please help, I'd be glad to provide more information if needed. Thanks in advance =)

    Read the article

  • PHP upload script

    - by Darkmage
    Using this upload script and it was working ok a week ago but when i checked it today it fails. I have checked writ privileges on the folder and it is set to 777 so don't think that is the problem. Anyone have a idea of what the problem can be? this is the error Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to access replays/1275389246.ruse in /usr/home/web/wno159003/systemio.net/ruse.systemio.net/scripts/upload.php on line 95 my script is <?php require($_SERVER['DOCUMENT_ROOT'].'/xxxx/xxxx'); $connection = @mysql_connect($db_host, $db_user, $db_password) or die("error connecting"); mysql_select_db($db_name, $connection); $name = basename($_FILES['uploaded']['name']); $comment = $_POST["comment"]; $len = strlen($comment); $username = $_POST["username"]; $typekamp = $_POST["typekamp"]; $date = time(); $target = "replays/"; $target .= basename($_FILES['uploaded']['name']); $maxsize = 20971520; // 20mb Maximum size of the uploaded file in bytes // File extension control // Whilelisting takes preference over blacklisting, so if there is anything in the whilelist, the blacklist _will_ be ignored // Fill either array as you see fit - eg. Array("zip", "exe", "php") $fileextensionwhitelist = Array("ruse"); // Whilelist (allow only) $fileextensionblacklist = Array("zip", "exe", "php", "asp", "txt"); // Blacklist (deny) $ok = 1; if ($_FILES['uploaded']['error'] == 4) { echo "<html><head><title>php</title></head>"; echo '<body bgcolor="#413839" text="#ffffff"> <p><B>info</b></p>'; die("No file was uploaded"); } if ($_FILES['uploaded']['error'] !== 0) { echo "<html><head><title>php</title></head>"; echo '<body bgcolor="#413839" text="#ffffff"> <p><B>info</b></p>'; die("An unexpected upload error has occured."); } // This is our size condition if ($_FILES['uploaded']['size'] > $maxsize) { echo "<html><head><title>php</title></head>"; echo '<body bgcolor="#413839" text="#ffffff"> <p><B>info</b></p>'; echo "Your file is too large.<br />\n"; $ok = 0; } // This is our limit file type condition if ((!empty($fileextensionwhitelist) && !in_array(substr(strrchr($_FILES['uploaded']['name'], "."), 1), $fileextensionwhitelist)) || (empty($fileextensionwhitelist) && !empty($fileextensionblacklist) && in_array(substr(strrchr($_FILES['uploaded']['name'], "."), 1), $fileextensionblacklist))) { echo "<html><head><title>php</title></head>"; echo '<body bgcolor="#413839" text="#ffffff"> <p><B>info</b></p>'; echo "This type of file has been disallowed.<br />\n"; $ok = 0; } // Here we check that $ok was not set to 0 by an error if ($ok == 0) { echo "<html><head><title>php</title></head>"; echo '<body bgcolor="#413839" text="#ffffff"> <p><B>info</b></p>'; echo "Sorry, your file was not uploaded. Refer to the errors above."; } // If everything is ok we try to upload it else { if($len > 0) { $target = "replays/".time().'.'."ruse"; $name = time().'.'."ruse"; $query = "INSERT INTO RR_upload(ID, filename, username, comment, typekamp, date) VALUES (NULL, '$name', '$username','$comment', '$typekamp' ,'$date')"; if (file_exists($target)) { $target .= "_".time().'.'."ruse"; echo "<html><head><title>php</title></head>"; echo '<body bgcolor="#413839" text="#ffffff"> <p><B>info</b></p>'; echo "File already exists, will be uploaded as ".$target; } mysql_query($query, $connection) or die (mysql_error()); echo "<html><head><title>php</title></head>"; echo '<body bgcolor="#413839" text="#ffffff"> <p><B>info</b></p>'; echo (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) ? "The file ".basename( $_FILES['uploaded']['name'])." has been uploaded. \n" : "Sorry, there was a problem uploading your file. <br>"; echo "<br>Variable filename: ".$name; echo "<br>Variable name: ".$username; echo "<br>Variables comment: ".$comment; echo "<br>Variables date: ".$date; echo "<br>Var typekamp; ".$typekamp; echo "<br>Var target; ".$target; } else { echo "<html><head><title>php</title></head>"; echo '<body bgcolor="#413839" text="#ffffff"> <p><B>info</b></p>'; echo"you have to put in comment/description"; } } ?>

    Read the article

  • Simulate Form Post in PHP

    - by Aakash
    I have an HTML form (form action="https:..." method="post"). I want to handle the post in PHP. How do I simulate the form post in PHP? So, instead, I will have (form action="helper.php") a and helper.php will post the form data.

    Read the article

  • Face detection in 100% pure PHP

    - by Yogi Yang 007
    I am looking for PHP script that will detect face in a uploaded photo and automatically crop it accordingly. The code should be in pure PHP without depending on any third party API's or Libs. This code will be a part of our existing code for processing images. In fact this is the only part that is missing! I would prefer to have code in PHP version 5.x not PHP 6.x.

    Read the article

< Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >