PHP - Php W/xml N00b. Fatal Error Loading Xml
With the following code I am getting the Fatal Error: Maximum Execution time of 30 seconds exceeded.
$weather_data = simplexml_load_file('ftp://ftp2.bom.gov.au/anon/gen/fwo/IDV10450.xml'); $issuedate_pre = $weather_data->xpath('amoc/issue-time-utc'); echo $issuedate_pre."\n"; $issuedate_post = DateTime::createFromFormat('Y-m-d?H:i:s?', $issuedate_pre); echo $issuedate_post."\n"; $issuedate_unix = $issuedate_post->format('U'); echo $issuedate_unix; The page reads that "Line 10" is to blame for this, that is the first line in that script. I would have thought it might happen if the server doesn't respond, but if you go to the source of the XML it will load in a few seconds. Any help on how to load the XML properly would be greatly appreciated. Regards. Similar TutorialsHello all,
Appreciate if you folks could pls. help me understand (and more importantly resolve) this very weird error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 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 'ASC, purchase_later_flag ASC, shopper1_buy_flag AS' at line 3' in /var/www/index.php:67 Stack trace: #0 /var/www/index.php(67): PDO->query('SELECT shoplist...') #1 {main} thrown in /var/www/index.php on line 67
Everything seems to work fine when/if I use the following SQL query (which can also be seen commented out in my code towards the end of this post) :
$sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id";However, the moment I change my query to the following, which essentially just includes/adds the ORDER BY clause, I receive the error quoted above: $sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master ORDER BY purchased_flag ASC, purchase_later_flag ASC, shopper1_buy_flag ASC, shopper2_buy_flag ASC, store_name ASC) WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id";In googling for this error I came across posts that suggested using "ORDER BY FIND_IN_SET()" and "ORDER BY FIELD()"...both of which I tried with no success. Here's the portion of my code which seems to have a problem, and line # 67 is the 3rd from bottom (third last) statement in the code below: <?php /* $sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id"; */ $sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master ORDER BY FIND_IN_SET(purchased_flag ASC, purchase_later_flag ASC, shopper1_buy_flag ASC, shopper2_buy_flag ASC, store_name ASC) WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id"; $result = $pdo->query($sql); // foreach ($pdo->query($sql) as $row) { foreach ($result as $row) { echo '<tr>'; print '<td><span class="filler-checkbox"><input type="checkbox" name="IDnumber[]" value="' . $row["idnumber"] . '" /></span></td>';Thanks Hi Guys, Real PHP newbie here, and slowly getting to grips with it (I did say slowly, right!). Basically, I've created this register page. It's supposed to ask the user for their username, password, password verificiation, email address and then finally to ask the user to select from a tick list of interests (populated via the DB). Here's my code: <? include('includes/config.php'); $is_error = 0; if ($_POST['task'] == 'singup_do') { $signup_username = $_POST['user_username']; $signup_password = $_POST['user_password']; $signup_pwd_again = $_POST['user_password_again']; $signup_email = $_POST['user_email_address']; $signup_interest = $_POST['signup_interest']; if ($signup_username == ''){ $is_error = 1; $signup_username_msg = 'The username cannot be left blank'; } if ($signup_password == ''){ $is_error = 1; $signup_password_msg = 'Password field cannot be left blank'; } if ($signup_pwd_again == ''){ $is_error = 1; $signup_pwd_again_msg = 'Password again field cannot be left blank'; } if ($signup_email == ''){ $is_error = 1; $signup_email_msg = 'Email cannot be left blank'; } if ($signup_email != '' && !validateEmailAddress($signup_email)) { $is_error = 1; $signup_email_msg = 'Incorrect E-mail address'; } if (!is_array($signup_interest) || count($signup_interest)==0){ $is_error = 1; $signup_interest_msg = 'Please select atleast one interest'; } //EMAIL ADDRESS VALIDATION if ($signup_password!='' && $signup_pwd_again!='' && $signup_password != $signup_pwd_again) { $is_error = 1; $error_msg = 'Passwords don\'t match'; } //USERNAME DUPLICATION VALIDATION if (!$is_error && $signup_username!='' && !checkUsername($signup_username)) { $is_error = 1; $signup_username_msg = 'Username already taken, please enter another'; } if (!$is_error) { $signup_interest_ids = ( is_array($signup_interest) ? implode(',', $signup_interest) : '' ); $users_insert = "INSERT INTO users SET user_id='', user_username = '{$signup_username}' , user_password='{$signup_password}', user_email_address = '{$signup_email}', users_interests='{$signup_interest_ids}', user_active='Y', user_date_added=NOW()"; mysql_query($users_insert); header('Location:login.php?signup=success'); } } ?> <html> <head> <title>Register</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> </head> <body > <div align="center"><BR><BR><BR> <div style="width:50%; "> <form name="frmSignup" action="sign_up.php" method="post"> <input type="hidden" name="task" value="singup_do"> <table width="100%" border="0" cellspacing="4" cellpadding="4" align="center"> <? if ($error_msg!='') {?> <tr><td> </td><td class="tahoma10rednormal"><?=$error_msg?></td></tr> <? }?> <tr><td width="20%" valign="top">Username : </td><td><input name="user_username" type="text" class="textfield" size="35" value="<?=$signup_username?>"/><? if ($signup_username_msg!='') { echo '<BR><span class="tahoma10rednormal">' . $signup_username_msg. '</span>' ; } ?></td></tr> <tr><td valign="top">Password : </td><td><input name="user_password" type="password" class="textfield" size="35" value="<?=$signup_password?>"/><? if ($signup_password_msg!='') { echo '<BR><span class="tahoma10rednormal">' . $signup_password_msg. '</span>' ; } ?></td></tr> <tr><td valign="top">Password (again): </td><td><input name="user_password_again" type="password" class="textfield" size="35" value="<?=$signup_pwd_again?>"/><? if ($signup_pwd_again_msg!='') { echo '<BR><span class="tahoma10rednormal">' . $signup_pwd_again_msg. '</span>' ; } ?></td></tr> <tr><td valign="top">Email address: </td><td><input name="user_email_address" type="text" class="textfield" size="35" value="<?=$signup_email?>"/><? if ($signup_email_msg!='') { echo '<BR><span class="tahoma10rednormal">' . $signup_email_msg. '</span>' ; } ?></td></tr> <tr><td colspan="2" ><b>Interests:</b><? if ($signup_interest_msg!='') { echo ' <span class="tahoma10rednormal">' . $signup_interest_msg. '</span>' ; } ?></td></tr> <tr><td colspan="2"> <? $categories = getCategories(); $categories_count = count($categories); if (is_array($categories)) { $cat_counter=0; ?> <table width="80%" border="0" cellspacing="4" cellpadding="4"> <? foreach($categories as $cats) { if ($cat_counter==0 || ($cat_counter%4) == 0) echo '<tr>'; $chk_selected = ''; if (is_array($signup_interest) && in_array($cats['id'], $signup_interest)) $chk_selected = "CHECKED"; ?> <td><input type="checkbox" name="signup_interest[]" value="<?=$cats['id']?>" <?=$chk_selected?>><?=$cats['text']?></td> <? if ($cat_counter==$categories_count || ($cat_counter%4) == 3) echo '</tr>'; $cat_counter++; } ?> </table> <? } else { echo 'No interest added yet.'; } ?> </tr> <tr> <td> </td> <td><input type="submit" name="submit_btn" value="Sign Up"> <input type="button" name="cancel_btn" value="Cancel" onClick="window.location.href='index.php'"></td> </tr> </table> </div> </div> </body> </html> I'm getting undefined varible errors for: Notice: Undefined variable: error_msg Undefined variable: signup_username_msg Notice: Undefined variable: signup_password_msg Notice: Undefined variable: signup_pwd_again_msg Notice: Undefined variable: signup_email_msg Notice: Undefined variable: signup_interest_msg Notice: Undefined variable: signup_interest Notice: Undefined variable: signup_interest Which as the canny of you will have noticed, is all of them! Hurrah at least I'm consistent! If anyone could help out a n00b I'd be so so grateful. Thanks! Rob Hello , I have a made a PHP website where users signup and send their Date of Birth and gets an OTP on their email after signup. The OTP is recieved but when we enter the OTP this problem occurs QuoteError! Something went wrong and I am facing this error in the error log QuotePHP Fatal error: Uncaught Error: Object of class DateTime could not be converted to string This is my config.php code <?php session_start(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Confirmation Page - Kanha Stories</title> <style> body { background-color: #330000; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' viewBox='0 0 800 400'%3E%3Cdefs%3E%3CradialGradient id='a' cx='396' cy='281' r='514' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%23D18'/%3E%3Cstop offset='1' stop-color='%23330000'/%3E%3C/radialGradient%3E%3ClinearGradient id='b' gradientUnits='userSpaceOnUse' x1='400' y1='148' x2='400' y2='333'%3E%3Cstop offset='0' stop-color='%23FA3' stop-opacity='0'/%3E%3Cstop offset='1' stop-color='%23FA3' stop-opacity='0.5'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect fill='url(%23a)' width='800' height='400'/%3E%3Cg fill-opacity='0.4'%3E%3Ccircle fill='url(%23b)' cx='267.5' cy='61' r='300'/%3E%3Ccircle fill='url(%23b)' cx='532.5' cy='61' r='300'/%3E%3Ccircle fill='url(%23b)' cx='400' cy='30' r='300'/%3E%3C/g%3E%3C/svg%3E"); background-attachment: fixed; background-size: cover; padding: 20px; width: 100vw; height: 100vh; display: flex; align-items: center; justify-content: center; color:#ffffff; overflow-x: hidden; } .cont { padding: 20px 40px; position: relative; border-right: 4px solid rgb(184, 182, 182); border-bottom: 4px solid rgb(184, 182, 182); border-radius: 15px; display: flex; flex-direction: column; align-items: center; } #left{ float: left; } #right{ float: right; } input{ margin: 10px 0px; } s{ padding: 5px; } .error{ padding: 5px; color: #ffffff; } .resend{ color: rgb(14, 14, 196); padding: 5px; } .s:hover{ cursor: pointer; background-color:gray; color: rgb(243, 237, 237); border-radius: 5px; } </style> </head> <body> <?php $code=""; $err=""; $error=""; if(($_SERVER["REQUEST_METHOD"]=="GET" && $_SESSION['xyz'] === 'xyz') || isset($_POST['verify']) || isset($_POST['resend'])) { unset($_SESSION["xyz"]); if($_SERVER["REQUEST_METHOD"] ==="POST") { if(isset($_POST['verify'])) { if(empty($_POST['code'])) { $err="Enter the code!"; } else { $code=$_POST['code']; if(password_verify($code,$_SESSION['code'])) { $name=$_SESSION['name']; $email=$_SESSION['email']; $tel=$_SESSION['tel']; $dob=$_SESSION['dob']; $password=$_SESSION['password']; $age_category=$_SESSION['age_category']; require_once('./all_utils/connection.php'); $sql="INSERT INTO identity_table(name,email,password,tel,dob,age_category) VALUES ('$name','$email','".$password."','$tel','$dob','$age_category')"; if(mysqli_query($conn,$sql) === TRUE) { unset($_SESSION["name"]); unset($_SESSION["password"]); unset($_SESSION["dob"]); unset($_SESSION["tel"]); unset($_SESSION["age_category"]); header("location:welcome/welcome.php"); } else { $err="Error! Something went wrong"; } } else { $err="Incorrect code!"; } } } elseif(isset($_POST['resend'])) { require_once('./all_utils/mail.php'); $error="OTP has been sent again!"; } } } else{ header("location:signup.php"); } ?> <div class="cont"> <h2> Email Verification</h2> <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST"> <label for="verification">Enter the 5 digit code</label> <br/> <p> Didn't got the mail? Please check your spam folder </p> <input type="text" name="code" placeholder="Eg. 12345" value="<?php echo $code; ?>"> <br/> <div class="error"><?php echo $err; ?></div> <div class="resend"><?php echo $error;?></div> <input type="submit" name="resend" class="s" id="left" value="Resend OTP"> <input type="submit" name="verify" class="s" id="right" value="Verify"> </form> </div> </body> </html>
This is my signup.php code <?php session_start(); if(!empty($_SESSION['email'])) { require_once('./all_utils/connection.php'); $query="SELECT * FROM identity_table WHERE email='".$_SESSION['email']."'"; $result=mysqli_query($conn,$query); if(mysqli_fetch_assoc($result)) { header("location:welcome/welcome.php"); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>SignUp - Kanha Stories</title> <style> * { margin: 0; padding: 0; } body { width: 100vw; height: 100vh; display: flex; align-items: center; background-color: #ff9d00; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' viewBox='0 0 1600 800'%3E%3Cg stroke='%23000' stroke-width='66.7' stroke-opacity='0' %3E%3Ccircle fill='%23ff9d00' cx='0' cy='0' r='1800'/%3E%3Ccircle fill='%23f27d00' cx='0' cy='0' r='1700'/%3E%3Ccircle fill='%23e55f00' cx='0' cy='0' r='1600'/%3E%3Ccircle fill='%23d84400' cx='0' cy='0' r='1500'/%3E%3Ccircle fill='%23cb2c00' cx='0' cy='0' r='1400'/%3E%3Ccircle fill='%23bf1600' cx='0' cy='0' r='1300'/%3E%3Ccircle fill='%23b20300' cx='0' cy='0' r='1200'/%3E%3Ccircle fill='%23a5000e' cx='0' cy='0' r='1100'/%3E%3Ccircle fill='%2398001c' cx='0' cy='0' r='1000'/%3E%3Ccircle fill='%238b0027' cx='0' cy='0' r='900'/%3E%3Ccircle fill='%237e0030' cx='0' cy='0' r='800'/%3E%3Ccircle fill='%23710037' cx='0' cy='0' r='700'/%3E%3Ccircle fill='%2364003b' cx='0' cy='0' r='600'/%3E%3Ccircle fill='%2358003c' cx='0' cy='0' r='500'/%3E%3Ccircle fill='%234b003a' cx='0' cy='0' r='400'/%3E%3Ccircle fill='%233e0037' cx='0' cy='0' r='300'/%3E%3Ccircle fill='%23310030' cx='0' cy='0' r='200'/%3E%3Ccircle fill='%23210024' cx='0' cy='0' r='100'/%3E%3C/g%3E%3C/svg%3E"); background-attachment: fixed; background-size: cover; overflow-x: hidden; } .cont { color: #ffffff; width: 500px; margin: auto; } h2 { color: #ffffff; text-align: center; padding: 1.5px; } .error { text-align: center; padding: 20px; font-size: 1rem; color: rgb(233, 76, 76); } form { font-size: 1.2rem; /* width: 40%; */ /* margin: auto; */ } .in{ margin: 5px 0; } input { border: 2px solid white; padding: 10px; margin: 5px 0; font-size: 1rem; width: 100%; } input:hover { border: 2px solid rgb(228, 81, 81); cursor: text; } p,a{ text-align: center; font-size: 1rem; } a{ color: deepskyblue; font-size:20px; } #s{ text-decoration:none; border-radius: 12px; } #s:hover { cursor: pointer; } a { text-decoration: none; } @media only screen and (max-width: 600px){ .cont{ width: 300px; } .error,input{ font-size: 0.8rem; } } @media only screen and (max-width: 400px){ .cont{ width: 70%; } h2{ font-size: 1.3rem; } a,p{ font-size: 0.7rem; } label{ font-size: 1.0rem; } input{ padding: 4px; } } </style> </head> <body> <?php $name=""; $email=""; $tel=""; $dob=""; $err=""; $name_err=""; $email_err=""; $tel_err=""; $dob_err=""; $password_err=""; if($_SERVER["REQUEST_METHOD"]=="POST") { if(isset($_POST['signup'])) { if(empty($_POST['name']) || empty($_POST['dob']) || empty($_POST['tel']) || empty($_POST['email']) || empty($_POST['password'])) { if(empty($_POST['name'])) { $name_err="Name is required!"; } else{ $name=$_POST['name']; } if(empty($_POST['email'])) { $email_err="Email is required!"; } else{ $email=$_POST['email']; } if(empty($_POST['tel'])) { $tel_err="Contact Number is required!"; } else{ $tel=$_POST['tel']; } if(empty($_POST['dob'])) { $dob_err="D.O.B is required!"; } else{ $dob=$_POST['dob']; } if(empty($_POST['password'])) { $password_err="Password is required!"; } } else { $today = new DateTime(date('m.d.y')); $dob = new DateTime($_POST['dob']); $diff1 = $today->diff($dob); $age = $diff1->y; if($age > 15 || $age <3) { $dob = $_POST['dob']; $dob_err = "Age criteria not satisfied , child's age must be between 3-15 years"; } else { require_once("./all_utils/connection.php"); $email=$_POST['email']; $query="SELECT * FROM identity_table WHERE email='".$email."'"; $result=mysqli_query($conn,$query); if(mysqli_fetch_assoc($result)) { $err="Email alredy registered!"; $name=$_POST['name']; $email=$_POST['email']; } else { if($age < 7) { $_SESSION['age_category'] = '1'; } else { $_SESSION['age_category'] = '2'; } $_SESSION['name']=$_POST['name']; $_SESSION['email']=$_POST['email']; $_SESSION['password'] = password_hash($_POST['password'],PASSWORD_DEFAULT); $_SESSION['tel']=$_POST['tel']; $_SESSION['dob']=$_POST['dob']; $_SESSION['xyz']='xyz'; require_once("all_utils/mail.php"); header("location:conf.php"); } } } } } ?> <div class="cont"> <h2>SignUp - Kanha Stories</h2> <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF'])?>" method="POST"> <span class="error"><?php echo $err; ?></span> <br/> <label for="name">Name</label><br /> <input type="text" name="name" placeholder="Enter your name" value="<?php echo $name; ?>"> <span class="error"><?php echo $name_err; ?></span> <br/> <label for="email">Email</label><br /> <input type="email" name="email" placeholder="Enter your Email ID" value="<?php echo $email; ?>"> <span class="error"><?php echo $email_err;?></span> <br/> <label for="tel">Mobile Number</label><br /> <input type="tel" name="tel" placeholder="Enter Mobile Number" value="<?php echo $tel; ?>"> <span class="error"><?php echo $tel_err;?></span> <br/> <label for="date">D.O.B. of Child (Click on Calander icon)</label><br /> <input type="date" name="dob" placeholder="Enter date of birth " value="<?php echo $dob;?>"> <span class="error"><?php echo $dob_err;?></span> <br/> <label for="password">Password</label><br /> <input type="password" name="password" placeholder="Enter your Password"> <span class="error"><?php echo $password_err; ?></span> <br/> <div class="sub"> <input type="submit" name="signup" id="s" placeholder="Submit"><br /> </div> </form> <p>Already registered? <a href="./login.php">log in here</a></p> </div> </body> </html>
I don't know what I can do now , Please try to give me the solutions as soon as possible. Thanks I closed everything down last night and it was all fine, website was working as normal etc, but I've turned on the Xxamp server today and I am getting this error. Seems very random as nothing has changed since it was last on? Does anyone know how to sort this out and why I'm now getting this error? Thanks! Can anyone help me with this error? Fatal error: Call to a member function require_login() on a non-object in /home/wallls/public_html/index.php on line 27 Lines 26-33 below: <?php $smilek = $_GET['id']; $ppalout = $_GET['payout']; $healthy = array("%", "!", "=", "'", ",", "OR", "?", "<", "&", ";"); $yummy = array("", "", "", "", "" ,"", "", "", "", ""); $peee = str_replace($healthy, $yummy, $smilek); $chnpay = str_replace($healthy, $yummy, $ppalout); require_once 'appinclude.php'; require_once 'mystyle.php'; echo '<div align="center"><img src="'.$appcallbackurl.'main.png" width="300" height="150"></div>'; require_once 'ads/topads.php'; ?> <fb:tabs> <fb:tab-item href='<? echo $appCanvasUrl; ?>' title='Lottery' selected='true' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>earn.php' title='Get Tickets' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>payment.php' title='Payment Info' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>history.php' title='Lottery History' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>forum.php' title='Forum' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>invite.php' title='Invite Friends' /> </fb:tabs> <div align="center"> <? $fbid = $facebook->require_login(); $theirip = $_SERVER['REMOTE_ADDR']; if ($fbid == "") { ?>
Hello everyone This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=311225.0 Hi there, I have a local server set up on my computer which I have used before and it worked flawlessly. It is running apache with PHPand mySQL set up as services. Recently I attempted to copy a project I have worked on at school onto my server. I have the database up and running, however when I try to run a PHP file it gives me the error: Quote Fatal error: Cannot redeclare getText() in C:\Server\htdocs\projects\tournament\includes\functions.php on line 20 When I rename that function (which I know is not being redeclared) I get a browser error: Quote This webpage is not available. The webpage at http://localhost/projects/tournament/index.php might be temporarily down or it may have moved permanently to a new web address. More information on this error Below is the original error message Error 101 (net::ERR_CONNECTION_RESET): Unknown error. Has anybody else experienced this error and have a solution to fix it? My guess is that it has to do with the function gettext() being available on this machine but not on the machine at school, however I thought PHP was case sensitive? Hi, I am very new to PHP and I am trying to execute the below code but getting these errors : Notice: Undefined variable: mysql_query in C:\wamp\www\process.php on line 16 Fatal error: Function name must be a string in C:\wamp\www\process.php on line 16 Code: <html><body> <?php mysql_connect("localhost","root",""); mysql_select_db("encryption") or die(mysql_error()); $username = $_POST['username']; $password = $_POST['password']; $mysql_query("INSERT INTO login (username,password) VALUES ('$username','$password')") or die(mysql_error()); ?> </body></html> ` $_POST['username'] & $_POST['password'] come from a previous page. I have no problem with that. Please help.. Thanks in advance.
In PHP Version 8.0 shows error as : In previous versions of PHP it does not show any error. Please resolve the issue. I am having a problem with my codes. please help. Fatal error: Maximum execution time of 30 seconds exceeded in D:\xampp\htdocs\motoinventory\cake\libs\model\datasources\dbo_source.php on line 1084 this is line: 1084 if (isset($value[$model->alias]) && $value[$model->alias][$model->primaryKey] === $data[$association][$model->hasMany[$association]['foreignKey']]) { Hi there, I get this message on my website when i click the clear cart button or the +- button Fatal error: Call to a member function GetCart() on a non-object in /hermes/web11b/b1267/moo.organicgrowshopcouk/cart.php on line 31 I'd really appreciate any help. thanks, Matt I have a script which is uploading very large files into blobs (<=800MB). Now i had the max memory size in the php.ini set to 150MB and while uploading it would stop and tell me that that I exhausted all the bytes (157xxxxx can remember the exact figure but im pretty sure it equalled 150MB). Any ways I experimentally set the max memory size to 800MB just to see if that would help and now its telling me Fatal error: Out of memory (allocated 524288) (tried to allocate 804524032 bytes)? What is the meaning of this and how can one rectify the issue? Any info would be tremendous! -SB Hello, I am trying to run a script on my site , The script is this : https://github.com/simplecoin/simplecoin and I am getting these errors [Sat Aug 13 11:47:01 2011] [error] [client 84.228.254.88 ] PHP Fatal error: Call to a member function fetch() on a non-object in /var/www/includes/stats.php on line 42,[/code] Code: [Select] ] PHP Warning: Invalid argument supplied for foreach() in /var/www/includes/stats.php on line 89 and Code: [Select] ] PHP Warning: Invalid argument supplied for foreach() in /var/www/stats.php on line 75 I run ubuntu 11 vps . Some one told me that [quote]Probably this query is not returning a value, so it gives an error. [code]$sql = "SELECT count(id) FROM shares WHERE id > $lastwinningshare AND our_result='N'";Most likely it will go away as soon as it returns something. [/quote] from the file /includes/stats.php I really need to fix this problem , is there any module i need to install or the code is incorrect ? If you want i can give you a link to php info of my vps . Thanks a lot for the help ! Hi guys, I have managed to get all my oAuth to work (basically), however the autorize.php is getting this error when "Allowing". Any ideas why? Only happens once I press allow and it should have redirected to the REDIRECT_URI. Thanks in advance. Hi, I'm getting below error in my page http://www.cidirealty.com/NWMLS/mls.php PHP Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in E:\USERS\cidirealty\www\NWMLS\mls.php:54 Stack trace: #0 E:\USERS\cidirealty\www\NWMLS\mls.php(54): SimpleXMLElement->__construct(' Does anyone know what this means and how to solve this? Thank you. Hi guys and girls, I am trying to create an XML document from an php document and a sql_query but I am getting this fatal error: Fatal error: Call to undefined method DOMComment::createElement() in /content_ro/webdev/htdocs/schools/hhs/psy_bookings/home.php on line 15 <?php include("php/dbconnect.php"); //connects to the database $table_id = 'booking'; $query = "SELECT * FROM $table_id WHERE (booking.bookingDate = curDate()) AND roomID = 1 ORDER BY startTime"; $room1 = mysql_query($query); //create a new DOM document $doc = new DOMComment('1.0'); //create root element $root = $doc->createElement('root'); $root = $doc->appendChild($root); //process one row at at time while($row = mysql_fetch_assoc($room1)){ //add node for each row $occ = $doc->createElement($table_id); $occ = $doc->appendChild($occ); //add achild for each field foreach ($row as $fieldname => $fieldvalue){ $child = $doc->createElement($fieldname); $child = $occ->appendChild($child); $value = $doc->createTextNode($fieldvalue); $value = $child->appendChild($value); } } mysql_free_result($room1); $xml_string = $doc->saveXML(); echo $xml_string; ?> I am following a tutorial on http://www.tonymarston.net/php-mysql/dom.html this is my code Code: [Select] <?php require ("s_check_login.php"); include ('database.php'); if(isset($_POST['csv_btn'])){ $str = $_POST['csv']; $date = mysql_real_escape_string($_POST['date']); $gal = mysql_real_escape_string($_POST['gal']); $op = mysql_real_escape_string($_POST['op']); $parts = explode( "\n", $str ); $team = array(); foreach( $parts as $part ) $team[] = str_getcsv($part); unset($parts); $tcount = count($team); for($x=0; $x<$tcount; $x++){ $p = $team[$x]; $sql = "INSERT INTO gbsa_stats (id, Player, Day_Played, Opponent, Gallery_no, Goals, Assists, Shots, On_Goal, Off_Post, Offsides, Saves, Fouls, Shots_Corner, Goals_Corner, Yellow, Red) VALUES ('NULL','$p[1]','$date','$op','$gal','$p[2]','$p[3]','$p[4]','$p[5]','$p[6]','$p[7]','$p[8]','$p[9]','$p[10]','$p[11]','$p[12]','$p[13]')"or die ('Error Updateing Database ' .mysql_error()); if (!mysql_query($sql)){ die('Error : ' .mysql_error()); } } } ?> <!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></title> </head> <body> <form id="form1" name="form1" method="post" action=""> <h1>csv data:</h1> <textarea name="csv" cols="100" rows="25" id="csv"></textarea> <br /> <h1>Date:</h1> <input type="text" name="date" id="date" /> <br /> <h1>Opponent:</h1> <input type="text" name="op" id="op" /> <br /> <h1>Gallery Number:</h1> <input type="text" name="gal" id="gal" /> <br /> <h1> </h1> <input type="submit" name="csv_btn" id="csv_btn" value="Submit" /> </form> </body> </html> when i run it on my local machine it works with no problem but when i upload it to my server and try to run it i get this error Code: [Select] Fatal error: Call to undefined function str_getcsv() in /html/admin/stats.php on line 14 this code was working perfectly fine past few months. nothings changed and now i am getting this error: Quote Fatal error: Call to a member function value() on a non-object in /home/staceyxs/public_html/_includes/login.php on line 8 <table style="width: 100%" class="style17" background="../images/content.png"> <tr> <td class="style3" style="width: 266px"> <img alt="" src="../images/headers/VIPL.png" width="220" height="220" /></td> <td > <form action="../System/process.php" method="POST" style="height: 62px"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr><td><strong>Username:</strong></td><td><input class="txt" type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>" /></td><td><? echo $form->error("user"); ?></td></tr> <tr><td><strong>Password:</strong></td><td><input class="txt" type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>" /></td><td><? echo $form->error("pass"); ?></td></tr> <tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?> /> <font size="2">Remember me next time <input type="hidden" name="sublogin" value="1" /> <input type="submit" class="btn" value="Login" style="width: 70px; height: 40px" /></td></tr> <tr><td colspan="2" align="left"><br /><font size="2">[<a href="../System/forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr> <tr><td colspan="2" align="left"><br />Not registered? <a href="../Register/index.php"> Register Now!</a></td></tr> </table> [<a href="../System/help.php" onclick="window.open('../System/help.php','popup','width=480,height=230,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false">Help</a>]</div> </form> </td> </tr> </table> HOW TO FIX Fatal error: Uncaught Error: Using $this when not in object context in /testynarkotykowe/libs/timer/index.php:13 Stack trace: #0 /testynarkotykowe/index.php(36): TIMER::getTime('all') #1 /testynarkotykowe/m/pg/index.php(110): PAGE->PAGE(NULL, 'cart') #2 /testynarkotykowe/index.php(28): include_once('/testynarkotyko...') #3 /testynarkotykowe/index.php(115): loadMod('pg') #4 {main} thrown in /testynarkotykowe/libs/timer/index.php on line 13 HOW TO TRACK THE ERROR? http://testynarkotykowe.j13x.pl/index.txt Quote<?php #error_reporting(0); define('PHP','.php'); require_once('_gz/php_speedy'.PHP); define('INX','index'); define('HTML','.html'); error_reporting(E_ALL ^ E_NOTICE); define('N','/'); ini_set('memory_limit','512M'); define('DIR_LIB','libs/'); define('DIR_MOD','m/'); define('DIR_TPL','tpl/'); define('DIR_LNG','lng/'); define('R_TIME',2*1000); define('PTH',''); define('HTTP','http://'); define('RANGE_IMG',5000); define('URL',HTTP.$_SERVER['HTTP_HOST'].N.PTH); define('_URL',HTTP.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); define('TAX_RATE',0.08); /* for drug_tests [!] */ define('DOTPAY_ID',37953); define('POPUP_NW',"'mywindow','width=400,height=200,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes')"); define('_E','ENGINE | '); define('_LNG','X lng file in mod'); define('_DB','DB | '); define('H','Hacking Attempt | '); define('_C','COOKIE | '); define('_S','SESSION | '); define('NOREPLY','noreply'); define('WWW','www.'); define('JQ','jquery'); define('SEP',' | '); define('SP','|'); define('URI_SEP',','); define('BULK_URI','?bulk'); define('GUEST','Anonymous'); define('C_EXP',time()+24*3600*30); define('PP',14); define('TH_W',125); define('TH_H',75); define('TH',95); define('COUNTDOWN',7); define('HIDE','st'); define('NL',"\n"); define('DATETIME',date('Y-m-d H:i:s')); define('DATETIME_YESTERDAY',date("Y-m-d",time()-(60*60*24))); define('IMG_W',864); define('IMG_H',720); define('IMG_',70); define('IMG_TH','_th.'); define('IMG_AV','_avatar.'); define('MAIL_STYLE',' style="color:blue;text-decoration:underline"'); define('A4_W',946); define('A4_H',1334); /* 595,842 */ define('LIMIT_SIGNATURE',30); define('LIMIT_UTOPICS',16); define('HASH','#'); define('C_TIP_LIMIT',10); define('C_LIMIT',2);/*COMMENTS*/ define('WRAP0',42); define('WRAP1',370);/*74 x 5*/ define('LIMIT_PREFACE',300); define('hideAFTER',3000); define('ERASE_AFTER_X_DAYS',30); define('NOTIFS_LIMIT',2000); define('__ID','ID non'); define('__D','!digit'); define('__R','record non'); define('LOC','Location: '); define('PER_PG',10); define('PER_PG2',5); define('PER_PG3',25); define('PER_PG4',40); session_start(); define('DATETIME_NO','0000-00-00 00:00:00'); define('AminLENGTH',10); define('fade1',100); define('RANGE',50000); define('TH_PRE','th.'); define('TH_EXT','jpg'); define('USERNAME','0100000');/*OBLIGATORY: "0" on the beginning*/ define('USERNAME_LENGTH',strlen(USERNAME)); define('QMIN_LENGTH',10); define('BALANCE0',"0.00"); define('PIN_ATTEMPTS',5); define('MIN_AMOUNT',100); define('RATE0','0.0000'); function datetime($diff) { $timestamp=time(); $tm=86400*$diff; $tm=$timestamp+$tm; return $tm; } define('DATETIME1',date('Y-m-d H:i:s',datetime(1))); define('LANGUAGE','pl'); define('LNG',LANGUAGE.N); define('LG','_'.LANGUAGE); define('MIN_LENGTH',3); define('CURRENCY','PLN'); /* testy */ define('_DEFAULT_ITEM_CNT',4); define('_PROMO_ITEM_CNT',11); define('_PROMO_'.strtoupper(LANGUAGE).'_PRICE',115); define('_PROMO_'.strtoupper(LANGUAGE).'_BEFORE_PRICE',129); /*define('U_FIELDS','id,p,phone,mail,act_lnk,session,name');*/ define('URL_LENGTH',120); /* to 120 */ define('AUTOSAVE_DRAFT_TIME',60*1000); /* TESTY */ #if(!empty($_GET['uid'])) { if(ctype_digit($_GET['uid'])) { $_SESSION['ref'] = $_GET['uid']; unset($_SESSION['uid']); } header(LOC.URL); exit; }/* or $_SERVER['HTTP_HOST'] == 'www.testynarkotykowe.pl'*/ function loadLib($l) { $pth = DIR_LIB.strtolower($l).N.basename(INX).PHP; if(file_exists($pth)) include_once($pth); else die(_E.'loadLib [ '.$pth.' ]'); } function loadLang($l,$m) { $pth = DIR_LNG.strtolower($l).N.strtolower($m).N.basename(INX).PHP; if(file_exists($pth)) include_once($pth); else die(_E.'loadLang [ '.$pth.' ]'); } loadLib('url'); @URL::sUrl(); #try { $db = new PDO('mysql:host=localhost;dbname=andypsv_cocain','root','',array(PDO::ATTR_PERSISTENT=>true)); } catch(PDOException $e) { die('PDO::Can\'t connect'); } try { $db = new PDO('mysql:host=serwer2056122.home.pl;dbname=32538868_thejokerred','32538868_thejokerred','M98thiuhsnduit@@##^',array(PDO::ATTR_PERSISTENT=>true)); } catch(PDOException $e) { die('PDO::Can\'t connect'); } $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE,PDO::FETCH_ASSOC); define('PRFX','drugtests_'); $db->query('SET NAMES utf8'); $db->query('SET CHARACTER SET utf8'); $db->query('SET collation_connection = utf8_general_ci'); header('content-type:text/html;charset:utf-8'); $c = $db->query('SELECT * FROM '.PRFX.'cfg'.LG); if($c->rowCount() == 0) die(_E.'X cfg file'); $c = $c->fetch(); foreach($c as $k=>$v) define('PG_'.strtoupper($k),$v); define('PG_TPL',DIR_TPL.PG_TPLX.DIR_MOD); define('C_NAME',PG_T2); loadLib('ip'); loadLib('auth'); loadLib('pages'); loadLib('func'); loadLib('time'); function uQuery($GET) { if(substr($GET,0,USERNAME_LENGTH) == USERNAME) $sql = 'id = "'.substr($GET,USERNAME_LENGTH).'"'; else $sql = 'uri = "'.$GET.'"'; return $sql; } function rtrnLoc() { $LENGTH = strlen(URL); if($_SERVER['HTTP_REFERER'] == URL) return URL; else if(substr($_SERVER['HTTP_REFERER'],0,$LENGTH) == URL) return $_SERVER['HTTP_REFERER']; else return URL; } function arr_short($arr) { $res = array(); foreach($arr as $subArray) foreach($subArray as $k => $v) $res [$k] = $v; return $res; } function loadMod($m) { $pth = DIR_MOD.strtolower($m).N.INX.PHP; if(file_exists($pth)) include_once($pth); else exit(header(LOC.URL,true,301)); } function errLog($err) { global $db; $q = $db->query('INSERT INTO '.PRFX.'err (date,err) VALUES ("'.DATETIME.'","'.$err.'")'); if($q->rowCount() <> 1) die(H.'errLog, fatal failure [not logged error to db]'); else return substr(strstr($err,':'),2); } class PAGE { var $_t,$_k,$_d,$_c,$_nav,$_,$tpl,$u,$md; function PAGE($md='',$md2='',$md3='',$md4='') { global $db,$md; loadLib('timer'); @TIMER::setTimer('all'); require_once(DIR_LIB.DIR_TPL.'class.template'.PHP); $this->tpl = new Template_Lite; $_gTime = TIMER::getTime('all'); $this->tpl->assign('_gTime',$_gTime); $this->tpl->assign('URL',URL); define('TPL',URL.DIR_TPL.PG_TPLX); $this->tpl->assign('TPLx',DIR_TPL.PG_TPLX); $CONSTANS = get_defined_constants(); foreach($CONSTANS as $k => $v) $this->tpl->assign($k,$v); foreach($_POST as $k => $v) if(is_array($_POST[$k])) foreach($_POST[$k] as $k2 => $v2) $_POST[$k][$k2] = htmlspecialchars(trim($v2)); else $_POST[$k] = htmlspecialchars(trim($v)); foreach($_COOKIE as $k => $v) $_COOKIE[$k] = htmlspecialchars(trim($v)); $this->tpl->assign('_GET',$_GET); $this->tpl->assign('_POST',$_POST); $this->tpl->assign('_COOKIE',$_COOKIE); $this->tpl->assign('_SESSION',$_SESSION); $this->tpl->assign('INX',INX); $this->u = isUlogd(str_replace(' ','',PG_T2)); $this->tpl->assign('u',$this->u); $pth = DIR_LNG.LNG.INX.N.INX.PHP; if(file_exists($pth)) { include_once($pth); $lng_index = $_; } else die(_LNG.' [[ index ]]'); $md = strtolower($md.N); $pth = DIR_LNG.LNG.$md.INX.PHP; $this->md = $md; $this->tpl->assign('md',substr($md,0,-1)); if(file_exists($pth)) include_once($pth);/* else die(_LNG);*/ $LNG_all = array_merge($lng_index,$_); $_ = ''; /* HERE IS ISSUE WHEN A FILE IS __INCLUDED <br/> unnecessary, temp-fix: LNG_attached */ if(!empty($md2)) { $md2 = strtolower($md2.N); $pth = DIR_LNG.LNG.$md2.INX.PHP; if(file_exists($pth)) include_once($pth); else die(_LNG.'2: '.$pth); $md2_index = $_; $LNG_all = array_merge($LNG_all,$md2_index); } if(!empty($md3)) { $md3 = strtolower($md3.N); $pth = DIR_LNG.LNG.$md3.INX.PHP; if(file_exists($pth)) include_once($pth); else die(_LNG.'3: '.$pth); $md3_index = $_; $LNG_all = array_merge($LNG_all,$md3_index); } if(!empty($md4)) { $md4 = strtolower($md4.N); $pth = DIR_LNG.LNG.$md4.INX.PHP; if(file_exists($pth)) include_once($pth); else die(_LNG.'4: '.$pth); $md4_index = $_; $LNG_all = array_merge($LNG_all,$md4_index); } $this->_ = $LNG_all; $this->tpl->assign('_',$this->_); $this->tpl->assign('LG',substr(LG,1)); //? $this->tpl->assign('i_drugtests','drug_tests/'); if(ctype_digit(end(explode(',',$_GET[0])))) $this->tpl->assign('col2',1); $q = $db->query('SELECT * FROM '.PRFX.'c0'.LG); if($q->rowCount() == 0) die(_E.'no categories'); while($_c0 = $q->fetch()) $c0[] = $_c0; $this->tpl->assign('c0',$c0); #var_export($_SESSION); die; #session_destroy(); /* CART */ $q = $db->query('SELECT * FROM `'.PRFX.'products'.LG.'`'); if($q->rowCount() == 0) die(_DB.'no records'); while($cart = $q->fetch()) { $cart['t_url'] = _url($cart['t']); $cart['base'] = sprintf('%.2f',$cart['base']); $cart['unit_'] = preg_replace('#[0-9]+\.+[0-9]#i','',$cart['unit']); if(empty($cart['total'])) $cart['total'] = sprintf('%.2f','0'); $cart['t__'] = ucfirst($cart['t_']); $cart['illegal'] = str_replace("\n",'<br />',$cart['illegal']); if(isset($_SESSION['_'.$cart['t_']])) { $cart['amount'] = $_SESSION['_'.$cart['t_']]; // if($cart['unit'] == '0.1g') $cart['amount'] *= 10; $cart['total'] = sprintf('%.2f',$cart['base']*$cart['amount']); $cart['price_table'] = explode(NL,$cart['prices']); #$cart['discount'] = $cart['total']-(CART::getPrice($cart['price_table'],$cart['amount'])/($tax_rate+1)); if(substr($cart['discount'],0,1) == '-') $cart['discount'] = substr($cart['discount'],1); if($cart['unit'] == '0.1g') $cart['amount'] /= 10; } $_cart[] = $cart; } $this->tpl->assign('cart',$_cart); $this->tpl->assign('items_in_cart',array_sum_key($_cart,'amount')); $this->tpl->assign('cart_total',sprintf('%.2f',array_sum_key($_cart,'total'))); $q = $db->query('SELECT * FROM '.PRFX.'promotion WHERE ip = "'.getClientIp().'" LIMIT 1'); if($q->rowCount() == 0) { $db->exec('INSERT INTO '.PRFX.'promotion (ip,time,u) VALUES ("'.getClientIp().'","'.date('m/d/Y h:i A',strtotime(date('m/d/Y h:i A').' + 2 hours 56 minutes')).'","'.$this->u['nick'].'")'); $this->tpl->assign('countdownTime',date('m/d/Y h:i A',strtotime(date('m/d/Y h:i A').' + 2 hours 56 minutes'))); } else { $countdownTime = $q->fetch(); $this->tpl->assign('countdownTime',$countdownTime['time']); } } function run() { global $db; $_ON_LOGGED = $db->query('SELECT COUNT(*) FROM `'.PRFX.'u` WHERE session >= '.(time()-300)); $this->tpl->assign('_ON_LOGGED',$_ON_LOGGED->rowCount()); if(!empty($this->u['id'])) $db->exec('UPDATE `'.PRFX.'u` SET session = "'.time().'" WHERE id = "'.$this->u['id'].'" LIMIT 1'); else $this->u['nick'] = ''; $db->exec('DELETE FROM `'.PRFX.'u_on` WHERE DATE_ADD(time,INTERVAL 3 HOUR) < NOW()'); $q = $db->query('SELECT u FROM `'.PRFX.'u_on` WHERE ip = "'.getClientIp().'" LIMIT 1'); if($q->rowCount() == 1) $db->exec('UPDATE `'.PRFX.'u_on` SET time = NOW(),u = "'.$this->u['nick'].'" WHERE ip = "'.getClientIp().'" LIMIT 1'); else $db->exec('INSERT INTO `'.PRFX.'u_on` VALUES ("'.getClientIp().'",NOW(),"'.$this->u['nick'].'")'); $rlt = $db->query('SELECT COUNT(ip) FROM `'.PRFX.'u_on`'); $this->tpl->assign('_ON',$rlt->rowCount()); /* if(!empty($this->u['id'])) { $q = q('SELECT COUNT(*) AS total FROM (SELECT * FROM '.PRFX.'messages WHERE _to = "'.$this->u['id'].'" AND `read` = "0" GROUP BY _from ORDER BY id DESC) x ORDER BY id DESC LIMIT 1'); $cnt = f($q); $this->tpl->assign('new_messages',$cnt['total']); $q = q('SELECT COUNT(*) as total FROM '.PRFX.'notifications WHERE u_to = "'.$this->u['id'].'" AND `read` = "0" LIMIT 1'); $cnt = f($q); $this->tpl->assign('new_notifs',$cnt['total']); }*/ if(empty($this->_k)) $this->_k = PG_KEYWORDS; if(empty($this->_d)) $this->_d = PG_DESCRIPTION; if(empty($_GET[0])) $t = PG_T_MAIN; else if(empty($this->_t)) $t = ucfirst(PG_T_MAIN); else $t = $this->_t; #.SEP.PG_T; $this->tpl->assign('_t',$t); $this->tpl->assign('_k',$this->_k); $this->tpl->assign('_d',$this->_d); $this->tpl->assign('_nav',$this->_nav); $this->tpl->assign('_c',$this->_c); $this->tpl->display(DIR_TPL.N.PG_TPLX.INX.HTML); } #### function mbl($st=true,$redir=true,$loc='') { #if($this->u['ban'] == 1) die('Account Blocked (BAN)'); foreach($_GET as $k => $v) $uri .= $v.'/'; if($_SERVER['REQUEST_URI'] <> '/login') { if(empty($loc)) $loc = substr(str_replace('|login|','',$uri),0,-1); if(!empty($this->u['id']) AND $_GET[0] == 'login') exit(header(LOC.URL)); if(!$st) { if($this->u['id']) if($redir) exit(header(LOC.URL.$loc)); else return false; } else { if(!$this->u['id']) if($redir) exit(header(LOC.URL.'login'.N.$loc)); else return false; } } } } if(empty($_GET[0]) OR substr($_GET[0],0,1) == '?') loadMod(PG_H_MOD); elseif(is_dir(DIR_MOD.$_GET[0])) loadMod($_GET[0]); else { loadMod(PG_H_MOD); // die(H.'no mod'); } $compressor->finish(); ?>
|