PHP - Trouble With Cronjob
Don't have a huge deal of experience with this side of things, well php as a whole really but really struggle with this side, ive coded up a cron but it only works for 1 user, unsure as to why, i want it to do the action for every player that has item 17, the codes below any help would be appreciated, Thanks guys
Code: [Select] <?php include("server.php"); $sql = "SELECT * FROM player_inventory WHERE item_id = 17"; $que = mysql_query($sql) or die(mysql_error()); $res = mysql_fetch_array($que); $sql2 = "SELECT * FROM players WHERE id = $res[player_id]"; $que2 = mysql_query($sql2); while($res2=mysql_fetch_array($que2)) { $Weight = 8 / 100 * (100 + $res2['ProductionWeight']); $Quality = 75 / 100 * (100 + $res2['ProductionWeight']); $StreetCred = $Weight * $Quality / 10; $update = "UPDATE players SET StreetCred = StreetCred + $StreetCred WHERE id = $res[player_id]"; mysql_query($update) or die(mysql_error());; $update2 = "INSERT INTO drug_inventory (player_id,quality,weight) VALUES('$res[player_id]',$Quality,$Weight)"; mysql_query($update2) or die(mysql_error());; echo "Grow Completed."; } ?> Similar TutorialsHi, cd /var/www/html/googleplaystore-root-folder && php artisan schedule:run >> /dev/null 2>&1 This is the code developer gave me to add to the cronjob. and the location of my script is /home/vvkpexpj/public_html/example.com
Do i need to make any changes to the cronjob code he given.? i had copy pasted the code same as what he gave, but its not working Ok, So I have a php script which I want to call using a cron job... It all works correctally when I call it from a browser, and I have updated the local paths to include the full url. All the local side of things works correctally/ fine. The issue is that during part of the script I am pulling an image from an external source (specifically Apple). I'm then using ImageMagik to convert it to a png and save the file locally. Again this all works outside of using a cron job, but dosen't when I am using a cron job... It's either an issue with the fact I'm using an external link, or an issue with utilizing ImageMagik... If it's a ImageMagik issue then I'll ask on their forums - but I first wanted to check there shouldn't be any issues with using external links in a php triggered by cron? Like it dosent try find the file at /usr/www/users/<external link here> or anything dumb like that? Cheers, - Adam G Hi there,
I want to make script which will execute via crontab every Sunday at 0:01h and will stop at 23:59h. My goal is to put(show) some tekst on the site. The problem is how to put this tekst in the site? I mean I know how to configure Cron Jobs but how to include the tekst in index.php for example?
crontab will be.
1 0 * * 0 /usr/bin/php Start.php 59 23 * * 0 /usr/bin/php Stop.php Hi, I am using cpanel, where i am want to run a php file, to delete the old records, i used cronjob in cpanel to do this. In time columns i have made : * * * * * to execute each and every minute the script.. In the command textbox i have made: /home/server25/public_html/auto_cancel.php in the email box: admin_email@gmail.com I am getting Permission denied to my email address: The error report am getting is : /bin/sh: /home/server25/public_html/auto_cancel.php: Permission denied Please help me to solve this. Thanks, I have a script that fetch emails and its work file when I call it through SSH with PHP at the beginning on the path when I added a cronjob it was working fine too... the problem start when I disable the cronjob email response, the script dose not functioning with Imap What can I do in order to bypass this problem, I will try to call it with include but I have no other options.. Please help My host has a limit of 100 emails per hour and this is now being reached to many times a day and some emails are not being sent due to this. Does anyone have a script or know of one that can stack emails to be sent in MySql or something and every 5 minutes send one out from the stack and then delete from the stack the ones sent. Building a website for work. I am struggling with the login for some reason. I`m using a lot of the same code as I did for my personal site and a few other websites I`ve programmed which has always worked. But for some reason, it isn`t working now. I`ve already told it to display to me the information that`s being processed and that is all correct (it even updates the database like it`s supposed to). It just won`t show the person being logged in, which defeats the purpose of logging in, yanno? Here are all the files in question. login.php <?php include "file_calls.php"; $title = "Business Name (Beta): Log In"; include "functions.php"; session_start(); echo "$title"; echo "<p>"; echo "Log into the Business Name website. Only authorized members of the Business Name Staff can log into the website."; echo "<p>"; include "login_form.php"; ?> login_form.php <?php echo "<form action='logging.php' method='post'>"; echo "E-Mail Address:"; echo "<br><input type='text' name='email' size=60 maxlength=100>"; echo "<p>"; echo "Password:"; echo "<br><input type='password' name='pass' size=60 maxlength=25>"; echo "<p>"; $buttonlabel = "Log In"; include "formbutton_format.php"; echo "</form>"; ?> logging.php <?php include "file_calls.php"; $title = "Business Name (Beta): Logging In"; include "functions.php"; session_start(); echo "$title"; echo "<p>"; echo "Logging into the Business Name website. Only authorized members of the Business Name Staff can log into the website."; echo "<p>"; $email = $_POST['email']; $pass = $_POST['pass']; $entry_date = strftime("%B\ %e\,\ %Y %I:%M:%S %p", time()); $res = mysql_query("SELECT id, memlev, pwd1, pwd2, email, name FROM user_data WHERE email='$email'"); $by = mysql_fetch_row($res); mysql_free_result($res); $log = $by[4]; $pas = $by[2]; $pas2 = $by[3]; if ($email && $pass) { if ($by[0]) { if ($by[1] == 2) { $passwd = crypt($_REQUEST['pass'],$by[5]); if ($pass == $pas2) { mysql_query("UPDATE user_data SET lastlogin='$entry_date' WHERE email='$email'"); mysql_close($con); header("Location: index.php"); } elseif ($passwd != $pas) { header("Location: nolog.php?logout=1&m=4"); } } elseif ($by[1] == 1) { header("Location: nolog.php?logout=1&m=2"); } elseif ($by[1] == 0) { header("Location: nolog.php?logout=1&m=3"); } } elseif (!$by[0]) { header("Location: nolog.php?logout=1&m=1"); } } elseif (!$email || !$pass) { echo "<b>Error:</b> Both username and password must be entered in order to log in."; echo "<p>"; include "login_form.php"; } ?>[/php index.php [php]<?php include "file_calls.php"; $title = "Business Name (Beta)"; include "functions.php"; session_start(); echo "$title"; echo "<p>"; echo "This website is currently under construction. Thank you for your patience."; echo "<p>"; if ($lev > 1) { echo "Hello, $loggeduser !"; } elseif ($lev < 2) { echo "Not logged in."; } echo "<p>"; echo "$lev"; echo "<br>$loggeduser<br>$email"; ?> auth.php <?php // Defines DEFINE('SESSION_MAGIC','sadhjasklsad2342'); // Initialization @session_start(); @ob_start(); /* Redirects to another page */ function Redirect($to) { @session_write_close(); @ob_end_clean(); @header("Location: $to"); } /* Deletes existing session */ function RemoveSession() { $_SESSION = array(); if (isset($_COOKIE[session_name()])) { @setcookie(session_name(), '', time()+(60*60*24*365), '/'); } } /* Checks if user is logged in */ function isLoggedIn() { return(isset($_SESSION['magic']) && ($_SESSION['magic']==SESSION_MAGIC)); } /* read message count */ function CountMessages($id) { if ($res=mysql_query("SELECT * FROM user_data WHERE email='$email'")) { $count=mysql_num_rows($res); mysql_free_result($res); return($count); } return 0; } /* Go login go! */ function Login($email,$pass) { global $nmsg, $rows; $ok=false; if ($res=mysql_query("SELECT id, email, name, pwd1, pwd2, memlev FROM user_data WHERE email='$email' AND pwd2='$pass'")) { if ($rows=mysql_fetch_row($res)) { $_SESSION['sess_name'] = $rows[2]; $_SESSION['pass'] = $pass; $_SESSION['gal'] = $rows[0]; $_SESSION['level2'] = $rows[5]; $_SESSION['email'] = $rows[1]; $_SESSION['magic'] = SESSION_MAGIC; $nmsg = CountMessages($rows[0]); $ok=true; } else { include('login_failed.php'); } mysql_free_result($res); } return($ok); } /* Terminates an existing session */ function Logout() { @RemoveSession(); @session_destroy(); } /* Escape array using mysql */ function Escape(&$arr) { if (Count($arr)>0) { foreach($arr as $k => $v) { if (is_array($v)) { Escape($arr[$k]); } else { if (function_exists('get_magic_quotes')) { if(!get_magic_quotes_gpc()) { $arr[$k] = stripslashes($v); } } $arr[$k] = mysql_real_escape_string($v); } } } } // ----------------------------------------------- // Main // ----------------------------------------------- Escape($_POST); Escape($_GET); Escape($_COOKIE); Escape($_REQUEST); Escape($_GLOBALS); Escape($_SERVER); ?> file_calls.php <?php include "info_con.php"; include "auth.php"; ?> functions.php <?php echo "<title>$title</title>"; $lev=isset($_SESSION['level2'])?$_SESSION['level2']:0; $logged=isset($_SESSION['gal'])?$_SESSION['gal']:0; $loggeduser=$_SESSION['sess_name']; $nmsg = 0; $rows = isset($_SESSION['rows'])?$_SESSION['rows']:array(); $email = isset($_SESSION['email'])?$_SESSION['email']:''; $pass = isset($_SESSION['pass'])?$_SESSION['pass']:''; function rand_chars($c, $l, $u = FALSE) { if (!$u) for ($s = '', $i = 0, $z = strlen($c)-1; $i < $l; $x = rand(0,$z), $s .= $c{$x}, $i++); else for ($i = 0, $z = strlen($c)-1, $s = $c{rand(0,$z)}, $i = 1; $i != $l; $x = rand(0,$z), $s .= $c{$x}, $s = ($s{$i} == $s{$i-1} ? substr($s,0,-1) : $s), $i=strlen($s)); return $s; } function ShowLoggedInBar() { global $email,$pass,$rows,$logid; $nmes=""; if($nmsg){ $nmes="($nmsg New)"; } echo "Hello, $loggeduser !"; } /* check if we are logging out */ if (isset($_REQUEST['logout'])) { Logout(); } /* check if already logged in */ if (isset($_SESSION['magic']) && ($_SESSION['magic']==SESSION_MAGIC)) { ShowLoggedInBar(); } else { /* not logged in, is it a form post? */ if (isset($_REQUEST['email']) && isset($_REQUEST['pass'])) { $email = $_REQUEST['email']; $pass = crypt($_REQUEST['pass'],$email); Login($email,$pass); } else { } } ?> Can anyone see why it works on everything but getting the person logged in? Hello everyone, I am new to this forum and PHP world. Doing my first project, a pretty complicated one to start with. I will be needing your help a lot to accomplish it. Here is the first one. 1. I have a certain field called 'country' 2. I have small flag icons for every country. WHAT DO I WANT TO DO? Example - If the country is U.S.A., the U.S. flag shows up and is a link to www.domain.com/usa If the country is Germany, the German flags shows up and is a link to www.domain.com/germany If the country is not set, no flag shows up. END. How do I execute this? This is what I am doing to get the image <img src="images/flags/<?php echo $row_rsPilots['country']; ?>.gif" alt="" name="Flag" width="20" height="20" id="Flag" /> How do make it a link to www.domain.com/'country' Thanks in advance Hi Chaps, I have a PHP FTP App, where users can log in using a unique code and a password. Their unique code corresponds to an FTP folder, e.g. Quote \FTP_Root\Customer A & Co\ So when the user logs in, they can see their FTP directory and contents, in this case an Inbox and an Outbox. This works as the FTP folder contains both an Inbox and an Outbox. The problem I am having is when I try browsing within this directory (say the Inbox), ftp-chdir fails. I have a hyperlink that sends a 'dir' parameter to the same ftp.php page, and if set, will attempt to change to the given directory. So even though the URL Hyperlink reads: Quote ....server.co.uk/ftp.php?dir=/FTP_Root/Customer A & Co/Inbox When you click on this link, the page tries to load: Quote ....server.co.uk/ftp.php?dir=/FTP_Root/Customer A So my question is what do I need to change, the Hyperlink to read something like: Quote ....server.co.uk/ftp.php?dir=/FTP_Root/Customer%20A%20&%20Co/Inbox Do something to the ftp-chdir function, where I encode/decode/whatever to make sure it tries to change to the correct FTP directory? Or exclude all ampersand entirely? what am i doing wrong? my watermark function won't work but i am calling the function right i think. if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { watermark($file_path,$watermark,'png'); mysql_query("INSERT INTO gallery VALUES ('', '$username', '$time', '$caption' , '$file_path' )"); //echo $file_size.' is how big your file is. It was transferred.'; header('Location: gallery.php'); } in my login script i have the following which searches for the username they inputted and then adds their user id to the table sessions in the database. $result = mysql_query("SELECT * FROM ".DB_PREFIX."members WHERE user_username = '$username' AND user_password = '$password'"); if(mysql_num_rows($result) != 1) { $val_error = 'Username and Password incorrect.'; } else { $row = mysql_fetch_array($result); $browser = $_SERVER['HTTP_USER_AGENT']; $_SESSION['user_id'] = $row['user_id']; $_SESSION['session'] = session_id(); mysql_query("INSERT INTO ".DB_PREFIX."sessions VALUES(NULL, '".$_SESSION['user_id']."', '".$_SESSION['session']."', '".$_SERVER['REMOTE_ADDR']."', '".$_SERVER['HTTP_USER_AGENT']."', '".date('Y-m-d')."')"); if ($_SESSION['backpage']) { header('Location: '.$_SESSION['backpage']); } else { header('Location: index.php'); } } then on pages which i want only logged in members to access i have the following: if ($_SESSION['user_id'] == '') { header ('Location: '.SITE_ROOT.'/login.php'); } else { REST OF CODE } but when i login and try to access a page which requires you to be logged in i am directed back to index.php. I have nothing which does that. if you are not logged in you are redirected to login.php but it doesnt seem to work. Any ideas? could someone help me with this. here is what I have: <?php require_once('dbinfo.php'); ?> <?php mysql_connect($dbaddress,$username,$password); mysql_select_db($db) or die("Cannot find database!"); /* $query = "SELECT * FROM contacts"; $result = mysql_query($query); $numRows = mysql_numrows($result); $i = 0; while ($i < $numRows) { echo mysql_result($result, $i, "first") . " " . mysql_result($result, $i, "last"); $i++; } */ $fname = 'WrdScramble()'; $ftype = 'DAO'; $fdesc = 'Randomly rearranges the characters in a string or word.'; $fcode = ''; $query = "INSERT INTO functions VALUES ('','$fname','$fcode','$ftype','$fdesc')"; mysql_query($query); print($query); //$query = "SELECT fcode FROM contacts WHERE first = 'code'"; //$result = mysql_query($query); //$numRows = mysql_numrows($result); //$fcode = mysql_result($result, 0, "fcode"); ?> <? //close connection mysql_close(); ?> It is not inserting the data into the database, and if I use: mysql_error() and print it out, I get nothing with that either. I am not sure where to go! I also have used this: (fid, fname, fcode, ftype, fdesc) preceeding the 'VALUES' word in the statement just to see if it would take. No luck! Do I not see the obvious? Any help appreciated! thanks! (I have checked my field types and max length in PHPmyadmin and they are not an issue.) Hi guys! I'm trying to parse an RSS feed using SimpleXML, but I'm having trouble lol Here's my code: $feed = file_get_contents("http://engadget.com/rss.xml"); $xml = new SimpleXMLElement($feed); echo $xml->rss->channel->item[0]->title; I'm expecting it to echo the title of the first item in the RSS feed, but when I run it, I just see a blank page. Tell me what I'm doing wrong! Why am i Getting this? Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent in ..... Code: [Select] <?php if(isset ($_POST['email'])){ //Start session session_start(); require_once "scripts/mysqlconnect.php"; $remember = $_POST['remember']; // Added for the remember me feature // Make the posted variable SQL safe $email = eregi_replace("`", "", mysql_real_escape_string(strip_tags($_POST['email']))); $password = md5(eregi_replace("`", "", mysql_real_escape_string(strip_tags($_POST['password'])))); // Create query. !! You need to rename your 'username' column in your database to 'email' !! $qry = "SELECT * FROM members WHERE email='$email' AND password='$password' AND email_activated='1'"; // Run query $result=mysql_query($qry); //Check whether the query was successful or not if($result) { // If one row was returned (if there was a match) if(mysql_num_rows($result) == 1) { // Login Successful // Get a new session ID session_regenerate_id(); // Get the row as an array $member = mysql_fetch_assoc($result); // Create session variables $_SESSION['LOGINID'] = $member['loginid']; $_SESSION['EMAIL'] = $member['email']; $_SESSION['USERNAME'] = $member['username']; // Stop writing to the session session_write_close(); // Create a variable for the member ID, you can't include $member['id'] in the SQL statement $id = $member['loginid']; // Update the table with the current time mysql_query("UPDATE members SET last_log_date=NOW() WHERE loginid='$id'"); // Remember Me Section Addition... if member has chosen to be remembered in the system if($remember == "yes") { setcookie("idCookie", $id, time()+60*24*60*60, "/"); setcookie("usernameCookie", $username, time()+60*24*60*60, "/"); setcookie("emailCookie", $email, time()+60*24*60*60, "/"); setcookie("passwordCookie", $password, time()+60*24*60*60, "/"); } // Redirect to the members only page //header("location: ".$_SERVER['PHP_SELF'].""); /* Quick self-redirect to avoid resending data on refresh */ echo "<meta http-equiv=\"Refresh\" content=\"0;url=$HTTP_SERVER_VARS[PHP_SELF]\">"; return; exit(); } } else { die("Query failed"); } } ?> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; color: #0F0; } #apDiv1 { position:relative; width:241px; height:0px; z-index:1; left: -270px; top: 0px; } --> </style><div align="center"> <div id="apDiv1"> <form action="" method="post"> <p>Email <input type="text" name="email" id="email" size="15" /> </p> <p>Password <input type="password" name="password" id="password" size="15"/> </p> <p> Remember <input type="checkbox" name="Remember" id="Remember" /><input name="Submit" type="submit" value="Login"/> </p> </form> </div> <img src="/images/header.jpg" width="950" height="100" /> </div> I have a form that I want the data to e-mail in a message. Everything works except for the checkbox arrays. "Array" displays when I want all values of checked boxes to display. Here is the code, I have bolded where checkbox data should be coming over. I'm not a pro so any help is greatly appreciated. Code: [Select] $message = "<html><body>\r\n"; $message .= "<table width='500' border='0' cellpadding='2'>\r\n"; $message .= " <tr>\r\n"; $message .= " <td width='150'>School</td>\r\n"; $message .= " <td width='350'>" . $_POST['school'] . " </td>\r\n"; $message .= " </tr>\r\n"; $message .= " <tr>\r\n"; $message .= " <td width='150'>Teacher</td>\r\n"; $message .= " <td width='350'>" . $_POST['teacher'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <tr>\r\n"; $message .= " <td width='150'>Subject</td>\r\n"; $message .= " <td width='150'>" . $_POST['subject'] . "</td>\r\n"; $message .= " <td width='150'>Period</td>\r\n"; $message .= " <<td width='50'>" . $_POST['period'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Date</td>\r\n"; $message .= " <td width='50'>" . $_POST['month'] . "</td>\r\n"; $message .= " <td width='15'>" . $_POST['day'] . "</td>\r\n"; $message .= " <td width='15'>" . $_POST['year'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Time In:</td>\r\n"; $message .= " <td width='100'>" . $_POST['timeIn'] . "</td>\r\n"; $message .= " <td width='150'>Time Out:</td>\r\n"; $message .= " <td width='100'>" . $_POST['timeOut'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Teacher Location Upon Entrance</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q6_1Teacher6'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q7_comments7'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Student Engagement</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q11_2Student'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Students Engaged/Total Students</td>\r\n"; $message .= " <td width='350'>" . $_POST['q12_studentsEngagedtotal'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q15_comments15'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Teaching Alignment</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q17_3Teaching17'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q18_comments18'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Identified Learning</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q13_4Identified'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q16_comments16'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Rigor Rate</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q20_5Rigor'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q21_comments21'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Assessment Practice</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q22_6Assessment'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q27_comments27'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Instructional Practice</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q24_studentDirected'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q23_comments23'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Learning Environment</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q28_8Learning'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q29_comments29'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= "</table>\r\n"; $message .= "</body></html>"; Hi all, the last 15 minutes i wasted my time pulling my hair while looking at my php code. Of course I used mysqli_error() & mysqli_errno() to find out what was happening. I got something like this: Quote warning: mysqli_error() expects exactly 1 parameter, 0 given in /wicked/fatmonkeyseatbananas/zoo/index.php on line 12 That didnt really help me. I also echoed out my query. Until I thought let's double check the field names I have in the database. They were also correct. And that's when I found out that it was in fact the property of a my ID field. It was set as primary key, but not set to auto increment. Apparently each time a new row was inserted there was a conflict since the next row also had an id of 0. After I add auto increment it was all fixed. So if anyone ever has this problem, hope this helps now it's time for a beer btw. if anyone has a faster way of solving problems like this I love to hear it. I am trying to put the tree of an XML file into an array. sample.xml Code: [Select] <?xml version='1.0' encoding='UTF-8'?> <getHistogramsResponse xmlns="http://www.ebay.com/marketplace/search/v1/services"> <ack>Success</ack> <version>1.7.0</version> <timestamp>2010-09-01T12:13:31.480Z</timestamp> <aspectHistogramContainer> <domainName>UK_CamerasPhoto_DigitalCameras_DigitalCameras_JN</domainName> <domainDisplayName>Digital Cameras</domainDisplayName> <aspect name="Brand"> <valueHistogram valueName="Canon"> <count>4323</count> </valueHistogram> <valueHistogram valueName="Sony"> <count>2210</count> </valueHistogram> </aspect> </aspectHistogramContainer> </getHistogramsResponse> $this->cXmlToArray->m_arr = GetXMLTree('sample.xml') if (isset($this->cXmlToArray->m_arr['getHistogramsResponse']['aspectHistogramContainer'][0])) { $this->m_arrResult = $this->cXmlToArray->m_arr['getHistogramsResponse']['aspectHistogramContainer']; } else if (count($this->cXmlToArray->m_arr['getHistogramsResponse']['aspectHistogramContainer']) > 0) { $this->m_arrResult[] = $this->cXmlToArray->m_arr['getHistogramsResponse']['aspectHistogramContainer']; } However my output is showing as: Array ( [0] => Array ( [domainName] => UK_CamerasPhoto_DigitalCameras_DigitalCameras_JN [domainDisplayName] => Digital Cameras [aspect] => Array ( [0] => Array ( [valueHistogram] => Array ( [0] => Array ( [count] => 4311 ) [1] => Array ( [count] => 2209 ) ) ) ) So how do I get it to return the attributes name and valueName? Any help will be greatly appreciated. i am not a coder by any means and my boss threw me under the bus to add an auto reply to this form. I've figured out that this is the code that the form uses to process - but now i have NO IDEA what to do. Can ANYONE help me with this? it's supposed to have instructions in the response and send a copy to us and the the submitter. THANKS SO MUCH IN ADVANCE!!! Here's the php form code: Code: [Select] <?php $EmailFrom = "Win One"; $EmailTo = "sales@capsonewire.com"; $Subject = "Registration"; $Name = Trim(stripslashes($_POST['Name'])); $Tel = Trim(stripslashes($_POST['Tel'])); $Email = Trim(stripslashes($_POST['Email'])); $Phone = Trim(stripslashes($_POST['Phone'])); $Message = Trim(stripslashes($_POST['Message'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Phone: "; $Body .= $Phone; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> hi, i am pulling data from a database, a picture and some text, i am able to have the records display vertically but i want them to display across the screen rather than downwards, but because of the page size, i only want 2 results per line. does any one know how i can do this? thanks in advance. Des This is the code i am currently using $result = mysql_query("select * from staff'"); echo "<table border='0' cellpadding='10' cellspacing='0'>"; echo "<tr>"; while($row = mysql_fetch_array($result)) { echo "<td><img src=../upload/".$row['Pic']." border='0' width='140' height='105' /></td>"; echo "<td>".$row['Name']."</br><b>".$row['Role']."</b></td>"; } echo "</tr>"; echo "</table>"; Hi Chaps, I've created a web-based FTP site, but having trouble with PHP's FTP_PUT function. I've tried: // FTP access parameters $host = 'ftp.example.org'; $usr = 'example_user'; $pwd = 'example_password'; // file to move: $local_file = './example.zip'; $ftp_path = '/data/example.zip'; // connect to FTP server (port 21) $conn_id = ftp_connect($host, 21) or die ("Cannot connect to host"); // send access parameters ftp_login($conn_id, $usr, $pwd) or die("Cannot login"); // turn on passive mode transfers (some servers need this) // ftp_pasv ($conn_id, true); // perform file upload $upload = ftp_put($conn_id, $ftp_path, $local_file, FTP_BINARY); // check upload status: print (!$upload) ? 'Cannot upload' : 'Upload complete'; print "\n"; // close the FTP stream ftp_close($conn_id); And also Net_FTP's FTP_PUT function: require_once 'Net/FTP.php'; $test = new Net_FTP('www.domain.co.uk', 21); $test->connect('www.domain.co.uk', 21); $test->login('username', 'password'); $file_tmp = $_FILES["file"]["tmp_name"]; $file_name = $_FILES["file"]["name"]; $test->put($file_tmp, 'Uploads/'.$file_name, FTP_BINARY); I've tested this with a very small text file and it works OK, but when I try with a zip file of around 9Mb it takes FOREVER, and sometimes doesn't upload at all, or if it does, it has a size of 0kb. I need the script to handle big files up to 150Mb in size. What can I do to speed up the process and is there something I have missed (current config settings > ini_set('max_upload_filesize', 150000000)) ? |