PHP - Mysterious Errors From Unkown
Hello everyone.
I was wondering whether anyone has an answer to some strange errors I am getting in my code. These are the errors: Notice: Non-callable array passed to zend_call_function() in Unknown on line 0 Warning: Unknown: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (C:/www2/php/tmp) in Unknown on line 0 Notice: Non-callable array passed to zend_call_function() in Unknown on line 0 I only get these errors on two pages in my site. I cannot see anything out of the ordinary or different to the other errorless pages. There is no drop in performance and everything works fine. Its just these errors are adding a lot of whitespace to the bottom of the pages, and are obviously confusing me. I am not setting a session called 'user', and i dont use zend? or I dont know about it. Has anyone got any ideas? Similar TutorialsHow do I display the actual errors in IIS 7.5? If I miss a semicolon, I get: "HTTP Error 500.0 - Internal Server Error" absolutely useless. In prior versions, I could see the line and get to the PHP error. How do I display PHP errors? I've added: set_ini('display_errors', '1'); but it doesn't help. i m facing this 2 errors in the below script
Notice: Undefined index: media in D:\server\website\htdocs\wefondyou\themes\grape\layout\story\content.phtml on line 107 Warning: Invalid argument supplied for foreach() in D:\server\website\htdocs\wefondyou\themes\grape\layout\story\content.phtml on line 107 I had tried add isset and is_array to line, the errors gone away, but image also gone away. any ideas?? <div id="story_<?php echo $sk['story']['id']; ?>" class="story-wrapper story_<?php echo $sk['story']['id']; ?>" data-story-id="<?php echo $sk['story']['id']; ?>"> <div class="publisher-wrapper"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="48px" align="left" valign="top"> <a href="<?php echo $sk['story']['publisher']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['publisher']['username']; ?>"> <img class="avatar" src="<?php echo $sk['story']['publisher']['thumbnail_url']; ?>" width="40px" height="40px" alt="<?php echo $sk['story']['publisher']['name']; ?>"> </a> </td> <td align="left" valign="top"> <a class="name" href="<?php echo $sk['story']['publisher']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['publisher']['username']; ?>"> <?php echo substr($sk['story']['publisher']['name'], 0, 35); ?> </a> <?php if ($sk['story']['recipient_exists'] == true) { ?> <i class="icon-arrow-right recipient-indicator-icon"></i> <a class="name" href="<?php echo $sk['story']['recipient']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['recipient']['username']; ?>"> <?php echo substr($sk['story']['recipient']['name'], 0, 35); ?> </a> <?php } echo $sk['story']['activity_text']; ?> <div class="other-data"> <span class="time-wrapper ajax-time" title="<?php echo date('c', $sk['story']['time']); ?>"> <?php echo date('c', $sk['story']['time']); ?> </span> <?php if ($sk['story']['location_exists'] == true) { ?> <abbr class="space3">·</abbr> <span class="location-wrapper" title="<?php echo $sk['story']['location']['name']; ?>"> <i class="icon-map-marker"></i> <?php echo $sk['story']['location']['name']; ?> </span> <?php } ?> </div> </td> </tr> </table> <?php if ($sk['logged'] == true) { ?> <div class="setting-buttons"> <?php if ($sk['story']['admin'] == true) { ?> <span class="remove-btn cursor-hand" title="<?php echo $lang['remove']; ?>" onclick="SK_deletePostWindow(<?php echo $sk['story']['id']; ?>);"> <i class="icon-remove progress-icon"></i> </span> <?php } elseif (!SK_isPostReported($sk['story']['id'])) { ?> <span class="report-btn cursor-hand" title="<?php echo $lang['report']; ?>" onclick="SK_reportPost(<?php echo $sk['story']['id']; ?>);"> <i class="icon-flag progress-icon"></i> </span> <?php } ?> </div> <?php } ?> </div> <?php if ($sk['logged'] == true) { ?> <div class="options-wrapper"> <?php echo SK_getPostLikeButton($sk['story']['id']); ?> <abbr class="space6">·</abbr> <?php echo SK_getPostShareButton($sk['story']['id']); ?> <abbr class="space6">·</abbr> <?php echo SK_getPostFollowButton($sk['story']['id']); ?> </div> <?php } if (!empty($sk['story']['text'])) { ?> <div class="text-wrapper"> <?php echo $sk['story']['text']; ?> </div> <?php } if ($sk['story']['media_exists'] == true) { // If it is photos if ($sk['story']['media_type'] == "photos") { ?> <div class="photos-wrapper"> <?php $photo_class = 'width-' . $sk['story']['media_num']; if ($sk['story']['media_num'] >= 3) { $photo_class = 'width-3'; } LINE HERE 107 -----> foreach ($sk['story']['media'] as $photo) { ?> <a href="javascript:void(0);"> <img class="<?php echo $photo_class; ?>" src="<?php echo $photo['url']; ?>" alt="Photo" onclick="javascript:SK_openLightbox(<?php echo $photo['post_id']; ?>);"> </a> <?php } ?> </div> <?php } elseif ($sk['story']['media_type'] == "soundcloud") { ?> <div class="soundcloud-wrapper" align="center"> <iframe frameborder="0" src="https://w.soundcloud.com/player/?url=<?php echo $sk['story']['media']['url']; ?>&color=f07b22" width="100%"></iframe> </div> <?php } elseif ($sk['story']['media_type'] == "youtube") { ?> <div class="youtube-wrapper" align="center"> <iframe src="https://www.youtube.com/embed/<?php echo $sk['story']['media']['id']; ?>?ap=%2526fmt%3D18&disablekb=1&rel=0" width="100%" height="300px" frameborder="0" allowfullscreen></iframe> </div> <?php } } elseif ($sk['story']['location_exists'] == true) { ?> <div class="google-map-viewer-wrapper" align="center"> <img src="http://maps.googleapis.com/maps/api/staticmap?center=<?php echo $sk['story']['location']['name']; ?>&zoom=13&size=600x300&maptype=roadmap&markers=color:red%7C<?php echo $sk['story']['location']['name']; ?>" width="100%" alt="<?php echo $sk['story']['location']['name']; ?>"> </div> <?php } ?> <div class="activity-wrapper"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="middle"> <span class="story-like-activity"> <?php echo SK_getPostLikeActivityButton($sk['story']['id']); ?> </span> <abbr class="space6">·</abbr> <span class="story-comment-activity"> <?php echo SK_getPostCommentActivityButton($sk['story']['id']); ?> </span> <abbr class="space6">·</abbr> <span class="story-share-activity"> <?php echo SK_getPostShareActivityButton($sk['story']['id']); ?> </span> </td> <td align="right" valign="middle"> <?php if ($sk['story']['via_type'] == "like") { ?> <a class="via-name" href="<?php echo $sk['story']['via']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['via']['username']; ?>"> <?php echo $sk['story']['via']['name']; ?> </a> <?php echo $lang['likes_this_label']; ?> <?php } elseif ($sk['story']['via_type'] == "share") { ?> <a class="via-name" href="<?php echo $sk['story']['via']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['via']['username']; ?>"> <?php echo $sk['story']['via']['name']; ?> </a> <?php echo $lang['shared_this_label']; ?> <?php } elseif ($sk['story']['via_type'] == "tag") { ?> <a class="via-name" href="<?php echo $sk['story']['via']['url']; ?>" data-href="?tab1=timeline&id=<?php echo $sk['story']['via']['username']; ?>"> <?php echo substr($sk['story']['via']['name'], 0, 15); ?> </a> <?php echo $lang['tagged_on_this_label']; ?> <?php } ?> </td> </tr> </table> </div> <div class="comments-container hidden"> <?php if ($sk['story']['view_all_comments'] == true) { ?> <div class="view-more-wrapper" align="center" onclick="SK_loadAllComments(<?php echo $sk['story']['id']; ?>);"> <i class="icon-lightbulb progress-icon hide"></i> <?php echo $lang['view_all_comments_label']; ?> </div> <?php } ?> <div class="comments-wrapper"> <?php echo $sk['story']['comments']; ?> </div> <?php echo $sk['story']['comment']['publisher_box']; ?> </div> </div> When I am trying to update a record in the database i get this error after I submit the form that is populated from the database. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc = 'SFR ANNOUNCES 3RD ANNUAL \"12 DAYS OF CHRISTMAS FOOD DRIVE\"', body = '<' at line 1 im getting following errors:
Warning: DOMDocument::load() [domdocument.load]: Opening and ending tag mismatch: property line 6 and xsl:for-each in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/apartment.xsl, line: 25 in/home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 9 Warning: DOMDocument::load() [domdocument.load]: Opening and ending tag mismatch: for-each line 5 and property in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/apartment.xsl, line: 26 in/home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 9 Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: compilation error in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 14 Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: xsltParseStylesheetProcess : empty stylesheet in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 14 Warning: XSLTProcessor::transformToXml() [xsltprocessor.transformtoxml]: No stylesheet associated to this object in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 16 Fatal error: Call to a member function saveXML() on a non-object in /home/students/accounts/s4909321/cos80021/www/htdocs/Assignment3/transform1.php on line 18 the xslt file is as following: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/19...XSL/Transform"> <xsl:output method="xml" indent="yes"/> Hi I'm in need of help with some errors that the admin page of my cms is spitting out, I'm very new to php but I'm great understanding directions so any help that anyone can provide will be greatly appreciated.
These are the errors being displayed:
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mysite/public_html/includes/joomla.php on line 437 Hello. I am at beginning with php and now trying to make an ecommerce website. I know it's a bit stupid but it works until now. This site work perfect on localhost using xampp but then I transfered it to webhost, I get a lot of errors. i get this when i tried to retrive a venue id so admin can edit them Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Warning: session_start() [FUNCTION.SESSION-START]: Cannot send session cache limiter - headers already sent Code: [Select] <?php include 'scripts/connect.php'; if(isset($_GET['vid'])){ $query = mysql_query("SELECT * FORM venue"); while ($row = mysql_fetch_array($query)){ $id = $row['id']; $venuename = $row['venuename']; $address = $row['address']; $phone = $row['phone']; $vemail = $row['vemail']; $state = $row['state']; $town = $row['town']; $zip = $row['zip']; $seats = $row['seats']; } } ?> <?php require "header.php"; ?> The code below returns the correct results, which are in this case are email addresses. After each displayed value there is a br eg. emai1@hotmail.com<br>email2@hotmail.com<br>email3@ etc. So the quesion is, can i change the below codeing to prevent this. I have tried changing $message .= "<br>". $row['email'] to $message .= "\n". $row['email'] but this results in; Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html $code = $_GET['postcode']; $message = $_GET['message']; $emailad = "email@hotmail.co.uk"; $shortcode = substr($code,0,2); $result = mysql_query("SELECT email FROM treesurgeons WHERE postcode like '%" . $shortcode . "%' ORDER BY companyName LIMIT 3") or die(mysql_error()); echo "<h2>Business Names:</h2>"; while ($row = mysql_fetch_array( $result )) { $message .= "<br>". $row['email'] ; } echo "\n"; echo $message; mail( "$emailad", "Header","$message" ); echo "<br>" . "Thank you for using our mail form."; Does anyone know what would cause this error: Notice: Undefined index: file in C:\Inetpub\wwwroot\Upload\uploader3.php on line 2 No file specified with these files for uploading images: uploader.htm <html><head><title>File Uploader</title></head> <body><h3>File Upload</h3> Select a file to upload:<br> <form action="uploader.php" method="post" enctype="multipart/form-data"> <input type="file" name="file" size="45"> <br> <input type="submit" value="Upload File"> </form> </body></html> and, uploader.php <?php if( $_FILES['file']['name'] != "" ) { copy ( $_FILES['file']['tmp_name'], "C:/Inetpub/wwwroot/Upload/" . $_FILES['file']['name'] ) or die( "Could not copy file" ); } else{ die( "No file specified" ); } ?> <html> <head><title>Upload Complete</title></head> <body> <h3>File Upload Succeeded...</h3> <ul> <li>Sent: <?php echo $_FILES['file']['name']; ?> <li>Size: <?php echo $_FILES['file']['size']; ?> bytes <li>Type: <?php echo $_FILES['file']['type']; ?> </ul> <a href="<?php echo "C:/Inetpub/wwwroot/Upload/".$_FILES['file']['name']; ?>"><img src="<?php echo "C:/Inetpub/wwwroot/Upload/".$_FILES['file']['name']; ?>" height="200"></a> </body> </html> Thanks! Does anyone know of a function that I can use to get all occurring PHP errors during script execution into a string. Also, does anyone know what's wrong with php.net? It keeps saying service is down. Dear All, I have written the following code for "Forgot Password" link on my website www.computationalphotography.in. Below is my code: Code: [Select] <?php include_once"configure.php"; $email=$_POST['email']; $email=mysql_real_escape_string($email); if($email<>""){ $check_user_data = mysql_query("SELECT * FROM registration WHERE email = '$email'") or die(mysql_error()); if(mysql_num_rows($check_user_data) == 0) {echo '<script language="javascript">alert("This email address does not exist. Please try again.")</script>;';unset($email);} else {$row = mysql_fetch_array($check_user_data);$email=$row['email']; $to = $email; $subject = "Here are your login details . . . "; $message = "This is in response to your request for login details on www.computationalphotography.in.\nYour username is $row['email']\n.Your password is $row['password'].\n"; $headers = "From: ".$psbhostemailaddress."\r\nReply-To: ".$email; if(mail($to, $subject, $message, $headers)){echo "<center><font face='Verdana' size='2'><b><br><br><br><br><br>THANK YOU</b> <br>Your passwords are posted to your email address. Please check your mail soon.</center>";} else{echo "<center><font face='Verdana' size='2' color=red>There is some system problem in sending login details to your address. <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";} }} ?> On execution I am receiving the error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/computat/public_html/forgotpassword.php on line 22 Kindly help me out! Thank you. i seem to get the following errors: Notice: Undefined index: submit in C:\wamp\www\registration\register.php on line 12 Notice: Undefined index: fullname in C:\wamp\www\registration\register.php on line 14 Notice: Undefined index: username in C:\wamp\www\registration\register.php on line 15 Notice: Undefined index: password in C:\wamp\www\registration\register.php on line 16 Notice: Undefined index: repeat_password in C:\wamp\www\registration\register.php on line 17 its only in the php section that i am getting them <?php //Form Data echo "<h1>Registration</h1>"; $submit = $_POST['submit']; $fullname = $_POST['fullname']; $username = $_POST['username']; $password = $_POST['password']; $repeat_password = $_POST['repeat_password']; if ($submit) { } ?> <html> <form action='register.php' method='POST'> <table> <tr> <td> Choose a Username: </td> <td> <input type='text' name="username"> </td> </tr> <tr> <td> Password: </td> <td><input type='password' name="password"> </td> </tr> <tr> <td> Repeat Your Password: </td> <td><input type='password' name="repeat_password"> </td> </tr> <tr> <td> Your Full Name: </td> <td><input type='text' name="name"> </td> </tr> </table> <p><input type='submit' name='submit'></p> </form> </html> Hi everyone I am pretty new to php but have been playing around with it for awhile. I have been trying to include a offline script from codecanyon located (http://codecanyon.net/item/web-construct/61643). The problem I am having is when I try to include the file as per the scripts instruction (<?php include("offline.php");?>) I get all sorts of errors on mysite (please see below for one error). I read his discussion section were one person is having the same problem I am having the script developers answers was (Place the webconstruct include after the session_start() line). I have tried that or think I did it right but still getting the same errors as before. Can someone please help me in getting this script installed? I will copy the session code below and if someone can point me to the right direction in how to resolve this issue I would be thankful. (error) Notice: Use of undefined constant (my session code) <? if ( isset($_SESSION['url']) && $_SESSION['url'] != $SITE_URL ) { session_destroy(); ?> <script language="javascript">window.location.href="index.php";</script> Thanks in advance for anyone's help! I have created (modified a tutorial) a PHP Validation Form with validation. I am getting a blank page and cannot view it. <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?> <?php function VerifyForm(&$values, &$errors) { // Do all necessary form verification // Validate Model Number if (strlen($values['model']) < 4) $errors['model'] = 'Model Number too short'; elseif (strlen($values['model']) > 50) $errors['model'] = 'Model Number too long'; // Validate Price if (is_numeric($values['price']) == 0) $errors['price'] = 'No Price has been entered'; // Validate Product if(($values['product'])=='please_select') $errors['product'] = 'No Product has been selected'; // Validate Image if ((($_FILES["photo"]["type"] != "image/gif") || ($_FILES["photo"]["type"] != "image/jpeg") || ($_FILES["photo"]["type"] != "image/pjpeg")) && ($_FILES["photo"]["size"] > 2000000)) $errors['photo'] = 'Image format must be either JPG/JPEG/GIF or PNG'; // Validate Description if (strlen($values['description']) < 10) $errors['description'] = 'Description is too short'; return (count($errors) == 0); } function DisplayForm($values, $errors) { ?> <!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>swiftelectrical.net - Test Area</title> <link rel="stylesheet" href="test.css" type="text/css" media="screen" /> <style> TD.error { color: red; font-weight: bold; } </style> </head> <body> <div id="container"> <h1>Add a Product</h1> <?php if (count($errors) > 0) echo "<p>There were some errors in your submitted form, please correct them and try again.</p>"; ?> <form method="post" id="customForm" action="<?php = $_SERVER['PHP_SELF'] ?>" enctype="multipart/form-data"> <table> <tr> <td>Model Number:</td> <td><input id="model" type="text" size="30" name="model" value="<?php = htmlentities($values['model']) ?>"/></td> <td class="error"><?php = $errors['model'] ?></td> </tr> <tr> <td>Choose a Product:</td> <td> <select class="product" name="product"> <option value="please_select">Please select an option below</option> <option value="1">19" LCD TV</option> <option value="2">22" LCD TV</option> <option value="3">26" LCD TV</option> <option value="4">32" LCD TV</option> <option value="5">37" LCD TV</option> <option value="6">42" LCD TV</option> <option value="7">37" Plasma TV</option> <option value="8">42" Plasma TV</option> <option value="9">46" Plasma TV</option> <option value="10">50" Plasma TV</option> <option value="11">54" Plasma TV</option> <option value="12">58" Plasma TV</option> <option value="13">Wall Bracket</option> <option value="14">Home Cinema System</option> <option value="15">Bluray Home Cinema System</option> <option value="16">DVD Recorder</option> <option value="17">DVD Player</option> <option value="18">DVD Portable</option> <option value="">Bluray Recorder</option> <option value="">Bluray Player</option> <option value="">Bluray Portable</option> <option value="">Projector</option> <option value="">37" LCD TV</option> <option value="">42" LCD TV</option> <option value="">Personal Video Recorder (PVR)</option> <option value="">3D Technology</option> <option value="">Upright Cleaner</option> <option value="">Cylinder Cleaner</option> <option value="">DECT Phone</option> <option value="">DECT Answer Phone</option> <option value="">Washing Machines</option> <option value="">Tumble Dryers</option> <option value="">Dishwashers</option> <option value="">Fridge-Freezers</option> <option value="">Freezers</option> <option value="">Refridgerators</option> <option value="">Microwave (Solo)</option> <option value="">Microwave (Grill)</option> <option value="">Microwave Combination</option> <option value="">Kettles</option> <option value="">Toasters</option> <option value="">Irons</option> <option value="">Breadmakers</option> <option value="">Microsystems</option> <option value="">Minisystems</option> <option value="">CD, Radio and Cassette Players</option> <option value="">Pure Radios</option> <option value="">Dimplex Fires</option> <option value="">Convector Heaters</option> <option value="">Fan Heaters</option> <option value="">Mens Shavers/Grooming</option> <option value="">Ladies Shavers/Beauty</option> <option value="">Straighteners</option> <option value="">Epilators</option> <option value="">Stylish Cameras</option> <option value="">Super Zoom Cameras</option> <option value="">SD Camcorders</option> <option value="">HD Camcorders</option> <option value="">HDD Camcorders</option> <option value="">Bluray Discs</option> <option value="">DVD Discs</option> <option value="">Leads</option> <option value="">Mini DV Tapes</option> <option value="">SD/SDHC/SDXC Cards</option> </select> </td> <td class="error"><?php = $errors['product'] ?></td> </tr> <tr> <td>Price:</td> <td><input id="price" type="text" size="30" name="price" value="<?php = htmlentities($values['price']) ?>"/></td> <td class="error"><?php = $errors['price'] ?></td> </tr> <tr> <td>Please upload an Image:</td> <td><input id="photo" type="file" size="30" name="photo" value="<?php = htmlentities($values['photo']) ?>"/></td> <td class="error"><?php = $errors['photo'] ?></td> </tr> <tr> <td valign="top">Description:</td> <td> <textarea id="description" name="description" cols="30" rows="6"><?= htmlentities($values['description']) ?></textarea> </td> <td class="error"><?= $errors['description'] ?></td> </tr> <div> <input id="submmit" name="submit" type="submit" value="Send" /> </div> </table> </form> </div> </body> </html> <?php } function ProcessForm($values) { //INSERT VARIABLES FROM INSERT_ADD.PHP // Replace with actual page or redirect :P header ("Location: http://www.starjokes.com"); } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $formValues = $_POST; $formErrors = array(); if (!VerifyForm($formValues, $formErrors)) DisplayForm($formValues, $formErrors); else ProcessForm($formValues); } else DisplayForm(null, null); ?> Hi. I was just wondering if it is possible to write custom mysql errors. I have hunted around for some but cant find any. Currently I write my errors like... or die (mysql_error()); How ever I see this as a problem! As Im not the best coder there are bound to be errors in my code. I dont want somebody who knows what they are doing to cause an error and then doing it (mysql_error()) will point them in the right direction to what I have missed. I would rather have my own error saying what line the issue is with. I have tried..... or die (mysql_error(My personal error here)) However this does not work. Please help. Thank you Hello all, I am at a complete loss. For the past months I am developing a web site. I have the web site running at my Windows pc at home (where I mainly develop it and run it on Apache 2 with PHP (i think 5.3.x or 5.2.x) ) and I have it running live at the web server. I also have a macbook that I develop the same web site occasionally. I am using XAMPP and php 5.3.1 in this case. I keep the code between my two computers (Mac and Windows) up to the same level using SVN (which runs on a linux machine). What I have done a billion times before and in this case also is having the basic libraries included with require_once in one file called "baseincs.php" and then at each file I only include with require_once this one php file. This has been working for years perfectly and in this particular case has been working for months on the exact same code. Yesterday I wrote some (completely irrelevant, HTML GUI mostly) code on the Windows pc and uploaded it to the SVN. Today being at work I downloaded the SVN update to my mac and out of the sudden I get redeclaration errors on every page (beginning with the index.php). I cannot figure this out. I am positive I have not changed anything(!!!) on the index.php or the baseincs.php. I know that these error will manifest if you use include or require instead of include_once and require_once and you include the same file in multiple places in your code. This has not happened. Here is the code from the baseincs.php require_once 'config.php'; //sets various defined parameters application-wide require_once('session.inc'); require_once('errors.inc'); require_once('bootstrap.php'); require_once('usermanager.inc'); require_once('loginproc.inc'); // sets g_loggedInUID /** * If you don't actually generate any UI in your page, then * just don't instantiate the HtmlGenerator class .... */ require_once('htmlgen.php'); and here is the beginning of the index.php file ob_start(); require_once 'libraries/coreincs.php'; require_once 'libraries/utilitymanager.php'; //global $g_loggedInUID; if($g_loggedInUID !=-1) { $name = Users::fullNameFromUserID($g_loggedInUID); } Finally the code where I get the first error is the session.inc file and it follows <?php //only comments above here /** *=-----------------------------------------------------------= * nuke_session *=-----------------------------------------------------------= * This function completely destroys a session and all of its * data after we have logged a user out of our system. In * addition to destroying the session data, we destroy the session * cookie and also make sure that $_SESSION is unset. */ function nuke_session() { session_destroy(); setcookie(session_name(), '', time() - 3600); $_SESSION[] = array(); } /** * One of these sessions can last 60 minutes */ ini_set('session.gc_maxlifetime', 3600); session_start(); /** * Try to prevent session fixation by ensuring that we created * the session id. */ if (!isset($_SESSION['created'])) { session_regenerate_id(); $_SESSION['created'] = TRUE; } /** * Try to limit the damage from a compromised session id by * saving a hash of the User-Agent: string with another * value. */ if (!isset($_SESSION['user_agent'])) { /** * create a hash user agent and a string to store in session * data and user cookies */ $_SESSION['user_agent'] = md5($_SERVER['HTTP_USER_AGENT'] . USER_AGENT_SALT); setcookie('ag', $_SESSION['user_agent'], 0); } else { /** * verify the user agent matches the session data and * cookies. */ if ($_SESSION['user_agent'] != md5($_SERVER['HTTP_USER_AGENT'] . USER_AGENT_SALT) or (isset($_COOKIE['ag']) and $_COOKIE['ag'] != $_SESSION['user_agent'])) { /** * Possible Security Violation. Tell the user what * happened and refuse to continue. */ throw new SessionCompromisedException(); } } ?> Fatal error: Cannot redeclare nuke_session() (previously declared in /Users/andreass/MySites/projectoarc/oarc/libraries/session.inc:35) in /Users/andreass/MySites/projectOarc/oarc/libraries/session.inc on line 38 As you can see this is not true for session.inc Please note that the exact same code works on my Windows PC. Any help will be much appreciated!!!! Regards, menwn Hi everybody i have two problems with my code first one i cant upload .png files to the img folder (no problem with the other extensions ) the other one "if file exist" part doesnt work i dont get the message "File alredy exist" after uploading second time Can you help plase <form action="upload.php" method="post" enctype="multipart/form-data"> <input name="dosya" type="file"> <input name="submit" type="submit" value="Gonder"> </form> <?php $kaynak=$_FILES["dosya"]["tmp_name"]; $ad=$_FILES["dosya"]["name"]; $tur=$_FILES["dosya"]["type"]; $boyut=$_FILES["dosya"]["size"]; $hedef="./img"; if($tur == "image/jpeg" || $tur == "image/png" || $tur == "image/pjpeg" ) { if(!file_exists($ad)) { move_uploaded_file($kaynak,$hedef.'/'.$ad); echo "ok"; } else echo "File already exist"; } ?> |