-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
PHP Asking to Download instead of Execute on 2 PHP Pages
MadTechie replied to hawnted's topic in PHP Coding Help
i mean, when it prompts you to download the files.. if you do download them (from that prompt) and then open the files in notepad (or textedit) does it still contain the code ? the file on the site will contain the code but does the download copy also contain it ? -
yep <?php $data = '<option value="Hello Boy">10 Minuten</option>'; if (preg_match('%<option value="(.*?)">10 Minuten</option>%', $data, $regs)) { $result = $regs[1]; } else { $result = ""; } echo "found: $result" ?>
-
PHP Asking to Download instead of Execute on 2 PHP Pages
MadTechie replied to hawnted's topic in PHP Coding Help
i assume the PHP file that downloaded is blank! (or atleast contains no php code) if not then thats a BIG issule.. MIME type should be (close to) application/x-httpd-php - php php3 php4 php5 php6 but that affects ALL php pages try creating a test page <?php phpinfo(); ?> -
Cookies are insecure, sessions would be better, also you should MD5 the passwords, you may not think its important but manu users use the same password and if a hacker get their password from your site.. you could get in trouble.. if you added an extra field in the users database table called "accesslevel" or something like that.. if its set to 1 then that top level and 5 could be normal user.. when they login it could store the accesslevel in a session and user that to check rights.. if you use cookies anyone could edit their cookie to be an admin.. (or change the userid to be you) hope that helps
-
PHP Asking to Download instead of Execute on 2 PHP Pages
MadTechie replied to hawnted's topic in PHP Coding Help
does it run okay without the .htaccess file ? EDIT: it maybe worth opening a ticket with hostgator as well, (cover both angles) -
to get the highesty score for all the games try this SELECT GameID, MAX(score) FROM scores GROUP BY GameID or for a single game SELECT GameID, MAX(score) FROM scores WHERE GameID=XX GROUP BY GameID XX = game ID ie EDIT: Crayon Violent beat me
-
PHP Asking to Download instead of Execute on 2 PHP Pages
MadTechie replied to hawnted's topic in PHP Coding Help
If theirs a delay before it starts the download, i would assume its timing out. i am not great at rewites but from a regex point of view this doesn't look right. rewriterule ^(.*)$ http://www.mysite.com/$1 [r=301,nc] ' -
WHERE GameID = 1
-
what your asking for is pretty basic MySQL, your need to add a field called GameID then update the statements to suite $gid = (int)$_GET['id']; mysql_query("INSERT INTO myscorev1 (name, score, GameID) VALUES('" . mysql_real_escape_string($_GET['name']) . "', '" . mysql_real_escape_string($_GET['score']) . "', $gid)") or die('Theres an error. Please try again.#'); $gid = (int)$_GET['id']; $result = mysql_query("SELECT * FROM myscorev1 WHERE GameID = $gid ORDER BY score DESC LIMIT 0, 10") or die('O no. Theres an error#'); etc
-
Default selected value in dropdown list through php
MadTechie replied to Darkmatter5's topic in PHP Coding Help
you would do it something like this echo "<select name='get'>"; $sel = ($_GET['get'] == $r1)?"Selected":""; echo "<option $sel value='$r1'>$r2</option>"; -
basically ^[^//.] means don't start with / or . so /test or ../test will not be used by the rewrite.. can you post some links that are NOT working anymore.. as the only things that should be affected are things that end with a / or .html, so hello/world.jpg would work fine.
-
Transfer ole type pictures from MsAccess to Mysql
MadTechie replied to godbout's topic in PHP Coding Help
This probably isn't going to be very helpful but.. I would create a little ASP code to convert the OLE back into Jpegs and using the RecordID as the name.. then upload via FTP and then create a little oneoff PHP script link them in heres some ASP code that will display the image, just add a write to binary section <% Dim adoCon Dim rs Dim strSQL Set adoCon = Server.CreateObject("ADODB.Connection") adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database/images.mdb") Set rs = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT ID,IMAGE FROM table WHERE ID = 1" rs.Open strSQL, adoCon Response.Clear Response.ContentType = "image/jpg" Response.BinaryWrite rs("IMAGE") rs.Close adoCon.Close Set rs = NothingadoCon.Close Set adoConn = Nothing %> -
you probably want to read up on MySQL (Joins are helpful) see here you could probably do it all in MySQL something like this. SELECT *, (T1.StipendAmount+T2.currentmoney) as TotalMoney FROM table2 T2 JOIN table1 T1 on table1.GroupName = table2.GroupName i hope that help but MySQL is a large subject EDIT: added the link
-
you may get away with something as simple as this change RewriteRule ^([^/]*)/$ /section/index.php?category=$1 [L] to RewriteRule ^([^//.]*)/$ /section/index.php?category=$1 [L]
-
heres a quick write up, untested but should work, <?php mysql_query("INSERT INTO example (name, score) VALUES('" . mysql_real_escape_string($_GET['name']) . "', '" . mysql_real_escape_string($_GET['score']) . "')") or die('Theres an error. Please try again.#'); mysql_query("SELECT count(name) as position FROM example WHERE score > ".mysql_real_escape_string($_GET['score'])) or die('Theres an error. Please try again.#'); $row = mysql_fetch_assoc($result); $position = $row['position']+1; echo "your Position was ".$row['position']."<br>"; ?>
-
<?php $d = 51; $total = 0; while ($d <= 60) { $costs2 =($d++ - 4 ); $costs1 = pow($costs2, 2.6); $coststr = (int) $costs1; $da = $coststr.",\n"; $dd = array($da); foreach ($dd as &$value) { $value = $value * 2; } echo $value."\n"; $total = $total + $value; } echo "total = $total\n"; ?>
-
can you post the rewrite
-
sounds like a encoding issule to me.. either way its not PHP its HTML/CSS
-
erm, you should escape all of them ie /t = tab $path = addslashes("C:\public_html\media\photos\thumbnails\\"); EDIT: Ahh unless you use single quotes, (missed that)
-
you can use str_replace, or addslashes, if you want to display an image you shouldn't be using / anyway (thats windows servers only) \ is unix and windows so echo "C:/public_html/media/photos/thumbnails/"; should work better what are you trying to do ?
-
the code you have removed the www., i am not 100% sure what your asking.. do you have an example of what you have and what you want it to appear like?
-
echo "C:\\public_html\\media\\photos\\thumbnails\\"; you could use addslashes
-
Add "\n". ie <?php $from='From: Surveryer' . $_POST["Survey Answers"]; $body=$_POST["1st_Q"] . "\n". $_POST["2nd_Q1"] ."\n". $_POST["2nd_Q2"] ."\n". $_POST["3rd_Q1"] ."\n". $_POST["3rd_Q2"] ."\n". $_POST["3rd_Q3"] ."\n". $_POST["3rd_Q4"] ."\n". $_POST["3rd_Q5"] ."\n". $_POST["3rd_Q6"] ."\n". $_POST["4th_Q"] . "\n". $_POST["5th_Q"] . "\n". $_POST["6th_Q"] ."\n". $_POST["6th_Q2"] ."\n". $_POST["7th_Q"] . "\n". $_POST["Email"]; $to="Client@mailaddress.com"; $subject="Client Survey"; if (mail($to,$subject,$body,$from)) { ?>
-
Its probably to do with indexing.. if you use a join on a field thats not indexed, mysql will need to index that field (this slows it down), if you index that field it should stop the overhead and speed up the searches,
-
you want to get a list or urls and only show the domain and sort by page rank.. yep thats possible