Stephen
Members-
Posts
200 -
Joined
-
Last visited
Never
Everything posted by Stephen
-
You could use: include($_SERVER["DOCUMENT_ROOT"]."/index.php"); This will go to the root of the folder. Example 2 include($_SERVER["DOCUMENT_ROOT"]."/includes/header.php");
-
Did you try it? It should work. You might also want to round it to the nearest hundredth.
-
[SOLVED] Why is everything being posted twice!?
Stephen replied to spiceydog's topic in PHP Coding Help
Try doing: <?php $mid = $_GET['mid']; include 'login.php'; if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM accounts WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { header("Location: nosession.php"); } else { ?> <?php $queryreply = "SELECT * FROM inbox WHERE mid = '$mid' ORDER BY reply" or die(mysql_error()); $resultreply = mysql_query($queryreply) or die("Couldn't execute query because: ".mysql_error()); while($rowreply = mysql_fetch_array($resultreply)) { $reply = $rowreply['reply']; $query = "SELECT * FROM inbox WHERE mid = '$mid' AND reply = '0'" or die(mysql_error()); $result = mysql_query($query) or die("Couldn't execute query because: ".mysql_error()); while($row = mysql_fetch_array($result)){ $subject = $row['subject']; $from = $row['fromwho']; $to = $row['towho']; $date = $row['date']; $id = $row['id']; $message = $row['message']; { ?> <?php if(isset($_POST['submit'])) { $username = $_COOKIE['ID_my_site']; $ipmessage = $_SERVER['REMOTE_ADDR']; $datemessage = date('m/d/y'); $postmessage = mysql_real_escape_string(trim($_POST['message'])); $bad = array("<", ">", "="); $bitch = array("FUCK YOU", "FUCK YOU", "FUCK YOU"); date_default_timezone_set('EST'); $message = str_replace($bad, $bitch, $postmessage); if ($comment == ''){ echo "<script language='JavaScript' type='text/javascript'>alert('You cant send an empty message.'); location = 'message.php?mid=$mid';</script>"; exit; } if ($from == $username) { $querycomment = "INSERT INTO inbox (towho, fromwho, date, message, subject, reply, mid, ip) VALUES ('$to', '$username', '$datemessage', '$message', '$subject', '$reply'+1, '$mid', '$ipmessage')"; mysql_query($querycomment) or die(mysql_error()); header("Location: message.php?mid=$mid"); } else if ($to == $username) { $querycomment = "INSERT INTO inbox (towho, fromwho, date, message, subject, reply, mid, ip) VALUES ('$from', '$username', '$datemessage', '$message', '$subject', '$reply'+1, '$mid', '$ipmessage')"; mysql_query($querycomment) or die(mysql_error()); header("Location: message.php?mid=$mid"); } } ?> <?php if (($from == $username) || ($to == $username)) { ?> From: <?php print "$from"; ?><br /> Sent: <?php print "$date"; ?><br /> Subject: <?php print "$subject"; ?><br /><br /><br /> <?php if ($from == $username) { echo "You messaged $to:<br />"; } else { echo "$from messaged you:<br />"; } ?> <?php print "$message"; ?> <br /><br /> <?php $query = "SELECT * FROM inbox WHERE reply != '0' AND mid = '$mid' ORDER BY reply" or die(mysql_error()); $result = mysql_query($query) or die("Couldn't execute query because: ".mysql_error()); while($row2 = mysql_fetch_array($result)){ $from = $row2['fromwho']; $to = $row2['towho']; $date = $row2['date']; $message = $row2['message']; { ?> Response by: <?php print "$from"; ?>:<br /> Sent: <?php print "$date"; ?><br /> Message: <?php print "$message"; ?><br /><br /><br /> <?php } } ?> <br /><br /> <form action="message.php?mid=<?php print "$mid"; ?>" method="post"> <textarea cols="30" rows="3" name="message"></textarea><br /> <input type="submit" value="Reply" name="submit"></form> <?php } else { echo "<script language='JavaScript' type='text/javascript'>alert('Dont read other peoples mail.'); location = 'inbox.php';</script>"; exit; } ?> <?php } } } } } } else { header("Location: nosession.php"); } ?> Hope it works. -
Yes, it uploads to a temporary folder and moves it to one in your web directory that you specify. Why would you want to change the temporary directory?
-
Try using the function is_numeric("the string"); If it's not a string try using: is_int(number);
-
Have no whitespace and no comments just to save loading time by ".000000000000001" (as an example by Crayon Violet), or have a neat looking script with informative comments. Hmmmmm...
-
Change $_COOKIE to $_SESSION and add session_start, and bam.
-
Make: Dell ( :'( ) Model: Dimension E310 ( :'( ) Ram: Below yours Video Card: Built-in 128mb crap. I can't even load BF2 (Battlefield Two) OS: Dual-boot of Windows XP Home && Xubuntu 8.04 LTS. I don't really know where to find my system specs LOOL but all I can say is... My computer sucks. The only part that is fast is the Linux, but my internet connection is still slow.
-
Assuming you're using cookies for logging in (and the cookie names are "username" and "password", you could do something like: if (!isset($_COOKIE["username"]) || !isset($_COOKIE["password"])) { include("mylogin.php"); } else { //your member page info } That's very simple though. You should also check if the username is correct, if the password is correct for that username, and so on.
-
What is this character (&) at the very end of the path mean?
Stephen replied to coder9's topic in PHP Coding Help
I don't know? On some forums when you get the session stuff for the URL, if one part is blank it just includes a &. Do you mean it's randomly including this character in the URL in your script? Or some page you viewed once -
Uhm open Notepad and make a layout?
-
Parse error: parse error, unexpected $end in - Email Form
Stephen replied to ootweb's topic in PHP Coding Help
Uhm try adding: <?php } } ?> After "</html>". -
As DarkWater said, you need default values if you don't want to give an input for whatever reason. For default values you do like: function name($name="",$name1="",$name2=""){ //code }
-
I changed over 2300 lines of ?> html <?php to echo fast, so why can't you do 500 files? (100lines ea. would be 5000 lines). Anyway, if its super huge I would think it's fine the way it is. I just switched mine for looks.
-
Dumb question, but do you even connect to the database?
-
What is $CATGY_1 and $MFGR? By the way, in $selectall I think it should be: $selectall="SELECT * FROM ".$tablename." ".$SORT."";
-
stripslashes("string"); ?
-
You don't need to move to the next page. You can set the cookie and display it on the same page. EDIT: Although you may have to refresh, so I see why you would want it on the next page.
-
<?php function imageResize($width, $height, $target) { //takes the larger size of the width and height and applies the if ($width > $height) { $percentage = ($target / $width); } else { $percentage = ($target / $height); } //gets the new value and applies the percentage, then rounds the value $width = round($width * $percentage); $height = round($height * $percentage); //returns the new sizes in html image tag format...this is so you return "width=\"$width\" height=\"$height\""; } ?> <?php //get the image size of the picture and load it into an array $mysock = getimagesize("edit2.5.jpg"); ?> <img src="edit2.5.jpg" <?php echo(imageResize($mysock[0], $mysock[1], 150)); ?> /> Try that now. I used echo to show the return value.
-
I believe it's spelled "affiliate" if you're worried about spelling errors if anyone else views it. But uhm, try changing $affliate_src to something different. if (isset($_GET["src"])) { $_affliate_src=$_GET["src"]; } I'm not sure what QuickbooksSite is suppose to do/be. Please explain what you want to do.
-
I picked the second option. I don't know why that redarrow kid was so going off on it. All you need to do is put <noscript></noscript> and use the part inbetween the tags if they don't have js on. :/
-
Try removing the first forward slash (make it storage/ instead of /storage/) and see if it works.
-
$totalnum=200; $group1=200; $group2=0; $grouptotal=group1+group2; $grouptotal=$grouptotal/2; $grouptotal=$grouptotal/$totalnum; $grouptotal=$grouptotal*100; That would be 50%. Of course I think if group1 = 100, group2=200, and totalnum = 300 it would be 100% and thats not what you want. Maybe like: $group1=100; $group2=300; $totalnum=400; $totalnumdiv=$totalnum/2; if ($group1==$totalnumdiv && $group2==$totalnumdiv) { echo("Group1 and group2 are the same number and equal to totalnum."); } else { echo("Group1 and group2 are not the same number but may be equal to totalnum."); //This is what it should return. } I think that should work. Try it with group1 and group2 equaling 200.
-
I don't like the layout Fireballs :/ but you should post a new topic for that
-
Why don't you go group 01 + group 02 / 2 = totalgroup, or something like that. If group 01 is 200 and group 2 is 200 it would be 200.