Jump to content

Mateobus

Members
  • Posts

    95
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Mateobus's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hello, I am having a very difficult time getting my errors to show on my page, particularly parse errors. I have a big script that has a parse error (i don't know where), and it would be much easier to test my script with error reports telling me what the problem is, but instead i just get a white page. I have played around with various settings, and I have had no luck. Here is a snippet of the script which is having problems. error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); ini_set('safe_mode', ''); Also, when I run phpinfo(), i get 6143 --not sure what that means. Thanks in advance
  2. yeah thats what i needed, thanks
  3. Hello I have a list of websites which i wish to "prefix", by truncating them at the third occurence of '/' (including the 2 for http://) so like: $str = 'http://www.google.com/analytics/blah/blah.html'; function truncate($str) { } echo truncate($str); //would print http://www.google.com thanks in advance. -Matt
  4. have you tried changing the last line to: return $for_name;
  5. Great, thanks for the help. I was wondering why you would not suggest saving the images first?
  6. Hey all, I am trying to implement a captcha on my website. Rather than creating the image on the fly, I would like to have a database of the captcha codes, and a thousand or so associated images. I was wondering if anyone knew how to save an image to a directory on the server, after it has been created with the imagecreatefrompng or imagecreatefromjpg function. Here is the code i found from a tutorial <?php /* Now for the GD stuff, for ease of use lets create the image from a background image. */ $captcha = imagecreatefrompng("./captcha.png"); /* Lets set the colours, the colour $line is used to generate lines. Using a blue misty colours. The colour codes are in RGB */ $black = imagecolorallocate($captcha, 0, 0, 0); $line = imagecolorallocate($captcha,233,239,239); /* Now to make it a little bit harder for any bots to break, assuming they can break it so far. Lets add some lines in (static lines) to attempt to make the bots life a little harder */ imageline($captcha,0,0,39,29,$line); imageline($captcha,40,0,64,29,$line); ?> so, i was planning on putting that in a loop and saving the images in a folder. Maybe not the most secure way, but its the most efficient. Does anyone know how to move that file to a non-temporary directory on the server?
  7. The error in the firefox console is: request.responseXML has no properties. This leads me to believe that my xml is not valid. I do know that the file is reaching the server though. Here is my code... var request = new XMLHttpRequest(); request.open("POST", "script.php", true); request.onreadystatechange = function() { if (request.readyState == 4) { if (request.status == 200) { document.getElementById('status').firstChild.data = request.responseXML.documentElement.getElementsByTagName("compname")[0].childNodes[0].nodeValue; }else { document.getElementById('status').firstChild.data ="The server was unable to process your request"; } } }; request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.setRequestHeader("Content-length", 17); request.setRequestHeader("Connection", "close"); request.send(qs); and the script.php file is just this: $RETURN_XML = "<?xml version='1.0' encoding='ISO-8859-1'?>"; $RETURN_XML .= "<company>"; $RETURN_XML .= "<compname>asdf</compname>"; $RETURN_XML .= "<contname>asfd</contname>"; $RETURN_XML .= "<address>asdf</address>"; $RETURN_XML .= "<city>asdfff</city>"; $RETURN_XML .= "<country>asdfff</country>"; $RETURN_XML .= "</company>"; echo $RETURN_XML; Any help is appreciated here...thanks a bunch.
  8. Hello, I have a sports website, and I would like to create a query that computes a team's record based on querying a table of games. The function will be given a team's id and year and will query the table which is set up as follow: homeid | awayid | home_score | away_score | year ----------------------------------------------------------- i can get the wins like such: select count(*) as wins from gamesm where (homeid='958' && home_score>away_score && year='2006') || (awayid='958' && away_score>home_score && year='2006') ideally i would do this as a single query. it is pretty important that this is efficient because it will get used a lot. But how would i do something like this (though i know its not right): select count(*) as wins from gamesm where (homeid='958' && home_score>away_score && year='2006') || (awayid='958' && away_score>home_score && year='2006'), count(*) as losses from gamesm where (homeid='958' && home_score<away_score && year='2006') || (awayid='958' && away_score<home_score && year='2006'), count(*) as ties from gamesm where (homeid='958' || awayid='958') && home_score=away_score I know that doesnt work, but is there a way of doing something like that. If not, I would probably need some sort of stored procedure, correct?
  9. is there a way to calculate the 3rd monday of september for a given year with php? Any help is appreciated.
  10. Very Tough Query Hey all I have a tough query here. Basically I am making a top 25 poll, and I am trying to use two tables. The first table is the votes table and is set up as follows: voterid | place | teamid The second table should contain the number of points for each team from the votes table as well as the number of first place votes. Points can be calculated by the equation 26-place. So a first place vote gets 25 points, 2nd 24... The second table is set up as follows teamid | points | first_place_votes The query should incorporate all of the votes from the first table into the second one. If anyone can help I would greatly appreciate it. I could use php to rig this up with arrays and such, but I would rather have it done more efficiently.
  11. I really appreciate your help, thanks a lot.
  12. Hello, I am trying to run kind of a tough query for me. Here is how my tables are set up: I have a table called games with an id, and then homeid, and awayid for the two teams. Then I have a table called team, with a column called teamid and name. I would like to run a query that returns the game id, home team name, and away team name of all the games for a given team with id=x. Any help is greatly appreciated thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.