premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Javascript. <a href="javascript:history.go(-1);">Go Back!</a> With php you could use sessions but javascript mimics the browser back button.
-
If that was the case a fatal error would display, however he may have errors turned off, but yea. I do not know how he is really naming that file.
-
I would stray away from .inc and do .inc.php instead to hide your code. As far as why it does not work, no clue. Tested something similar on my system and it worked fine.
-
My bet is you are not re-querying the data before you run that if so you are using the old data.
-
lmao, whatever you say man. I do not know what I am doing and I obviously do not know how to read an error. Humor me and before you divide by zero echo out $banks and see what is printed out. EDIT: And for giggles I ran this just fine: <?php $totalb = 5; $banks = 2; $avgb=(int) ($totalb/$banks); echo "Avgb: " . $avgb; die(); ?>
-
Don't divide by zero. You can use an if to check if $banks is 0 if it is then do not divide by it. If you are getting an unexpected zero there I would check the logic where $banks is set.
-
Have a hidden link on your site that goes to the sitemap or somewhere on your site so only bots would pick it up. Give that a try and see what happens. Basically the link would bypass the validation and since a bot will see it they will crawl it, an since it is "hidden" the users will never see it and click on it and thus your disclaimer still stands etc. If you require a session string to view the site I would change that cause bots will not store session data due to lack of cookies.
-
cool, almost, htmlentities converts lots of the chars, but I get a: XML Parsing Error: undefined entity for £ simplexml is an extension of php 5 (I'm using php 5). However, this file will need to go on many other sites. So one, it not only needs to be simple (people arent going to like more than one file, I've never used extensions before in php, but assume it requires additional files), and two, there is no guarantee the other servers will be up to php5 Well you can always code for both. Do simplexml for those who have it/your script for those who do not. That way you are more functional =) I know it doesn't solve the problem, but yea. For the £ I am not sure, an easier method for your replacements instead of writing out all those lines you can have 2 arrays, make sure each index corresponds with each replacement and use that IE: $replace = array("&", "’"); $replaceWith = array("&", "'"); $isXML = str_replace($replace, $replaceWith, $isXML); That might be a bit easier to do than writing 200 lines of codes. However I think that you are going about this the wrong way, what is the right way, I have no clue. =)
-
Have a hidden link on your site that goes to the sitemap or somewhere on your site so only bots would pick it up.
-
<?php /* Program name: dateSelect.php * Description: Program displays a selection list that * customers can use to select a date. */ function echoList() { echo "<html> <head><title>Select a date</title></head> <body>"; $smonth = array(1=> "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); $today = time(); //stores today's date $f_today = date("M-d-Y",$today); //formats today's date echo "<div style = 'text-align: center'>\n"; /* create form containing date selection list */ echo "<form action='processform.php' method='POST'>\n"; /* build selection list for the month */ $todayMO = date("n",$today); //get the month from $today echo "<select name='dateMO'>\n"; for ($n=1;$n<=12;$n++) { echo "<option value=$n\n"; if ($todayMO == $n) { echo " selected"; } echo "> $smonth[$n]\n"; } echo "</select>"; /* build selection list for the day */ $todayDay= date("d",$today); //get the day from $today echo "<select name='dateDay'>\n"; for ($sday=1;$sday<=31;$sday++) { echo " <option value=$sday"; if ($todayDay == $sday ) { echo " selected"; } echo "> $sday\n"; } echo "</select>\n"; /* build selection list for the year */ $startYr = date("Y", $today); //get the year from $today echo "<select name='dateYr'>\n"; for ($syear=$startYr;$syear<=$startYr+1;$syear++) { echo " <option value=$syear"; if ($startYr == $syear ) { echo " selected"; } echo "> $syear\n"; } echo "</select>\n"; echo "</form>\n"; } echoList(); // usage. ?>
-
Try it without the ENT_QUOTES option. <?php $dbstring = "<div><font size="4">Brand New Item With Tags</font></div><div><font size="4"></font></div><div><font size="4">This item is a Brand New Abercrombie and Fitch Women's Yellow Hoody size Medium.</font></div><div><font size="4"></font></div><div><font size="4">Authentic vintage inspired sportswear and sexy effortless style combine to create a signture American brand with timeless appeal.</font></div><div><font size="4"></font></div><div><font size="4">Size diamentions are as follows: front underarm chest 48 cm, shoulder to waist 61cm, underarm to sleave 56cm</font></div><div><font size="4">This style is tight fitting so please pay close attention to the measurements for a good fit.</font></div><div><font size="4"></font></div><div><font size="4">Please feel free to ask any questions about this sweater.</font></div>"; $decodedwithHTML = html_entity_decode($dbstring); $completelydecoded = strip_tags($decodedwithHTML); echo $completelydecoded; die(); ?> I tested the above code and it worked for me. EDIT: It also works with the ENT_QUOTES on m system, just an FYI.
-
The [ code] and [ /code] tags are your friends, not enemy's.
-
It will not update the DB because of the error. As far as why it will not move, make sure the /1111A/doc directory is there and created. If not you need to create that directory for it to work.
-
I think that is probably about as good as it gets =)
-
This is what it said for just one query, and for not multiple: For that many rows with doing it multiple times, I would say you are sort of stuck up a tree. The query times will vary depending on how many ips the owner/project has. Limit it to a certain number, or cache the results and update it every x hours in the backend with CRON. Doubt it helps, but yea. EDIT: Thinking about it, why do multiple loops? Why not use the IN() keyword in mysql and pull it up where projects are IN that id? Or owners are IN that id then just use the loop and display all the projects for an owner? A single query would speed it up a ton. This is the cron, I am trying to speed up my cron Gotcha. You found the indexing feature, that was my next suggestion. Other than that I am not sure. You may try doing the date part with PHP, meaning instead of using DATE_SUB put the actual date in there you get from PHP. That way MySQL does not have to keep processing the DATE_SUB function...
-
Javascript is the only way I know how, since PHP is server side.
-
You have to set a timeout. If the user has not been active in x minutes set them as being logged out. That is the only "accurate" way to do this. If they browse another page, reset their DB status to online. EDIT: http://www.google.com/search?hl=en&q=users+online+script+php&btnG=Google+Search&aq=f&oq= Some scripts there should have examples of how to do this if you need one.
-
This is what it said for just one query, and for not multiple: For that many rows with doing it multiple times, I would say you are sort of stuck up a tree. The query times will vary depending on how many ips the owner/project has. Limit it to a certain number, or cache the results and update it every x hours in the backend with CRON. Doubt it helps, but yea. EDIT: Thinking about it, why do multiple loops? Why not use the IN() keyword in mysql and pull it up where projects are IN that id? Or owners are IN that id then just use the loop and display all the projects for an owner? A single query would speed it up a ton.
-
I think you are out of luck then. I do not know how you would stop that without being able to code for it. If you can detect the use of tamper, that would be one thing. But I do not think you can.
-
Your other option, and I am not sure how this works with flash as I never use flash, is to encrypt the scores with a key via the flash then on the php side decrypt them. That way they have to know what your key is to fake the scores. Like I said, I have no clue how this would work with flash, maybe you can find a flash/php encrypt/decrypt function?
-
One way is to not do count(*) instead do count(ip) it should speed up the SQL. Other than that, no clue. EDIT: Reason being is counting 1 column is more efficient then counting all columns. Depending how many columns you have that could really speed it up. Anyhow that is just better practice.
-
Yep that should do it.
-
Instead of die; you could just use break; $array=array('first','second','third','3423a','76676'); foreach($array as $arrays){ $result=strpos($arrays,'76'); if($result!==false){ echo 'found it<br />'; break; } } echo ' Break allows for more processing here.';
-
You would need to use the PHP CLI command for UNIX to accomplish that. Google PHP CLI CRON for examples. EDIT: For your script it would look like * 2 * * 0 /usr/bin/php -f /home/phpscripts/yourscript.php Given that php is installed to /usr/bin/
-
Well that may be, but I think you are saving the wrong file. The code I posted should not produce any notice errors. My 2cents, you are saving the wrong file. Here is the code I tested on my server, with no notice errors etc. <?php error_reporting(E_ALL); ini_set("display_errors", 1); if (!isset($_POST['submit']) || ($_POST['val1'] == "") || ($_POST['val2'] == "") || ($_POST['calc'] == "")) { header("Location: calculate_form.php"); exit; } if ($_POST['calc'] == "add") { $result = $_POST['val1'] + $_POST['val2']; $what = " plus "; } else if ($_POST['calc'] == "subtract") { $result = $_POST['val1'] - $_POST['val2']; $what = " minus "; } else if ($_POST['calc'] == "multiply") { $result = $_POST['val1'] * $_POST['val2']; $what = " times "; } else if ($_POST['calc'] == "divide") { $result = $_POST['val1'] / $_POST['val2']; $what = " divided by "; } echo 'My calculations returned: ' . $_POST['val1'] . $what . $_POST['val2'] . " = " . $result; ?> Which returned: My calculations returned: 2 plus 3 = 5