laffin
Members-
Posts
1,200 -
Joined
-
Last visited
Everything posted by laffin
-
U can use cookies/sessions. but that will prolly complicate a lot of yer code.
-
I think thats his point. it's not taking the 2nd parameter. for me it worked fine using php5 and php4. <?php $url = "http://finance.yahoo.com/q/op?s=BJS&m=2008-05"; echo file_get_contents($url); ?> so sumfin else is going on with yer setup, or the coding u use to generate the url
-
converting an input amount to valid float for db update
laffin replied to coderb's topic in PHP Coding Help
prolly using str_replace wud be the easiest way about removing the commas -
Just think of how the system shud work for u. user1 writes a message -> user2 recieves a msg from user1 so for the basics u need from_id to_id msg_text now u want to add more features. like the date is was sent. than maybe the status of the msg (unread/read) so user can have a notice on the index instead of checking the inbox everytime. maybe a mass mail system, or mail to a group of users etc etc etc. Just begin with the basics, and work up and add on to it
-
[SOLVED] Converting static website to dynamic one
laffin replied to rkstevens's topic in PHP Coding Help
Look into php's pathinfo system. if apache has pathinfo enabled u can have a somewhat static url, when actually the url is a php script with parameters in the url without the parameted i.e: http://my.site.com/articles.php?id=5 with path info u can transform it into http://my.site.com/articles.php/5/ A popular system which uses this is cake php -
depends on how advance the pm box should be the db shud be something like id integer // msg id from_user integer // author id to_user intger // reciepient id sent timestamp // when it was sent status enum // (new,read) msg text // the msg itself than to check a users msg, check i the to_user field. u can check the to_user field with the status field to show if they have new msgs waiting in their inbox etc etc etc
-
taking GET POST directly will allow abuse for SQL Injection attacks. prolly the simplest form of validating the GET POST for the date is using preg_match, since the date is always in a specific pattern. $expiry_date=$_POST['expiry_date'][$row_value]; if(!preg_match('/^\d{4}-\d{2}-\d{2}$/',$expiry_date)) { // Does not match date format, fail processing header('Location: error.html'); exit; } // Everything ok, continue processing
-
why even use str_replace? $result2 =mysql_query("DELETE FROM stock_expdates WHERE expiry_date='$expdate'") or die ("Query: $result2 Error: ".mysql_error()); just add single quotes directly in the query string. u shud be careful with the $_POST vars, and validate the info.
-
Actually u did post the link to an example The comments provided by users provide examples for non-unique values (duplicated).
-
How do I escape quote marks stored in a variable ????
laffin replied to poleposters's topic in PHP Coding Help
mysql_real_escape_string if using mysql or maybe addslashes -
Thats the way id do it as well <?php // Code for Link tracking header("Location: http://www.external.link");
-
No, but this will function.create-function
-
either 1 rip out the code block, and re-insert at end of bbcode procedures. or convert a codeblock [ ] < > with their html entities conterpart
-
cuz the keys for ticked are not sequential. using foreach will solve yer problem. if (isset($_POST['ticked'])) { foreach ($_POST['ticked'] as $id) { echo "<br>drug id: "; echo $_POST[drug_id[$id]]; echo " branch id: "; echo $_POST[branch_id[$id]]; echo " exp: "; echo $_POST[drug_name[$id]]; }
-
Its cuz only checked boxes get sent. u didnt check 1, so boxes 2 & 3 got sent however all hidden fields get sent. so add keys to the indexes. $counter=0; while($row = mysql_fetch_array( $result2 )) { echo "<tr><td>"; echo "<input type='hidden' name=drug_id[$counter] value='$row[drug_id]'>"; . . echo "<input type=checkbox name=ticked[] value='$counter'>"; echo "</td></tr>"; $counter++; } now each array value in ticked returns an index value associated to the info
-
first portion i see a problem if(isset($_GET['returnto'])) { $returnto=gzinflate(urldecode($_GET['returnto'])); } else { $returnto='index.php'; } header('Location:'. $returnto); exit; The rest looks fine
-
Missing paren if(isset($_GET['returnto'])) { shude have 2 ending parens
-
on yer login form if a user is not logged in send a GET variable to the login form so a user can return to the url he was at. to save any url parameters, u may want to encode the uri line. thus not affecting the login parameters if any. if(!$loggedin) { $uri = urlencode(gzdeflate($_SERVER['REQUEST_URI'],9)); header("Location: http://www.mysite.com/login.php?returnto=$uri"); exit; } in the login processing script, check the returnto var if(isset($_GET['returnto']) $returnto=gzinflate(urldecode($_GET['returnto'])); else $returnto='index.php'; header('Location: $returnto"); exit; these are simple examples. u may want to add some checking to avoid the returnto from being abused from outside domains.
-
so do u want to sort all arrays or only specific ones? if u are sorting all arrays, u will be looking at a recursive sort routine (which checks for any arrays within the main array)
-
<td><IMG SRC='".$row['image']."'></td>
-
U will need Javascript as screen resolution, as screen resolution is not passed between browser and server. found this link that may help Getting Screen resolution using JavaScripts & PHP
-
array_sort($myarray[3])
-
Two different form action based upon a variable?
laffin replied to vozzek's topic in PHP Coding Help
if u want it to be on the form itself, u can look at javascript validation. but dun rely on it, meaning keep a php validator in place. -
<img src="imageresize.php?maxsize=xxx&source=images/Picture 043.jpg" border=0 />/[code] will not work, use urlencode, or remove/replace spaces in the name [/code]
-
make 2 tables the main table sumfin like TABLE id integer name varchar group integer and a groups table, sumfin like TABLE id integer lvl integer max integer now u can assign how many ppl shud go into a group with some php coding. it's not as u make it out, where u divide all the names into seperate dbs but u add more info to the db so u can seperate different records.