-
Posts
1,842 -
Joined
-
Last visited
Posts posted by marcus
-
-
Hey, if he chooses to use Dreamweaver, let him. jEdit isn't the best, PHP Designer, Notepad2, other good ones.
-
Deh, dark, you should help him out by stopping out a mysql injection.
$id = mysql_real_escape_string($_GET['category_id']); if($id){ if(ctype_digit($id)){ //if you don't have ctype extension on use intval $sql = "SELECT * FROM `table` WHERE `id`='$id'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "ID does not exist!\n"; }else { $sql2 = "UPDATE `table` SET `field`='new_row' WHERE `id`='$id'"; $res2 = mysql_query($sql2) or die(mysql_error()); echo "Updated"; } }else { echo "Invalid ID"; } }else { echo "ID not set"; }
-
$notes isn't defined.
I'm guessing you might want to add this somewheres:
$row = mysql_fetch_assoc($res); //assuming $res = query thorpe posted $notes = $row['notes'];
-
Just echo it out?
-
session_start(); //must be on every page you want the session to exist on $_SESSION['id'] = "define the session"; //run query
-
<?php $file = file_get_contents('lemonade_file.txt'); $omg_boom = explode("\n",$file); echo count($omg_boom); ?>
[tested:works]
-
i like lemonade
<?php $file = file_get_contents('lemonade_file.txt'); $omg_boom = explode("\n",$file); foreach($omg_boom AS $boom){ echo $boom . "<br />\n"; } ?>
[tested:works]
-
RewriteEngine On RewriteRule ^products-([^-]*)\.html$ /index.php?page=products&pid=$1 [L]
-
Try \n\r or \r\n
-
Try this:
RewriteRule ^product\-([^-]*)\.html index.php?page=products&pid=$1 [L]
-
Try this:
RewriteEngine On RewriteRule ^product-([^-]*).html$ products.php?id=$1 [L]
-
You could remotely connect to their FTP server and upload via that
-
If the country url variable has single quotes, use addslashes while echoing.
$country_url = "omg i'm cool"; # having that defined echo out the js. <a href="javascript:poptoggle('<?php echo addslashes($country_url); ?>')" class="citylist_country">
-
SELECT SUM(row) AS thesum FROM `table` WHERE `this`='that'
-
It could be based on your server speed.
-
Does it time out?
-
Is there a better way to do this? I like the idea of having a single plain text file containing all the redirections and calling it into a server-side page for processing.
File isn't going to write itself, eh?
-
400 lines is what? 1-3kb filesize? Should be no worry there.
-
They could end the script.
URL could be: file.php?inj="><h1>WTH</h1><br>DONTFAIL
Making the script read:
<form action="file.php"><h1>WTH</h1><br>DONTFAIL" method="post">
-
Then just remove line five or six and replace it with your own variable/error.
Using PHP_SELF can be a bad move since the user could implement his or her own code into the URL.
-
Just define the variables that correspond with your form field names.
$name = $_POST['form_field_name_one']; //etc....
To see if a value exists just implement the 5th and 6th of my example to fit your own.
If you have more than two just continue adding sets of line five and six to meet your requirements
-
$var = $_POST['variable']; $var2 = $_POST['variable2']; $errors = array(); if(!$var){ $errors[] = "Var one is missing!"; } if(!$var2){ $errors[] = "Var two is missing!"; } if(count($errors) > 0){ foreach($errors AS $error){ echo "<font color=\"red\">$error</font><br>\n"; } }else { echo "both variables are set, you're ready for take off!\n"; }
-
Directly from php.net
$a >> $b Shift right Shift the bits of $a $b steps to the right (each step means "divide by two")
-
That would be modrewrite.
.htaccess
RewriteEngine On RewriteRule ^outsourcing/index.php?sub_cat_id=94$ outsourcing/animation
suttin along those lines.
Help me with this project...
in PHP Coding Help
Posted
Heh, I used to use Dreamweaver back like a year ago when I had no idea how to use the functions, but I'm old school now and use normal Notepad.