play_
-
Posts
717 -
Joined
-
Last visited
-
Days Won
1
Posts posted by play_
-
-
many thanks
-
I also have a feeling that you capitalized the N on 'Name' on this line by accident:
$result = mysql_query('SELECT * FROM blogs WHERE [b]Name[/b]=sada');
i tend to do that alot.
maybe it's just 'name' ?
I also just noticed that you started a table inside the while loop.
[code]while($row = mysql_fetch_array($result))
{
echo '<table border=10 width=400 cellpadding=0 cellspacing=3>[/code]
but you close the table [i]after[/i] the while loop
[code] }
echo '</table>';[/code]
probably not what you want.
You are opening/starting a bunch of tables, and not closing them. -
I have an array and i`d like to make a dropdown from that array
[code]$pages = array("Home" => "home.html", "About" => "about.html", "Crew" => "crew.html");
$arraysize = count($pages);
for($i = 0; $i <= $arraysize; $i++) {
foreach($key as $value) {
echo '<option value="$key">$value</option>';
}
}[/code]
That's what i have, but it isn't working. any ideas?
-
Thanks guys.
Effigy, I would prefer not to turn off apache's indexing, because there might be folders I would want to allow indexing -
Thanks for the reply.
I did that, but now the main page does not get the image from the logo directory.
so www.example.com, the image won't show. -
Probably not the right forum, sorry.
Say i have this site:
http://example.com/
The main logo image, is located in http://example.com/images/logos/
Anyone using firefox can right-click the image and select 'view image', opening the image in the browser with the full url on the address bar, like so:
http://example.com/images/logos/someimage.jpg
so if the person deleted 'someimage.jpg' from the address bar, he will be in "http://example.com/images/logos/" viewing all of its contents.
How can i stop that? i set chmod to 711, but then index.php will give me this error:
[quote]Warning: opendir(./images/logos/): failed to open dir: Permission denied in /hsphere/local/home/me/example.com/includes/classes.php on line 13
Could not open directory for main image selection.[/quote]
classes.php is where i have the script to open and select a random image from the logos folder.
I would post my actually site here, but then people could navigate through my files, and i'd rather not let that happen.
I will gladly PM it if needed.
Thank you.
-
On top of a page, i have this:
<a href="#?page=home" onclick="getData('home.html', 'newseditor')">Home</a>
This will open the page "home.html" into a textarea so the client can edit it from his browser.
Then i have the form, followed by
[code]if(isset($_POST['submit'])) {
$editted = $_POST['page_to_edit'];
$fp = fopen($filename, "w") or die ("Could not open $filename. Make sure the file exists.");
fwrite($fp, $editted);
fclose($fp);
}[/code]
The problem is here:
$filename = $_GET['page'];
So when he clicks
<a href="#?page=home" onclick="getData('home.html', 'newseditor')">Home</a>
i need to get the variable 'home', but it won't do it.
So, how can i make php know which file is it going to write to?
Thank you. -
K.
the problem is this: /dev/
for the rest of this post, let's assume $str = '/dev/'
so i try replacing the / with --- for testing purposes.
it wont work still. before i even send $str to the database, i replace the / with --- and i still get errors.
[code]function escape_data($data) {
global $dbc;
$data = preg_replace('"/"', '----', $data);
if (ini_get('magic_quotes_gpc')) {
$data = stripslashes($data);
} return mysql_real_escape_string(trim($data), $dbc);
}[/code]
thats what i use to sanitize data. i put every input in the escape_data function you see above.
so if i submit /dev, it will show up as ---dev
if i submit dev/, it will show up as dev--
but if i submit /dev/ i get the internal server error. even though it changes / to --- before even putting it on the db -
On further testing, even if i just post:
/dev/input/event
i get the error. So, perhaps the server thinks i am trying to access that directory? -
I cannot figure out what is wrong.
Problem:
Made a typical blog entry thing. I type the message and submit.
However, when i enter this line:
[b]# /dev/input/event[/b] i get a 500 Internal Server error.
[b]"/dev/input/mice"[/b] also gives me the same error
but [b]"ZAxisMapping" "4 5"[/b] works. so it's not quotes. it's got something to do with the slashes, i would assume.
Another thing: it only happens on my rented server(redhat). on my localhost(windows), it works fine.
Here is the function i use to sanitize input data:
[code]//function for escaping and trimming data
function escape_data($data) {
global $dbc;
if (ini_get('magic_quotes_gpc')) {
$data = stripslashes($data);
} return mysql_real_escape_string(trim($data), $dbc);
}[/code]
Any thoughts?
Thanks :)
ps: just to kill the curiosity, those lines are in my xorg.conf file. i want to post my xorg.conf in my site in case i need it in the future. (but obviously can't post because i get that error) -
ahhh. thanks a bunch Obsidian
-
Thanks Obsidian.
I can't get it to work on my code though.
Here's a sample line:
[code]<</font><font color="#0000bb">f</font><font color="#007700">><br><</font><font color="#0000bb">f</font><font color="#007700">></font><font color="#ff8000">// news query | display the news>[/code]
The < and > actually got replaced by < and > (its from a highlight_string() function).
So if i used
[code]preg_match('|>l(.*)|<', $text, $match);[/code]
should do it right? because i can't get it to
-
Can it be done?
I plan on using preg_match_all with this.
now, i know that preg_match_all("\<.b>(.*)<\/b>/", $a, $e) will match everything between <.b> and </b> and insert it into the array.
I only need to get everything between the first > and last < on a line, considering there will be more of them in between. -
try this
if($sqlr2){
echo "success;
} else {
echo mysql_error();
} -
try replacing $_request['fid'] with $_GET['fid']
-
are you getting a mysql_error message?
-
[quote author=ShogunWarrior link=topic=100247.msg395679#msg395679 date=1152701299]
Congrats.
[/quote]
thank you.
who would've ever thought that the antivirus program would interfere with sessions. -
I know there is a sister site to this, ajaxfreaks.com, but that site is not as active as this one.
So, since we already have Javascript/HTML/CSS forums, why not add Ajax to php freaks too? Perhaps blend it with the Javascript forums, so it's Javascript/Ajax, CSS, HTML. -
Im back.
Chips, i am using localhost on windows. But i figured out the problems.
It was my antivirus/malware program. I guess it was stopping the sessions. I turned it off and now it works fine.
Thanks again all. -
I just uninstalled and reinstalled php/mysql on my pc and its giving me the same error still.
id upload it to my hosting server but its down right now -
Thanks.
Maybe there is a problem with the serve and sessions.
-
so is it fixed?
-
Ken,
that gave me this:
Array
(
)
also, im using PHP Version 4.3.10
-
wait hold on.
[code]
if($error == "0"){
echo "
The data you entered was valid<p>";
}else{
echo "Number of errors: $error "; //this is line 329
}
?>[/code]
Permission in windows servers
in PHP Coding Help
Posted
it's a windows server. so there is no chmod. anyone know a solution to this?