Problems With Connect Script
17/2/2009 | external link
I got tired of not being able to work on coding my site when I didn't have internet access so I downloaded easyphp, and for some reason whenever I go to a page other then index I get an error saying that a session has already been started and then it shuts down. I include the connect file on all the pages, and it's never done this before.connect file session script:CODEsession_start();if((!isset($_SESSION['id'])) || (!isset($_SESSION['username'])) ||(!isset($_SESSION['password']))){unset($_SESSION['username']);unset($_SESSION['password']);unset($_SESSION['id']);$loggedin = 0;}else{$loggedin = 1;}
Checking If A Button Was Clicked
17/2/2009 | external link
I've been trawling for some scripts and came across two small examples that I want to use, but they had different ways of checking if a submit button had been clicked. These were just small bits of code so obviously I'll expand on them. But I would like to know what the difference is and which one is the best to use.Suppose the button is named "clicked".The first example had:if ($_POST['clicked']) { do this }The second had:if (isset($_POST['clicked'])) { do this }They both seem to do the same thing on the limited testing I have done. I've had a look through php.net but can't quite see what the difference is. Thanks.
Please Help!...
17/2/2009 | external link
Ive messed up my site a bit because i thought this would work... my main directory has lots of .php pages so i wanted to clean it up a bit (like, downloads/downloads.php) (content/content.php) etc so i made folders.. 'downloads' > downloads.php .. and in that 'downloads.php' i changed my php include from<? include("header.php ") ?>and <? include("footer.php") ?> because its not in the main directory any more.. to <? include("http://www.myhostsname/mysitename/header.php") ?>(my hosts name is because a friend hosted me so i have a subdomain)..where my header is located... but it hasnt worked, when i go to my downloads.php page online, i get the header and footer but with no styling to it... and its just writing rather than all the header images/styles.. do anyone know how i can add my header/footer include to a page within a folder of my directoryive started changing it all back...and putting my downloads.php/content.php etc in my main directory again and just keeping images in sub folders but surely theres a way to get this to work?
Register Page
17/2/2009 | external link
HelloI want to create a page in which someone can register a new account.I use the following code but in the line 30 it says that there is the following error "Fatal error: Can't use function return value in write context in /var/www/register/register.php on line 30".Please can you help me?CODE<html><body><form method="post" action="register.php">Username<br> <br> <input name="username"><br> <br>Password<br> <br> <input name="password" type="password"><br> <br>E-Mail<br> <br> <input name="email"><br> <br><input name="submit" type="submit"><br></form><?php$con = mysql_connect("localhost","root","root");if (!$con) echo mysql_error();mysql_select_db("register", $con);$dedomena = mysql_query("INSERT INTO register (username, password, email)VALUES ('$_POST[username]', '$_POST[password]', '$_POST[email]')");if (gettype($_POST["username"]) != NULL && gettype($_POST["password"]) != NULL && gettype($_POST["email"]) != NULL && (isset($_POST["submit"])) { $dedomena; echo "register has been completed"; }elseif (gettype($_POST['username']) = NULL or gettype($_POST['password']) = NULL or gettype($_POST['email']) = NULL) echo "One or more fields are empty";?></body></html>
Populate Teachers Drop Down Menu
17/2/2009 | external link
I have 2 drop down menus on one page. The first is to get the schoolid and school out of MySQL. This worksMy problem is populating the second box with the teachers of the school from the first box you choose.If possible I would like to know how to use AJAX to get rid on the submit button.Here is my code.CODE<form action='test10.php' method='post'> <select name="Schools" size="1"><?PHPinclude ("config.php");// Make a MySQL Connection$link2 = mysql_connect( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());// select the databasemysql_select_db($dbname) or die ("Could not select database because ".mysql_error());echo '<br / ><br />' . "\n";// put schools in drop down menu$sql = "SELECT schoolid, school FROM schools";$result = mysql_query($sql,$link2);while ($schools = mysql_fetch_row($result)) { echo '<option value="' . $schools[0] . '">' . $schools[1]. '</option>';}echo '<br / ><br /><br / ><br /><br />' . "\n";$id = mysql_real_escape_string($_POST['Schools']);?><form action='test10.php' method='post'><select name="teachers" size="1"><?PHPecho '<br / ><br />' . "\n";// put schools in drop down menu// $sql = "SELECT lname, lname FROM teachers";$sql = "SELECT lname, lname FROM teachers WHERE schoolid = '$id'";$result = mysql_query($sql,$link2);while ($teachers = mysql_fetch_row($result)) { echo '<option value="' . $teachers[0] . '">' . $teachers[1]. '</option>';}echo '</select>' . "\n"; // Closing of list boxecho '<p><input name="Submit" type="submit">' . "\n";echo '</form>' . "\n";echo '<br / ><br /><br / ><br /><br />' . "\n";if (isset($_POST['Schools'])){ $sql = 'SELECT school FROM schools WHERE schoolid=\'' . $_POST['Schools'] . '\''; $result = mysql_query($sql); $row = mysql_fetch_array($result); echo 'The school is "' . $row['school'] . '" with the ID: "' . $_POST['Schools'] . '"'; } echo '<br / ><br /><br / ><br /><br />' . "\n";if (isset($_POST['teachers'])){//$sql = 'SELECT lname FROM teachers WHERE lname=\'' . $_POST['teachers'] . '\'';$sql = "SELECT lname, lname FROM teachers WHERE schoolid = '$id'"; $result = mysql_query($sql); $row = mysql_fetch_array($result);echo '"The teacher is "' . $row['lname'] . '"'; } mysql_close();?>
How Can I Avoid Cache ?
17/2/2009 | external link
Hi everyone!I´m building a PHP photo manager. I have several categories of pics, and I want the user to be able to change the position of the pics on a gallery. I have one folder for each category containing the pics of that categoy. I´ve made a PHP that generates dinamically a table with all the pics in a certain directory. Each pic in the gallery have an arrow that moves the pic for the right for example. In an onclick event I call a php page that renames the pics acroding to the move and calls the gallery back. The gallery generates again, with the new names and pics and it works fine the the first time I click, may be the second or even the third but then it stop changing pics. But i´ve noticed that the problem is the browser bringing pics from cache, cause if I erase the cache and hit F5 I get the correct view.The question is, is there any effective way of avoiding cache ?I´ve tried some META tags, or headers. I´ve found everyone saying but it doesn´t work, or I´m not aplying it correctly.I´m new to programming its very probable i´m messing with something. But whatever it is.. I dont know..Anyone can realize what should be done ?I´l be grateful to whoever helps mewell ..here is the codeThe galley:CODE<?session_start();if($_SESSION['validate']!= 1){ Header("location: login.php"); }if ($_SESSION['reload'] == true){ $_SESSION['reload'] = false; $test = "caca"; echo "<META HTTP-EQUIV='refresh' CONTENT='5'; URL='mportraits.php'>";}echo $test;?><html><head><title>Administrar Fotos</title><link rel="stylesheet" type="text/css" href="manage.css"><script type="text/javascript">var numero = 0;function adelante(numero)</script></head><body><div class="divcontenedor"> <div class="divlinks"> <table class="tablalinks"> <tr> <td><a href="mcommercial.php">Commercial</a></td> <td class="separadorlinks"> </td> <td><a href="mlandscapes.php">Landscapes</a></td> <td class="separadorlinks"> </td> <td class="tdactivo">Portraits</td> <td class="separadorlinks"> </td> <td><a href="manalogic.php">Analogic</a></td> <td class="separadorlinks"> </td> <td><a href="mmore.php">More</a></td> </tr> </table> </div> <div class="divfotos"> <table class="tablafotos"> <? $dir = "fotos/tportraits"; $cant=0; if (is_dir($dir)) { if ($gd = opendir($dir)) { while (($archivo = readdir($gd)) !== false) { $cant++; } closedir($gd); } } $cant = $cant -2; $fotonum = 100; $lim = $cant/7; $lim2 = 100+$cant; for($i=0;$i<$lim;$i++){ echo "<tr>"; for($j=0;$j<6;$j++){ if($fotonum<$lim2){ echo "<td class='tdfotos'><img src='fotos/tportraits/t".$fotonum.".jpg'><br>"; echo $fotonum; echo "<span class='spanmover' onclick='adelante(".$fotonum.")'> ></span>"; echo "</td>"; $fotonum++; }else } echo "</tr>"; } ?> </table> </div></div></body></html>The renaming page:CODE<?session_start();$_SESSION['reload'] = true;$num = $_GET['num'];$ad = $_GET['num'] +1;rename("fotos/tportraits/t".$num.".jpg","fotos/tportraits/trans.jpg");rename("fotos/tportraits/t".$ad.".jpg","fotos/tportraits/t".$num.".jpg");rename("fotos/tportraits/trans.jpg","fotos/tportraits/t".$ad.".jpg");header("location: mportraits.php");?>Only left functionality is made casue I´m stuck here...Thanks.Rodre
Image Gallery
17/2/2009 | external link
This is my PHP code that i have but nothing works it does not show my images at all could someone please help me i am desperate here.Thank you in advance for your help!My Code<?phpfunction imagecreatefromfile($path, $user_functions = false){$info = @getimagesize($path);if(!$info){return false;}$functions = array(IMAGETYPE_GIF => 'imagecreatefromgif',IMAGETYPE_JPEG => 'imagecreatefromjpeg',IMAGETYPE_PNG => 'imagecreatefrompng',IMAGETYPE_jpg => 'imagecreatefromjpg',);if($user_functions)if(!$functions[$info[2]]){return false;}if(!function_exists($functions[$info[2]])){return false;}return eval("($path);");}?>
Sending Sessions
17/2/2009 | external link
im having a bit of a problemnow my site uses sessions(); all functioning properly im wondering on how to send a session(); to another page a pop-up control panel i try to send but the pop up wont recieve the session data!you can always ask me for more info if neededcan anyone help me ?thanks scott
Retrieving Array Results Following A Join
17/2/2009 | external link
I'm stuck!The query is "SELECT * FROM users,messages WHERE users.id=messages.from AND messages.read=0;"I do the usual connection, run query then use a while loop: WHILE ($row = mysql_fetch_array($result)).How do I print the results from the $result array? By this I mean suppose I want the field users.username or messages.datesent? At the moment I have to do print "<pre>; print_r ($result) etc and try to find the index eg $row[3] or $row[6] etc. Obviously if I then add or remove a field to either of the tables this number will change.I've tried print $(row['users.username']) and $row['users'.'username'] and $row['users']['username'] and all possible combinations but can't get it.Anyone help?
Md5 Password
17/2/2009 | external link
######@,Using SQL can edit password MD5? Thanks and MERRY CHRISTMAS!
Carrying And Retrieving Variable Using Cookie.
17/2/2009 | external link
Initial Page CodeCODE<?php $con=mysql_connect("localhost", "root", "discreet"); if (!$con) { die ('Error : ' . mysql_error()); } mysql_select_db("hitcounter", $con); $initial_value = mysql_query("SELECT * FROM test_hit_counter"); while ($carried = mysql_fetch_array($initial_value)) { $y = $carried['hits'] + 1; } mysql_close($con); setcookie("hit", ($y)); ?>Is this code for generating a cookie is OK? Final Page CodeCODE<?php $con=mysql_connect("localhost", "root", "discreet"); if (!$con) { die ('Error : ' . mysql_error()); } mysql_select_db("hitcounter", $con); mysql_query("UPDATE test_hit_counter SET hits = ????????????????????????????"); ?>How to replace ???????????????????? with values carried by cookie?
Avoid Variable Declaration.
17/2/2009 | external link
CODE<?php echo date("H") . "<br />"; $H=date("H"); if ($H>5 && $H<12) echo "Good Morning"; elseif ($H=12) echo "Good Noon"; elseif ($H>12 && $H<4) echo "Good Afternoon"; elseif ($H>4 && $H<8) echo "Good Evening"; else echo "Good Night"; ?>Is it must to declare time as a variable? Can't we use the date tie function directly to compare with the numerical values? Tried that but code doesn't work in that case.
Help Needed In Contact Form
17/2/2009 | external link
Hi...Click here PlzIn there i have 6 countries.. and in that countries i have two contacts..When i click USA it goes to the spoecific contact.. Thats working well..But the backend coding is likeCODE<?php if ( $this->contact->params->get( 'allow_vcard' ) ) : ?><tr> <td colspan="2"> <?php echo JText::_( 'See the remaining Contacts ')?> <a href="<?php echo JURI::base(); ?>index.php?option=com_contact&view=contact&id=2:rajaramasamy&catid=12:contactsofusa"> <?php echo JText::_( 'Click Here' );?></a> </td></tr><tr>In the above code i directly mention an address.. I need to do that by coding with check whether existing..I hope you may understand what i need...see the image below...
Symfony Language Parser
17/2/2009 | external link
Hello Symonians (Symfony framework users), how to user xml parser in symfony (without DOM).There is another way called sfWebBrowser().I'm looking for possible ways to read xml files & print them as array.
Browser Issue
17/2/2009 | external link
hi,i am using asp.net with c# code behind.i created my own module with image effects using javascript.Explanation:i just get the value of width and height from end user for uploaded images.It works fine.but one issue will occurred.how to solve this issue?when i refresh the page. the uploaded images are display repeated without effects . that means it displayed the saved images. then It takes the effects. So, Please give some suggestion for my related questions.How to solve the issue : when i refresh the browser the images are display with repeatedly ! actually , my concept is need to display the images sequence order with effects.please replay soon to solve this one...Advance thanks
Select From Where Help
17/2/2009 | external link
I have this code on my page. it will not work. I can replace the " . $_POST['Schools'] " with the schoolid and it will work.[PHP]$sql = "SELECT lname FROM teachers WHERE schoolid = . $_POST['Schools'] . ";[/PHP]The " . $_POST['Schools'] " comes from a drop down menu. I do get the echo [The school is "Keota" with the ID: "31SIS043"]with this line:[PHP]echo 'The school is "' . $row['school'] . '" with the ID: "' . $_POST['Schools'] . '"'; [/PHP]which is correct, but will not list the teachers from that school.Paul
To Union More Than 2 Tables
17/2/2009 | external link
helloon my php-nuke site, i try to union 3 tables, like this;CODE$sql = " SELECT jid, sid, aid, time, title FROM iafm_journal where status = 'yes' " ." UNION SELECT jid, sid, aid, time, title FROM iafm_stories" ." UNION SELECT jid, sid, aid, time, title FROM iafm_comments order by time DESC LIMIT 0, 7";It works if I use 2 of the tables, no matter what 2, but it does not work with all 3 tables.I guess there is a syntax problem, but can not figure out what.Anyone knows?EDIT: I found the fault myself
Mail() Issues
17/2/2009 | external link
I have my website send an email to users so they can activate their account. I registered using a gmail, and it works fine, the email appears with the links and stuff, but when I try to register using a yahoo account the email is never received, the script says that it sent it, but when I check my yahoo inbox, its empty. The email is on my site, information @ mysite.com, so I am not sure why it is not working for yahoo only(I used a roadrunner account too). If you need the code, I'll be happy to post it.~clonetrooper9494
How To Get The Value In Page_load
17/2/2009 | external link
Hi to all,I created a method outside the page_load.Now I want the value of that variable which is defined in the method, in Page_load.thanks.....
Page Behind Page
17/2/2009 | external link
Hello Friends, Visit below linkhttp://www.codango.com/php/ Look at the Right Top. You can see that there is an advertisement for Alert bot after you flip the page. I would like to implement this functionality.Is it written in php? or any other language.
Header Already Sent..
17/2/2009 | external link
I have a index.php that have a header for the CSS, title... and my pages areindex.php?page=loginindex.php?page=registerindex.php?page=pages...something like that, and I did require_once 'other php doc' for the main content of the website, so it like a HTML frame, but with php get page for index.php?page=login in the URLbut it say header already sent because i have a header in index.php and the doc i require_once... but I need both header how can i do that?
Xhtml Desktop, Will Php Wor?
17/2/2009 | external link
I have a desktop that I load onto computers at work. It loads as an Active Desktop when the computer is logged on. The files are on a local server, and linked from the Customize Desktop tab in Desktop properties. My question is, if I use PHP in those pages, will the browser (IE) be able to interpret them with no PHP installed on the server? The page is not hosted, it is loaded from XHTML files in a shared documents folder on that server.Will PHP work in that situation?
Visual Basic Dataset
17/2/2009 | external link
Hello,I have a DataSet object with data organized in a specific way. Is there an easy way to reorganize that data? For instance, I thought maybe I could create an XML schema file to define how I want to see the data and then read that into the DataSet. But as I thought about it some more, I'm not sure that will work.Any assistance would be greatly appreciated.
Caching Issue On New Host
17/2/2009 | external link
Moving across a mini CMS to a different host, now I often have to reload admin page to see current page banner, which can be updated on same page. It often displays first the banner I had before an update and once I reload page it shows the current banner (which is helpful to decide if you want to upload a new one). This did not happen on old host. Does anyone know why this could be? And how do I remedy situation?Son
Anagram Solver
17/2/2009 | external link
Hiya all!I am trying to build a basic anagram solver that looks through all possibilities for words, check weather they are true, and acts accordingly.Imput = "TAE"Word(1) = "TEA"Word(2) = "ATE"Word(3) = "AET"Word(4) = "ETA"Word(5) = "EAT"For i = 1 to 5If isRealWord(Word(i)) Then Ans(i) = TrueElse Ans(i) = FalseEnd IfNext' RESULTAns(1) = True 'Tea is a real wordAns(2) = True 'Ate is a real wordAns(3) = False 'Aet is NOT a real wordAns(4) = False 'Eta is NOT a real wordAns(5) = True 'Eat is a real word' OUTPUTAnagrams:TeaAteEatI need to have a function (isRealWord) that can check a wrod inside an external dictionary.If there is a downloadable dictionar DLL I can get hold of, please tell me, or how I could contenct to a Microsoft Word dictionary WITHOUT opening Word.
Patch Installtion For Upload Progress Meter
17/2/2009 | external link
Dear Friend , I want that display progress bar when upload image ...this is conflict me so could u help me .....I've attach link please refer that after please tell how to install the patch and configure in my local server....http://pdoru.from.ro/upload-progress-meter...ess-meter-v4.1/
User Access Using Php & Mysql
17/2/2009 | external link
Hello All:I'm fairly new to PHP development and I have a few quesitons. I've developed a basic website which contains a directory which has files with forms to update the websites content, a Content Management System (CMS) per-say. I've included a username and password login form which will post to itself, upon returning to itself it should run some PHP code which should query the MySQL db. If it is a valid username and password then a cookie is set and the viewer is directed using the "header" code to the cms main page. No all the cms pages have a bit a code at the top which states that if the correct cookie is not set in the system then that viewer is not logged in and therefore will be redirected (header again) to the login page. All the pages are in PHP. I've divided the three main codes blocks below, can anyone review and tell me where I could be going wrong. What I am getting right now is that the user log's in, but the login error is kicked off stating that the username and password are invalid. Thanks.[LOGIN PAGE]<?php require("../php/dbConn.php"); require("../php/userCon.php"); $logInErrors = false; if(count($_POST) > 0) { $U = $_POST['fldUsername']; $P = $_POST['fldPassword']; openDBConn($dbcon); newLogIn($U, $P); if(newLogIn($U, $P)) { header('Location: cmsmain.php'); } else { $logInErrors = true; } }?>[dbConn.php PAGE]<?php function openDBConn($dbcon) { $dbcon = mysql_connect("localhost", "xxxxxxxxx", "xxxxxxxxx"); if(!$dbcon) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxxxxxxx", $dbcon); } function closeDBConn($dbcon) { mysql_close($dbcon); }?>[userCon.php PAGE]<?php function isLogedIn() { if(isset($_COOKIE["c61uAuth"]) && $_COOKIE['c61uAuth'] == 'true') { return true; } else { return false; } } function newLogIn($U, $P) { $selectuser = ("SELECT usrAccess FROM t_axxess WHERE usrAccess = '$U' AND usrPass = '$P'"); $row = openDBConn($selectuser); if($row != null) { setcookie("c61uAuth", urlencode("true")); setcookie("c61uAuthName", urlencode($rows[0]['usrAccess'])); return true; }else { return false; } } function logOut() { setcookie("c61uAuth", urlencode("")); setcookie("c61uAuthName", urlencode("")); unset($_cookie['u']); }?>
Patchy Sessions?
17/2/2009 | external link
I have a user area where you have to log in to access any user area files. If the session for user_id does not exist it sends you to login page. It was all working fine on test server (on different folder to live server).Now, my problem: On live server there a sub-domain has been created yesterday. They forgot to create folder for this one, which has been done this morning. Going trough my client-area I keep being thrown out. In most cases a 'page-reload' solves the problem (which should not be the case). It just does this on live server. Could that have something to do with the propagation? Do not really understand why once you can access the client area files without problems, then you do it again and the system throws you out. Most funny thing is the page reload, which solves the issue. Did this ever happen to anyone else?Son
Include() - Where Are The Limits?
17/2/2009 | external link
Hi everyone !I am developing a multilingual websiteHaving done an english and french site before which was VERY messy, actually having a en/ and a fr/ directory with separate files for the same info in different language, I have this time a much better understanding of what is possible, anyway, I was thinking for information such as navigation html and footer information, that I'd just store this information in a table on the database and go and get it according to what language the php variable was set in, but then I thought, this could be a very big bomb waiting to explode, far too many queries for the same info, so I have gone one step back and decided to use a "switch" to determine what file to include, for example I have a "english-menu.html" "french-menu.html" etc...But I don't want these separate files to be accessed in the url bar of a browser, can I somehow make these files only accessible through the include() function ? Or do I have to do something server side? Also, about the include() function, I tried giving it a variable include($file);And it didn't want to use it, why ?
Smtp Error
17/2/2009 | external link
Dear Guys,I am facing a problem in sending email whenever i try to send an email from a script an error occurs such as Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\xampp\htdocs\mails.php on line 7Mail Sent. Can anybody guide me please.Infact i cant find a php.ini file in my localserver.There are two files such as php.ini-dist and php.ini-recommended.Should i create a new php.ini file if yes then how?Can i use an id like some1@hotmail.com in SMTP setting.IT will be very appericiated if anybody help me please.i am very new in this field.
Dynamic/variable Redirect
17/2/2009 | external link
I'm redoing the pagination on my website, and i'm wanting to have a box that when a person submits an existing page number for their search resultsI tried it using a simple form, passing the value to a separate file and using a redirect header, but I can't get it to work.I've tried "everything", does anyone know what i'm doing wrong? anyone have any ideas?Any and All help is appreciated. :]
How Can I Extract Information From An Outside Web Page
17/2/2009 | external link
What I want to do is to extract or turn the information stored in a page like this, to a PHP value. Something simple like this:CODE$info=http://theURLabove.com/pageProblem is I've no idea where to start. I tried the fopen() method, but the hosting service apparently disabled this function. I believe it's manageable with AJAX (seeing as JScript is less limited), but I'd like to try it in PHP first, especially if it's simpler.
Database Backup
17/2/2009 | external link
hi friends,i am very new to this field, i want to get backup my sql databse files in my own server,i want script to do that,any one cane recommend that script because i tried in google ,then i am failed so i expected it from w3schools,please help me,i am in trouble
Problems Adding To A Mysql Table
17/2/2009 | external link
OK. all this script is suppose to do is add the user input into a mysql table. but i get this error:" Parse error: parse error in arcade_add.php on line 22". First is line 22 and then there is the rest of my script incase i counted wrong.CODE$db = @mysql_select_db("$my_db", $connection) or die(mysql_error());CODE<?session_start();if(($_SESSION[username] == "") ||($_SESSION[password] == "")){header("location: login.phtml");exit;}?><?$id = "$_POST[id]";$g_name = "$_POST[gamename]";$g_dis = "$_POST[discription]";$g_code = "$_POST[gamecode]";$g_width = "$_POST[width]";$g_height = "$_POST[height]";#$my_db = "arcade";$connection = @mysql_connect("localhost","user","pass") or die(mysql_error());$db = @mysql_select_db("$my_db", $connection) or die(mysql_error());$sql = "insert into games (game_id, gamename, gamediscription, gamelink, gamecode, width,height) values (\"$id\",\"$g_name\",\"$g_dis\","<form method=\"post\" action=\"playgame.phtml\"><input type=\"hidden\" name=\"game\" value=\"$id\"><input type=\"submit\" value=\"Play Game\" class=\"playgame\"></form>\",\"$g_code\",\"$g_width\",\"$g_height\")";$result = @mysql_query("$sql", $connection) or die(mysql_error());?><?session_start();if(($_SESSION[username] == "") ||($_SESSION[password] == "")){header("location: login.phtml");exit;}?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head><title>Family Connection</title><link rel=stylesheet type="text/css" href="style.css"><link rel=icon type="image/x-icon" href="fav_icon.ico"></head><body><p class="adminmenu"><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="138" height="204"><PARAM name="movie" value="flashvortex.swf"><PARAM name="quality" value="best"><PARAM name="menu" value="true"><PARAM name="allowScriptAccess" value="always"><EMBED src="flashvortex.swf" quality="best" menu="true" width="138" height="204" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always"></EMBED></OBJECT></p><div class="home_outline"><br><br><p><center><img src="header_image.gif" alt="Header Image" width="625"></center></p> <div class="login_body"><p>Welcome, <? echo "$_SESSION[real_name]"; ?> [<a href="http://localhost/familyconnection.com/logout.php">Log Out</a>]</p> <div class="menu"><div class="button_1"><a href="http://localhost/familyconnection.com/home.phtml" class="button"><p>Home<p></a></div><div class="button_2"><center><a href="http://localhost/familyconnection.com/add_date_step_one.php" class="button"><p>Add A Date To The Calandar</p></a></center></div><div class="button_3"><center><a href="http://localhost/familyconnection.com/fms/index.php" class="button"><p>Family Mail Service</p></a></center></div><div class="button_4"><center><p><a href="http://localhost/familyconnection.com/feedback.phtml" class="button">Feedback</a></p></center></div><div class="button_5"><center><p><a href="http://localhost/familyconnection.com/quick_links.phtml" class="button">Quick Links</a></p></center></div><div class="button_6"><center><p><a href="http://localhost/familyconnection.com/arcade.phtml" class="button">Arcade</a></p></center></div><?If($_SESSION[username] == "admin"){$button = "<div class=\"button_7\"><center><p><a href=\"http://localhost/familyconnection.com/admin_mode/admin_index.phtml\" class=\"button\">Admin Mode</a></p></center></div>";#echo("$button");}else{$button = "<div class=\"button_7\"><center><p><a href=\"http://localhost/familyconnection.com/picks.phtml\" class=\"button\">Top Picks</a></p></center></div>";echo("$button");}?><br><br><br><p><hr size="2" color="black" class="divide_line"></p><br><p>Game was entered!!!</p><p>please help me!!!-youngwebmaster
Change Font
17/2/2009 | external link
hi, i want to let the user choose a font type/size etc to display an output page, from other page. i can wire it to the script, as in have some pre-chosen fonts and let him/her choose from the list, but i would like to have something like the system font dialog, where some box opens and displays the fonts installed in the user system, is it possible from php? if so, how?tnx
Simple Php Contact Form-helpme
17/2/2009 | external link
Hello all,I'm using a contact form from this source http://www.thewebhelp.com/php/php_contact_...age_validation/,And I've run into a few problems:1.I want to add a name (full user name) field into the form. Can you please show me what to do (just paste the code with the changes).2.I wanna send the message in a non-English language which uses UTF-8. But when I get the email, the subject is in gibberish, how do I make it be sent in UTF-8?This is the code (which you can also download from the link I gave):Contact.phpCODE<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Contact Us</title><script type="text/JavaScript"><!--function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_validateForm() { //v4.0 var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == '');}//--></script></head><body> <form action="mailer.php" method="post" name="form1" id="form1" style="margin:0px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px; width:300px;" onsubmit="MM_validateForm('from','','RisEmail','subject','','R','verif_box','','R','message','','R');return document.MM_returnValue">Your e-mail:<br /><input name="from" type="text" id="from" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['from'];?>"/><br /><br />Subject:<br /><input name="subject" type="text" id="subject" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;" value="<?php echo $_GET['subject'];?>"/><br /><br />Type verification image:<br /><input name="verif_box" type="text" id="verif_box" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"/><img src="verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="50" height="24" align="absbottom" /><br /><br /><!-- if the variable "wrong_code" is sent from previous page then display the error field --><?php if(isset($_GET['wrong_code'])){?><div style="border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:4px; padding-left:6px;width:295px;">Wrong verification code</div><br /> <?php;}?>Message:<br /><textarea name="message" cols="6" rows="5" id="message" style="padding:2px; border:1px solid #CCCCCC; width:300px; height:100px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"><?php echo $_GET['message'];?></textarea><input name="Submit" type="submit" style="margin-top:10px; display:block; border:1px solid #000000; width:100px; height:20px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; padding-left:2px; padding-right:2px; padding-top:0px; padding-bottom:2px; line-height:14px; background-color:#EFEFEF;" value="Send Message"/></form></body></html>Mailer.phpCODE<?php// ----------------------------------------- // The Web Help .com// ----------------------------------------- // remember to replace you@email.com with your own email address lower in this code.// load the variables form address bar$subject = $_REQUEST["subject"];$message = $_REQUEST["message"];$from = $_REQUEST["from"];$verif_box = $_REQUEST["verif_box"];// remove the backslashes that normally appears when entering " or '$message = stripslashes($message); $subject = stripslashes($subject); $from = stripslashes($from); // check to see if verificaton code was correctif(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){ // if verification code was correct send the message and show this page mail("you@email.com", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from"); // delete the cookie so it cannot sent again by refreshing this page setcookie('tntcon','');} else { // if verification code was incorrect then return to contact page and show error header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true"); exit;}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>E-Mail Sent</title><style type="text/css"><!--body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 12px;}--></style></head><body>Email sent. Thank you.<br /><br />Return to <a href="/">home page</a> ? </body></html>NOTE: I save it as UTF-8 and then using Notepad++ Convert it to ANSI. Please help me,Thanks.
Display Msg & Open Page
17/2/2009 | external link
What I want is to show the user a message, wait a few seconds and then open a page in the same window.I got the code as below, but it is not working.It does wait and opens the page correctly, but the message is not shown.CODEif ($waarde == 1) { echo "Gebruikersnaam bestaat al"; sleep(5); echo ("<script>window.location ='aanmelden.php';</script>"); }
Php Session Problem
17/2/2009 | external link
Hi, can any of you help me with this problem?I have recently moved to Linux hosting, but develop locally using WAMP.I'm having trouble trying to replicate session behaviour on my host - namely the session cookie appears to be empty when I leave one page and move to the next. For example - I set the session variable thus:CODEsession_start;$user_input='blah';$_SESSION['data']=$user_input;and then on the next page I use the following:CODEsession_start;if ($_SESSION['data']=='blah'){$x=$_SESSION['data'];echo "$x";}else{echo "errors";}This is actually a much simpler description of what I'm doing - but in essence it's the same. When I test this locally I get the expected result - in this example the text 'blah' in the browser. However, when I test on the host, I get the error message. I did a print_r() of the $_SESSION variable on each location, and locally it reads out the content of the variable, but on the host the variable is empty once it is picked up by the recieving page. I've contacted my host, but they suggested that this might be down to the dev environment, specifically the variable 'path' on account of my local setup being windows, and the host being Linux. I checked the settings with phpinfo() on both environments, and under the session section there are the following differences:session.bug_compat_42: Host = On Local = Offsession.gc_divisor: Host = 100 Local = 1000session.hash_bits_per_character: Host = 4 Local = 5session.save_path: Host = No value Local = C:/Program Files/wamp/tmp
Error In My Code
17/2/2009 | external link
CODE<html><head><title>New Page 1</title></head><body> <?php if (isset($_REQUEST['select'])) { $choice = $_REQUEST['select']; echo "Choice succesful : "; echo $choice; } else { echo "Please type the name of the file you would like to edit or create:<br />"; } ?> <form method='POST' action='test.php'> <br /> <input type="text" name="select" size="60"> <br /> <input type='submit' value='Save' name='sub_one'> </form> <hr /> <?php if (isset($_REQUEST['select'])) { if (isset($_REQUEST['message'])) { $message = $_REQUEST['message']; $message = stripslashes($message); $file = fopen($choice,'w+'); fwrite($file,$message); fclose($file); } else { if (file_exists($choice)); //this is line 40 { $text = file_get_contents($choice); $text = trim($text); $text = stripslashes($text); echo "<b>Edit Page:</b> <br /> <form method='post' action='test.php'> <textarea rows='30' cols='80' name='message'>$text</textarea> </form>"; } else { echo "<b>New Page:</b><br /> <form method='post' action='test.php'> <textarea rows='30' cols='80' name='message'></textarea> </form>"; } } } } ?> </body></html>and this error appears:"Parse error: parse error, unexpected T_STRING, expecting '(' in /home/content/k/g/r/kgrabe/html/grabeorama/test.php on line 40"and I've tried changing line 40 to 'if (file_exists($choice) == 1);'What is wrong with my code?Thanks
Struts In My Jsp File. Need Help!
17/2/2009 | external link
So im completely new to jsp and struts, but ive been given a task to figure part of it now and im stuck.Instead of using a static jsp include, i need to do a struts call using the ajax method. and it references an xml file. However, it doesnt work, and I am totally lost. Any help would be greatly appreciated! xml file related to header:CODE<package name="main" extends="struts-default"> <action name="header"> <result>/jsp/header.jsp</result> </action></package>struts callCODE<s:url action="header" id="header_url"/><s:div id="header" theme="ajax" href="%"/>
Alphabetizing A Text File
17/2/2009 | external link
Is there a way of alphabetizing a list of words in a text file?Like if I had:'animals.txt'DogCatMouseLionHow would I make that text file look like this:CatDogLionMouseThanks~Grabeorama
Placing Text Under Images In Gallery
17/2/2009 | external link
I have a script that will display my thumbnails in a table and I wish to have the name of the file underneath plus a delete option, I would like a button for this but I have got the text so that will do.The connections are correct it deletes the right file from thumbs and originals but it comes out on top of the images instead of under each one.It doesn't matter if the images are in a list but they do need the name underneath.Here is the code.<?php $images = "thumbs/"; # Location of small versions $big = "graphics/"; # Location of big versions (assumed to be a subdir of above) $cols = 4; # Number of columns to display if ($handle = opendir($images)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != rtrim($big,"/")) { $files[] = $file; } } closedir($handle); } $colCtr = 0; echo '<table align= "center" width="80%" cellspacing="3"><tr>'; foreach($files as $file) { if($colCtr %$cols == 0) echo '</tr><tr><td colspan="4"><hr /></td></tr><tr>'; echo '<td align="center"><a href="' . $big . $file . '"><img src="' . $images . $file . '" /></a></td>'; echo $file . ' <a href="delete.php?f=' . urlencode($file) . '">Delete</a></li>'; $colCtr++; } echo '</table>' . "\r\n"; ?> Robyn
Upload A File
17/2/2009 | external link
I am now having trouble trying to upload a file this is the code i got from W3schools could someone please help with this problem Below is my code<?phpmove_uploaded_file ($_FILES['uploadFile'] ['tmp_name'], "../uploads/{$_FILES['uploadFile'] ['name']}")?>
Making An Array
17/2/2009 | external link
I am receiving via $_POST a variable which was an array in javascript (sent by AJAX),in php I need to remake this array, so I did the following:CODE $myarr = array($_POST["list"]);the ajax is sending the following: list: 25,19,28and in php I need to make this variable an array and access it in a loop:CODE $myarr = array($_POST["list"]); $size = count($myarr); for($i=0;$i<$size;$i++){$sql ="........".$myarr[$i];...}
Another Basic Question From A Newbe
17/2/2009 | external link
I can set something like $registerd_ok = 1 in a page (like login.php) and then echo different phrases depending on the value of $registered_ok.Great, but I want to use the value of $registered_ok in a different page (like loggedin.php) to determine actions on that page. I have looked at GET and POST but those appear to be for forms only... ? I looked at session variables but either that doesn't do what I need or I am doing it wrong. Globals? Can someone tell me how to do this? I want to be able to set values whenever appropriate and then use them wherever needed.Does i make sense?ThanksJim
Clearing Undefined Indices
17/2/2009 | external link
Hello all,I'm trying to put together a web directory for my workplace, using a pre-coded script in PHP, but I keep seeing undefined index notices in the administrator sections. I am a total noob with PHP and thus have no idea where to start in order to clear these notices. For example:Notice: Undefined index: adminlogin in /www/obxhost.net/m/a/r/mart12/htdocs/webmaster/index.php on line 17This appears on the login page to the admin section. The line referred to is: if($_POST['adminlogin'] == "check")Similar notices appear throughout the admin section, and it is very frustrating!Any help would be greatly appreciated!clueless_coder
Changes In Server Causing Script Error
17/2/2009 | external link
Not a techie by any stretch of the imagination.....I've had an ASP page on my website for years which worked just fine. Recently the hosting company upgraded the server it was on and now the ASP page won't work.It is a MS Access DB. I've created a DSN entry in IIS (new to me as well as I've never used it). The old website also was DSNless.CODE:CODE<!-- db.inc --><%dim myDSN 'dsn connection stringdim conn 'connection stringdim SQL 'SQL stringdim rs 'record set stringdim username 'user name string sent from memberindex.aspdim password 'password string sent from memberindex.aspusername = request.form("username")password = request.form("password")myDSN = "DSN=gfoadb"Set Conn = Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"Conn.Open myDSN%>The error is that it doesn't like the Conn.Open line. This line has always worked in the past. Thoughts?In looking at examples, I see that I can also address the open directly by putting the path to the file in the statement but the hosting company has given me an absolute path name like /home/cluster1/data/n/r/xxxxxxxx/sites/xxxx.yyy/database/gfoa.mdbHow would I code the Open if this is the absolute path name?Thanks in advance
Unlink / Delete Image
17/2/2009 | external link
I have 1 script to unlink images from my gallery and it will not work and i have tried a couple of other scripts as well but they would not work either. Below is 1 of my unlink scripts<?php opendir('./Thumbs/'); $do = unlink($fileToDel); if($do=="1"){ echo "The file was deleted successfully."; } else { echo "There was an error trying to delete the file."; } ?><img src="/ICAB5165A_ICAB4220A/Thumbs/Cayden%20Smart%20chrissy08.jpg" width="100" height="100"></div><form action="unlink" method="get" name="Delete" target="mainFrame" id="Delete"> <input name="Submit" type="submit" id="Submit" value="Delete"></form>
Connecting To A Non-local Database
17/2/2009 | external link
Is it possible to connect to a SQL database using MYSQL hosted on a completely different server. Is there any security issues with doing so if possible. And can anyone explain how, or link a tutorial.Thanks, In advance.
Ordinary Image Into Thumbnail On Upload
17/2/2009 | external link
I need help with turning an ordinary image into a Thumbnail when it uploads any suggestion would be much appreciated
Ok How Hard?
17/2/2009 | external link
Ok im wondering about this it fits in both sql and this. any way here it goes. Im learning php and i got perms to take a forum software and update it as my own and im wondering how hard it would be to change it from text files to mysql? I want your honest opinions
Connecting To The Database
17/2/2009 | external link
Hi all, I am a newbe and am working on a login routine. I cannot get connected to the database. I have tried several different names and things but I keep getting the same error:Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'agent99'@'localhost' (using password: YES) in /home/realesv3/public_html/theclienttracker/checklogin.php on line 12cannot connectThis is the code I have now: CODE<?phpob_start();$host="localhost"; // Host name$username="agent99"; // Mysql username$password="agent99"; // Mysql password$db_name="realesv3_sunday"; // Database name$tbl_name="members"; // Table name// Connect to server and select databse.mysqli_connect("$host", "$username", "$password")or die("cannot connect"); mysqli_select_db("$db_name")or die("cannot select DB");Any ideas?Thanks!
Captcha Not Correct In Webserver Use Load Blancing (3 Server)
17/2/2009 | external link
Hi all!Im use Captcha for my form on 1 webserver very ok!. but when i upload into 3 server web (Load blancing). When i type captcha into my form .The system appear : I was type error code (Because the session on 3 webserver is defferrent ). Plase help me : how to use captcha on webserver use load balancing.Thank
Dynamic Select (pull Down Menu)
17/2/2009 | external link
Hi,I found this select tag herehttp://www.w3schools.com/TAGS/tag_Select.aspI need help to be able to generate statement like that in order to be able to put all my folder content in a pulldown menu and links to it.Anyone who can help me please.Thanks
File_get_contents()
17/2/2009 | external link
Is there another way to get the file contends other than file_get_contents?
Php/mysql - Select... Where... In Problem
17/2/2009 | external link
Created a page that lists various entries (doesn't matter what they are) from a database. Each one has unique ID field. Each line has a check box which user can tick and then click the delete button. This takes them to a "confirm deletion" page.The checkboxes are created <input type="checkbox" name="document[]" value="" /> in the usual way.When the confirm deletion page is loaded I do this: $entries = $_POST['document'] which takes all the ticked entries and puts them into the $entries array.Now, I want to build a query which selects the title of each entry to show the user before they delete them. The query is:"SELECT * FROM `documents` WHERE `id` IN ();"but it doesn't work and gives an error about unknown column "array" in where clause. I thought that I could feed $entries straight into the where clause but obviously not. Can anyone tell me what I need to do after $entries = $_POST['document'] to get it to work?Thanks.
Why Doesn't My Thumbnail Gallery Work
17/2/2009 | external link
I am trying to work out why my script does notmake thumbnails automatically please someone help me i am desperate below is my thumbnail script<?php$dir = 'Thumbs';$imgs = array(); echo "<ol>";if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if(($file != '.') && ($file != '..')) { $imgs[] = $file; } } closedir($dh); }}rsort($imgs);foreach($imgs as $img_file){ echo "<img src='Thumbs/$img_file' alt='Click here to view larger image' />";} echo "</ol>"; ?>
Warning: Unknown: Your Script Possibly (continued)... I Don't Unsderstand The Error
17/2/2009 | external link
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0A long, confusing error, and its talking about stuff I have never heard of. I read up, and I think I may have a problem. It seems my host got the latest version of PHP, and now this error pops up. It is probably because of these lines:CODE $conf_password = isset($_POST['conf_password']) ? trim($_POST['conf_password']) : ''; $email = isset($_POST['email']) ? trim($_POST['email']) : ''; $gender = isset($_POST['gender']) ? trim($_POST['gender']) : ''; $birthday = isset($_POST['birthday']) ? trim($_POST['birthday']) : ''; $image = isset($_POST['image']) ? trim($_POST['image']) : ''; $info = isset($_POST['info']) ? trim($_POST['info']) : '';... $_SESSION['email'] = $_POST['email']; $_SESSION['info'] = $_POST['info']; $_SESSION['image'] = $_POST['image']; $_SESSION['gender'] = $_POST['gender']; $_SESSION['birthday'] = $_POST['birthday']; Now the thing is that I don't think that I can set setting session.bug_compat_42 or session.bug_compat_warn to off. My site is hosted on a server, so how can I stop this error from showing? Should I rewrite the script so its like $_SESSION['session_email'] = $_POST['post_email'];? Or is there some variable I can disable?EDIT: the title is kind of long... oops
If..else
17/2/2009 | external link
this code:CODE$user = $_POST['user'];$user2 = "SELECT user FROM konto WHERE user=".$user."";if ($user == $user2){echo "Account name allready exists.<br><br>";}else{echo $user ."<br>";echo $user2 ."<br>";echo "Welcome<br>";echo "You can now log in to your account.<br><br>";}gives me:QUOTE bfbdSELECT user FROM konto WHERE user=bfbdWelcomeYou can now log in to your account.Error: Duplicate entry 'bfbd' for key 2imo it should just say "Account name allready exists." and I cant figure out whats wrong.Could I get some help? =)
Accessing Class Members
17/2/2009 | external link
Hello,I'm starting to use classes, so I've got a lot to learn. One of the questions I have about classes is passingvalues to other functions.Here is how I currently use a class file (psuedo-code):class VariableStorage{ var $foo; var $bar;}function getValues(){ $var = new VariableStorage(); $var->foo = "Hello"; passValues($var);}function passValues($var){$var->bar = "World";output($var);}function output($var){echo $var->foo . " " . $var->bar;}// as you would expect, outputs "Hello World"What I want to do instead is:class VariableStorage{ var $foo; var $bar;}$var = new VariableStorage();function setVar(){ $var->foo = "Hello"; getNext();}function getNext(){ $var->bar = "World"; output();}function output(){ echo $var->foo . " " . $var->bar;}//this doesn't work. But it seems you can't add classes to the global namespace. Is there a better way to do my original example, that provides the flexibility of the second example? Another way to ask this...is there a way to access classes like the way javascript accesses classes?ThanksJames
Update Buttons
17/2/2009 | external link
HelloI have create a form.But for submit button i want to put a button which i have create (with photoshop).How can i change the current button with the button which i have create?And something else.What is the command in which i can see someones ip?
Delete Thumbs Plus Originals
17/2/2009 | external link
I need to be able to delete thumb from gallery but also the original which is in another folder.Here is my code which deletes the thumb but the original is still in "graphics" folder and as the folder contents are displayed it is important that it is also deleted at the same time.<?php$path = dirname(__FILE__) . '/thumbs/';$f = isset($_GET['f']) ? $_GET['f'] : '';if (file_exists($path . $f) && !is_dir($path . $f)){ unlink($path . $f); echo "$f has been deleted";}else echo $path . $f . ' is not a file';?>Thanks in advance for any adviceRobyn
Selecting Certian Fields
17/2/2009 | external link
Hey all, Happy New year. I have a field in my DB that could have a value of 1 - 11 I want to select specific values say 1, 2 and 7 - 11 Here's my query I think should work CODESELECT * FROM `items` WHERE `collection` >= 7 AND `collection` = 1 AND `collection` = 2 Thank you for any help**EDIT**I had this working..CODESELECT * FROM `items` WHERE `collection` BETWEEN 1 AND 3 AND `collection` != 2But add the extra and it does not...CODESELECT * FROM `items` WHERE `collection` BETWEEN 1 AND 3 AND `collection` != 2 AND `collection` >= 7
Drop Boxes, Input To Database?
17/2/2009 | external link
I have a page that is for input drop box, and text boxes...CODE<?phpsession_start();require_once 'db.php';if (isset($_SESSION['user_id'])){$sql = "SELECT * FROM `users` WHERE `name` = ''";$result = mysql_query($sql);while($row = mysql_fetch_array($result)){$name = $row['name'];}?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><script type="text/javascript"> da = [31,28,31,30,31,30,31,31,30,31,30,31]; function set_days () { var d; var date; var opt_str = ""; var m = Months.options[Months.selectedIndex].value; var y = Years.options[Years.selectedIndex].value; if (m != 1) { d = da[m]; } else { date = new Date("February 29, " + y); d = date.getMonth() == 1 ? 29: 28; // IT'S A LEAP YEAR } empty_select (Days); for (var i = 1; i <= d; i++) { j = i.toString(); insertOption (Days, j, j) } } function insertOption (s, t, v) { var y = document.createElement('option'); y.text = t; y.value = v; try { s.add (y, null); // standards compliant } catch (ex) { s.add (y); // IE only } } function empty_select (s) { while (s.length > 0) { s.remove(s.length-1); } } function init () { Months = document.getElementById("months"); Years = document.getElementById("years"); Days = document.getElementById("days"); Months.onchange = set_days; Years.onchange = set_days; } window.onload = init; </script></head> <body> Hello, <?php echo $_SESSION['user_name']; ?>, <?php$sql = "SELECT * FROM `users` WHERE `name` = ''";$result2 = mysql_query($sql);while($row = mysql_fetch_array($result2)){echo $row['webtitle<br>'];echo $row['name<br>'];echo $row['themecontent<br>'];}?> <form action="index.php?page=updateblog" method="post"> <input type="hidden" name="page_mode" value=""> <select id="months"> <option value="0">January</option> <option value="1">February</option> <option value="2">March</option> <option value="3">April</option> <option value="4">May</option> <option value="5">June</option> <option value="6">July</option> <option value="7">August</option> <option value="8">September</option> <option value="9">October</option> <option value="10">November</option> <option value="11">December</option> </select> <select id="days"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select id="years"> <option value="2008">2008</option> <option value="2009">2009</option> </select> <div class="left_box">subcontent</div> <div class="right_box"><input type="text" name="subcontent" size="30" maxlength="255" value=""></div> <div class="left_box">content</div> <div class="right_box"><textarea name='content' rows='15' cols='40'></textarea></div> <div class="left_box"> </div> <div class="right_box"><input type="submit" value="update" size="30"></div> <br><br> <a href="logout.php">Log out</a> <?php } else { ?> Click <a href="register.php">here</a> to register or click <a href="login.php">here</a> to log in. <?php } ?> </body></html>and it will go to updateblog.php to update...CODE<?phprequire_once 'db.php';$sql = "SELECT * FROM `users` WHERE `name` = ''";$result = mysql_query($sql);while($row = mysql_fetch_array($result)){$name = $row['name'];}$date = $_POST['date'];$content = $_POST['content'];$subcontent = $_POST['subcontent'];$days = $_POST['days'];$months = $_POST['months'];$years = $_POST['years'];if (isset($_SESSION['user_id'])){if ($_POST['date'] != ''){mysql_query("INSERT INTO blog (name, date, day, months, years, subcontent, content) VALUES ('$name', '$date', '$days', '$months', '$years', '$subcontent', '$content')");} if ($_POST['days'] == '') { echo "there nothing in day box<br>"; } if ($_POST['months'] == '') { echo "there nothing in month box<br>"; } if ($_POST['years'] == '') { echo "there nothing in year box<br>"; } if ($_POST['subcontent'] == '') { echo "there nothing in subcontent box<br>"; }if ($_POST['content'] == ''){echo "there nothing in content box<br>";}?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><body> <a href="index.php">Update Index</a> <a href="blog.php">Update Blog</a> <a href="logout.php">Log out</a> <?php } else { ?> Click <a href="register.php">here</a> to register or click <a href="login.php">here</a> to log in. <?php } ?>but some how it say there nothing in day boxthere nothing in month boxthere nothing in year boxso $_POST['days']$_POST['months]$_POST['years']have no data, but i did$days = $_POST['days'];$months = $_POST['months'];$years = $_POST['years'];and do that mean drop box don't use $_POST[''] ?
New Lines In Str_replace
17/2/2009 | external link
I'm trying to write a code that takes a txt file and converts it to html whilst retaining formatting. It all works fine except for one little glitch - where there is a double return in the txt file I want to close the html paragraph element and then open a new one (so the paragraph is properly split using the <p></p> tags rather than double <br />'s). For some reason I can't get it to work properly.I've used nl2br() to convert new lines to breaks (<br />). I've then tried using str_replace() to search for instances where there are two <br /> tags immediately after each other, but it doesn't find them. I think the problem relates to the fact that the consecutive tags are on seperate lines, i.e. i'm not look for:<br /><br />I'm looking for:<br /><br />I would have assumed that to find and replace the latter I could use the following code:CODE<?php$string = file_get_contents(filename.txt);$string = nl2br($string);$string = str_replace("<br />\n<br />","</p>\n<p>,$string);?>But this doesn't work. What's really confusing me is that if I try simply searching for and replacing the 2nd of the two <br /> tags it works fine:CODE<?php$string = file_get_contents(filename.txt);$string = nl2br($string);$string = str_replace("\n<br />","</p>\n<p>,$string);?>The inverse is not true (i.e. it finds "\n<br />" but it doesn't find "<br />\n")On the plus side that last version of code very nearly delivers the desired effect, however it means that there is a redundant <br /> tag at the end of each paragraph that I'd quite like to eliminate.Can anyone explain to me why this happens and how to fix it?
Zoom In Function
17/2/2009 | external link
Hi;I'd like to ask some advice what kind of knowledge help me to write function for zoom in by php for photo, for instance,http://www5.mydavinci.com/Pesonalized-Art/...cil-Sketch.html
Session Problem
17/2/2009 | external link
The Session doesn't want to be created.CODE<?phpinclude('config.php'); // Doesn't contain <html> or <body>session_start();$_SESSION['pass']=md5($pass); // $pass is from config.php?>config.phpCODE<?php # Something$username="test";$password="098f6bcd4621d373cade4e832627b4f6";$title="test";$seconds=30;function showfooter(){$display='<div class="ct">Affiliates</div><div class="cc"><marquee direction="left" scrollamount="3" onmouseover="this.stop()" onmouseout="this.start()"><script src="affiliates.js"></script></marquee></div>';$copy=true;$title="test";echo $display;echo '<div style="border-width:1px" class="ca">';if($copy==true){echo 'Powered by <a href="http://a.com">A</a> © 2009';}else{echo $title . " bah bah bah";echo "</div>";if(file_exist("footer.php"))}}?>
Drawing Image On Image
17/2/2009 | external link
Is it Possible to use GD functions to draw an image on top of another in a selected location?-thanks
Unknown Session Issue
17/2/2009 | external link
I have a private section where you need to log in to access any data. There are some general links at top of website, which change depending on if you are logged in or not. Was working well on old host, but not on new one where those links randomly change when I log in. I tested in latest versions of Firefox, Opera, Safari, Chrome and IE on three different PCs, on two different networks with same result. It worked 100% with old host (in all mentioned browser and networks) and I also checked that session is started on top of each page (otherwise it would also not have worked on old host). I run also a dump on session data and it clearly showed on pages where the links suggested I was not logged in although I was that there was no session data. Clicking refresh once or several time would show the correct links which makes me doubt now it is caching related. This does not make any sense to me.Did this happen ever to anyone else and if yes, what would be the solution?Son
Mappath To A Computer To Get File Info
17/2/2009 | external link
I am working with something similar to the following ASP example<html><body><%Set fs = Server.CreateObject("Scripting.FileSystemObject")Set rs = fs.GetFile(Server.MapPath("demo_lastmodified.asp"))modified = rs.DateLastModified%>This file was last modified on: <%response.write(modified)Set rs = NothingSet fs = Nothing%></body></html>What if the MapPath is on a different computer? What I want to do is create a form where a user can type in a network path (\\TestServer\Folder1) and get a list of files in that folder and the last time those files were modified. The problem that I am running into is if some one types in \\TestServer\Folder1 I get an error message saying that hte folder cannot be found. if I type something in like c:\test it works fine.I went into IIS and set the folder that has the asp page to use Integrated Windows authentication. Is the user account information some how not being passed to the computer that I want to get file information from?
Japan Date Using Php
17/2/2009 | external link
Hi I'm wanting to show the date in Japanese in this format: 2008年12月31日(水) which translates to: Wednesday, December 31, 2008I take it I would display the japanese symbols in an array? I have been playing around with this, but it keeps messing up. Can anyone help?This is what I came up with a while ago:CODE$fyr = date("Y");$mn = date("n") + 1;$dt = date("j");$dy = date("w");$dys = array("日","月","火","水","木","金","土");$dyj = $dys[$dy];$roku = ($mn + 5) % 6; //I think this formula works$dt2 = $dt + $roku;$dt2 = $dt2 - 6;while($dt2 > 6) $dt2 = $dt2 - 6;$roku = $dt2;$strroku = array("先勝", "友引", "先負", "仏滅", "大安", "赤口");$strroku = $strroku[$roku - 1]; $roku = round($dt/2);$msg = "$mn 月 $dt 日 ($dyj) $strroku";echo $msg;
Reg Expression Routine, Issue With Dash Character
17/2/2009 | external link
I check some input fields before letting user upload data. Now I found that the dash character prevents user uploading data although I allowed it in my reg expressions. I would appreciate if you had a look at:CODEif (!eregi ('^[[:alnum:]\ \:\-\?\&]$', stripslashes(trim($_POST['heading'])))) { $h = FALSE; $errors['heading'] = '\'Heading\' not in correct format or too long'; } else { $h = escape_data($_POST['heading']); $heading_echo = $h; }I also tried without the dash escaped? Where am I going wrong?Son
Fwrite Problem
17/2/2009 | external link
How do I write this into a file?CODE<?php$file=fopen("config.php","w");$pass=md5($ap);$info="<?phpfunction showfooter(){$copy=true;$title=\"test\";$aq=\\"http:\/\/test\\";if($copy=true){echo \"Powered by <a href=\\"$aq\\">Something</a> - Something 2009\";}else {echo "something here";if(file_exist(\"footer.php\"))}}?>"fwrite($file,$info);$fclose($file);?>(Only a part of the file.)As you can see I need another slash. Two of these: \\. But they cancel themselves out or something that I get Parse error: syntax error, unexpected T_VARIABLE on the line of: $aq=\\"http:\/\/test\\";
Loading A Php Extension
17/2/2009 | external link
Greetings,Is it possible to load a PHP extension at run-time?I would like to load the Alternative PHP Cache:http://pecl.php.net/apcMy web site is hosted with MyHosting, and I'm pretty sure they wouldn't load an extension just for me.Thanks,Shane.
Pagination
17/2/2009 | external link
I just built a pagination script that I wanted to show you guys to see what you think.Now first I want to explain the system. It grabs data from a database, displays it on the page in different divs ("pages") which contain a certain amount depending on the amount chosen by the scriptor. From there, only one div is show at a time by hiding all the rest. The page could get really slow loading times if there's a huge amount of records, so I'm going to build an alternate, but this version works fine right now:CODE<?php/*-----Replace this next line with your own connection script-----*/include('PHP_Files/connect.php');/*-----Number of Entries per Page-----*/$pmax = 3;/*------------------------------------*//*------Determine which page to be shown (Default = 1)------*/$pshown = isset($_GET['page']) ? $_GET['page'] : '1';$query = mysql_query('/*Your Query Here*/');$i = 1;$page = 1;/*------Pages------*/while($row = mysql_fetch_array($query)){ if($i == 1) { echo '<div'; if($page != $pshown) { echo ' style="height: 0px; visibility: hidden; overflow: hidden;"'; } echo '>'; } echo $row['/*Your Column*/']; if($i == $pmax) { echo '</div>'; $i = 0; $page += 1; } $i += 1;}/*----------------------------------------------Make sure the last div is closed by checking the value of $i. If $i is 1, that means that the lastentry fell on the limit and the ending div wasplaced. If not we need to put it.----------------------------------------------*/if($i != 1){ echo '</div>';}/*------Page Links------*/$pnum = mysql_num_rows($query);$pnum /= $pmax;$pnum = ceil($pnum);echo 'Page ';for($i=1; $i<=$pnum; $i++){ echo '<a href="pagination.php?page=' . $i . '">' . $i . '</a> ';}?>Try it out and tell me what you think.
Using Specific Sessions
17/2/2009 | external link
HiI'm having a problem with my sessions. When developing locally, my scripts work fine - but on the server they aren't passing the session data correctly. I'm having to use ini_set to save cookies in a specific directory on the host. When I move to the second script, using a header:Location protocol - it generates a new session that is empty.In a nutshell:CODE//script1.........................ini_set('session.save_path','./session/');session_start();$_SESSION['message'] = 'blah';Then on another pageCODEini_set('session.save_path','./session/');session_start();if (isset($_SESSION['message']){$msg = $_SESSION['message'];echo "$msg";}else{echo "**** GRRRRRRR!!! AAAAAAAGHG!! the sessions still not working....";} I've taken a look at using session_name, but while I can figure out how to derive or retrieve a session_name (or session_id), I can't figure out how to force the second script to access the session I want.
Selecting Where There Are No Links
17/2/2009 | external link
I have 2 tables, like so:id | name1 | daniel2 | mike3 | danand another:id_2 | ref1 | 12 | 1 3 | 3 4 | 1I wish to do an SQL to show what lines of the first table are not referenced in the second table, so this result should show:'mike'
Updating With Nested Select (complex)
17/2/2009 | external link
Hello,I'm not sure how this is done. I want to update a table with values from another record.I tried this code but it doesn't work.CODEupdate task set link_id = (select link_id from task where task_id=1867) where task_id = (select task_id from task where link_id = 1867)basically, my goal is to find tasks which are linked to other tasks via link_id which are going to be deleted.task_id link_id1863 Null1864 18621865 18621866 18651867 18661868 18671869 1866So, I plan to delete task_id 1867 but task_id 1868 is linked to it. So I need to link it to the parent of 1867 which is 1866. Thisway the records (when cascaded on output) will still work. After the update and delete it should look like this...1863 Null1864 18621865 18621866 18651868 18661869 1866Thanks---------------------- Ignore post ------ Solution found ---------------update task as a, task as bset a.link_id = b.link_idwhere b.task_id = a.link_idand a.link_id = 1867This works perfectly.
Counting And Grouping
17/2/2009 | external link
I have a table like so:ID | Ref | ip1 | 6 | 110.10.2.12 | 7 | 112.132.0.13 | 6 | 110.10.2.14 | 8 | 119.10.2.15 | 5 | 110.0.2.16 | 7 | 105.10.1.17 | 6 | 101.10.2.0I wish to do an SQL to get the following result:Ref | Total6 | 37 | 25 | 18 | 1counting the total of each distinct ref. and ordering the resultsI think i need to do an inner join but I don't know how
Accessing Class Arrays Dynamically
17/2/2009 | external link
Hi,I want to access a class array that is called by another function. Here what I'm doing.CODEclass myClass{var $myArray = Array(0=>Array("hello", "world",0),1=>Array("foo", "bar",1),2=>Array("voo", "doo",2));var $myVar = "HELLO WORLD";}function myFunc(){$theClass = new myClass();$i = 1;$test_0 = "myArray[1][0]";$test_1 = "myVar";$test_2 = "myArray[1][$i]";echo $theClass->myArray[0][0];echo $theClass->myArray[0][$i];echo $theClass->myVar;echo $theClass->$test_1;echo $theClass->$test_0;echo $theClass->$test_2;}myFunc();Outputs:helloworldHELLO WORLDHELLO WORLDnothingnothingIs there a way to make this work so that class members can be accessed dynamically?ThanksJames
Gameboyz's Php Queries
17/2/2009 | external link
1) For the printf() statement what's the difference between %d and %u? What does the signed means?
Can I Update View?
17/2/2009 | external link
Hi,I was wondering is it possible to update a view?Thanks.
I Need Webservice Check User From Other Database For Login
17/2/2009 | external link
Hi all!Im using VS 2008 C# . I was make a site E commercer(CC). Now , I have a new site diffrent from other company. My work, I need intergrate 2 site. , Now i need a webservice for check user from that site. If user login from my site . They don't must login on that site.Thank you
How To Read Two Lines Of Text From A Textfile?
17/2/2009 | external link
I have this code:<?php $delim = "\n"; $quotefile = "quotes.txt"; // okay, let's get going. $fp = fopen($quotefile, "r"); $contents = fread($fp, filesize($quotefile)); $quote_arr = explode($delim, $contents); fclose($fp); // initiate randomness srand((double)microtime()*1000000); // generate random quote index $quote_index = (rand(1, sizeof($quote_arr)) - 1); // get quote at $quote_index and return it $herequote = $quote_arr[$quote_index]; echo $herequote; ?> Trying to display this textfile (below) but ONLY the quote and the author (two lines at a time, only one line shows up at the moment, need to modify). I cannot find a sample anywhere when I google it. Been trying to hours. I am thinking I need a for each statement, and maybe split it. But I am really dumb when it comes to figuring that out. Just wondering if someone could point me in the right direction. Thanks.Output should be (example):Humpty Dumpty was pushed.- Unknownquotes.txtHumpty Dumpty was pushed.- UnknownHow come there's only one Monopolies Commission?- Unknown"Television won't matter in your lifetime or mine." - Radio Times editor Rex Lambert, 1936"Everything worthwhile has already been invented." - director of the US Patent Office, 1899. "A computer lets you make more mistakes faster than any invention in human history--with the possible exceptions of handguns and tequila." - Mitch Ratliffe "Cats are smarter than dogs. You can't get eight cats to pull a sled through snow." - Jeff Valdez "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rich Cook "No bastard ever won a war by dying for his country. He won it by making the other poor dumb bastard die for his country." - Gen. George S. Patton "The Swiss have an interesting army. Five hundred years without a war. Pretty impressive. Also pretty lucky for them. Ever see that little Swiss Army knife they have to fight with? Not much of a weapon there. Corkscrews. Bottle openers. 'Come on, buddy, let's go. You get past me, the guy in back of me, he's got a spoon. Back off. I've got the toe clippers right here.'" - Jerry SeinfeldThere is only one difference between a madman and me. I am not mad. - Salvador Dali "Radio has no future." "X-rays are clearly a hoax." "The aeroplane is scientifically impossible." - Royal Society president Lord Kelvin, 1897-9. "The atom bomb will never go off - and I speak as an expert in explosives." - U.S. Admiral William Leahy in 1945. this fortune would be seven words long if it were six words shorter.- Unknown
Datetime
17/2/2009 | external link
Hello, I've been trying to use some date functions and realized that the MySQL database I have been using is not storing dates as a timestamp as I configured, but instead as the DATETIME format, (2009-01-09 15:02:51). This would not bother me but the date() function can only handle timestamps, correct? How do you deal with a DATETIME format as this? Are there a standard set of functions to convert? Thanks, JW
Unlink/delete From Image Gallery Help Please
17/2/2009 | external link
please help me this is what i have so far and my delete button wont work for some reason i must be missing some small piece of information not sure what it is so i will place my code up for all to see and see if one of you can tell me what bit is missing. Thank you in advance for your assisstance </head> <body> <h1 align="center"><span class="style1">DELETE/UNLINK IMAGES </span></h1> <p><a href="#"><br /> </a><a href="#"><br /> </a> <a href="#"><br /> </a><img src="/ICAB5165A_ICAB4220A/Thumbs/Mitch_Maddie08.jpg" alt="No alt defined yet" width="100" height="100" title="Mitch_Maddie08.jpg" /> <input type="submit" name="Submit" value="Delete"> </p> <form name="form2" method="post" action=""> <a href="./Thumbs/willams family crest.gif" ><img src="/ICAB5165A_ICAB4220A/Thumbs/williams%20family%20crest1.gif" alt="No alt defined yet" width="100" height="100" title="williams family crest.gif" /></a> <input type="submit" name="Submit" value="Delete"> </form> <li><form name="form1" method="post" action=""> <a href="./Thumbs/Chloe08.jpg" ><img src="/ICAB5165A_ICAB4220A/Thumbs/Chloe08.jpg" alt="No alt defined yet" width="100" height="100" title="Chloe08.jpg" /></a> <input type="submit" name="Submit" value="delete"> <br /> <a href="./Thumbs/gillis family crest.gif" ><img src="/ICAB5165A_ICAB4220A/Thumbs/gillis%20family%20crest.gif" alt="No alt defined yet" width="100" height="100" title="gillis family crest.gif" /></a> <input type="submit" name="Submit" value="delete"> <br /> <a href="./Thumbs/image010.jpg" ><img src="/ICAB5165A_ICAB4220A/Thumbs/image010.jpg" alt="No alt defined yet" width="100" height="100" title="image010.jpg" /></a> <input type="submit" name="Submit" value="delete"> <br /> </form> </li> <?php $images = "Thumbs/"; $big = "Graphics/"; $colCtr = 0; { echo '<a href="' . $big . $file . '"><img src="' . $images . $file . '" /></a>'; echo $file . ' <a href="Delete-5.php?f=' . urlencode($file) . '"></a></li>';$colCtr++; } ?>
Can I Dynamically Change Background Color With Php?
17/2/2009 | external link
I want the bacground of div class "feedback" to change to red if there is feedback (error). Can anyone tell me how to do it with or inside PHP? I tried embedding the javascript but that doesn't work apparently.If ($_SESSION['feedbackmessage'] != "") div.feedback.background="red";is essentially what I want to accomplish. (with correct syntax of course)Thanks in advance,Jim
Newbie Needs Some More Help :$
17/2/2009 | external link
hey guys thanks for helping me out on my last problem right now i'm strugeling with my navigation page i want it to show other links when role is admin. However it's not working so well i use a : if($SESSION['role']=='admin') statement in my navigation script to define the user that logged in. so now i'm trying to define that $SESSION variable from the page its been send from but i have no idea what to enter so far i have $_SESSION['role']=='';sorry for my probably very annoying question (i'm good at making a mess of my script) but i'm still learning.thanks in advance.
Gd Images - Requesting Page's Url
17/2/2009 | external link
I have an image counter service, and to stop people from stealing users counters(putting the on their pages) I need to check what the requesting pages URL is. So if someones counter is counter.php, and somebody puts this on somepage.html "<img src='counter.php'>", how can I get the value 'somepage.html' to check if it's not some other page like robber.html?Is there any way using PHP to check what page the counter is being requested by?
Newbie Needs Some Help
17/2/2009 | external link
hello people, well like topic title said i'm a not an expert in PHP webscripting. So i've been working on this website with a log in system but it doesn't seem to work can anyone help me point out what's wrong in my script? and where do i destroy the session? do i need to make a log out page or can i just give the session destroy with the link to the homepage?this is my code:<?php include ("connect.php"); $wachtwoord = md5($_POST["wachtwoord"]); $query = "SELECT * from inlog_gegevens; WHERE user = '".$_POST['gebnaam']."' AND password = '".$wachtwoord."'"; $result = "mysql_query($query, $db) or die('the query failed')"; if (mysql_num_rows($result) > 0)any help is very much apreaciated
How To Install Phpmotion Software
17/2/2009 | external link
Hai Can anyone tell how to install PHPmotion V2.1 software. Right now I have PHP Version 5.2.6, Apache/2.2.9 (Win32) and MySQL 5.0 which are all installed on my system. Also the PHPmotion V2.1 software which I downloaded was PHP 5 version only. Please help me. Thanks in advance....R.Sridaran
Need Help On Advance Query Design
17/2/2009 | external link
I am trying to query a transactional historical data having fields - origin, destination, Supplier, rates. Each field have multiple combination with other fields. I want to see the result by origin, by destination, by Supplier, Avg of rates.I can use the group by function for the above query. But on seeing the rates I understood it has lot of wrong data in it. To correct it, I want that Avg should be taken for the 3 rates (with highest frequency) only and discards all zeros if any.Further I want only top 5 records should be displayed for each group of Origin, Destination, Supplier.Please help me in designing this query. I want to run this query on Access 2007
Creating Site
17/2/2009 | external link
hello,is there any software that make manage php site easyly like HTML Webpage Editor ? i want to make simple php website. if any one have any suggestion or free php templates site links so plz help me.thanks
Return To Last Page
17/2/2009 | external link
HiI try another solution to my problem, instead of Link Botton add an ankor with href link , it work at problem page , but there is one page that work only in the main language and I don't want to open a new page just stay in the same page. when I press the link a blank page is opened.The link goto a switch.asp page and there with a case command I can open the correct page in the other language. but I want to say if page > 11 return the last page it was.the href line in the master page:<div align="right" class="headmenuE"><a href="HomePage_en.aspx">Home</a> | <a href="ContactN_en.aspx">Contact Us</a> |<a href="switchpage.aspx?lang=heb">Hebrew-עברית</a> </div>--------------------------------------------------------------------------------------------------------------There is the switch .aspx.cs code:---------------------------------------public partial class switchpage : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { string lang = Request.QueryString["lang"]; Session["lang"] = lang; int pagenum = Convert.ToInt32(Session["page"]); if (pagenum < 11) { switch (pagenum) { case 1: Response.Redirect("HomePage_en.aspx?lang=" + lang); break; case 2: Response.Redirect("AboutUs_en.aspx?lang=" + lang); break; case 3: Response.Redirect("History_en.aspx?lang=" + lang); break; case 4: Response.Redirect("Group_en.aspx?lang=" + lang); break; case 5: Response.Redirect("ServicesN_en.aspx?lang=" + lang); break; case 6: Response.Redirect("Operation_en.aspx?lang=" + lang); break; case 7: Response.Redirect("Industries_" + lang + ".aspx"); break; case 8: Int32 ACT_ID = Convert.ToInt32(Session["activity"]); Response.Redirect("prOductsTabs_" + lang + ".aspx?ActivityID=" + ACT_ID); break; case 9: Response.Redirect("ContactN_" + lang + ".aspx"); break; case 10: Response.Redirect("SearchResultsN_" + lang + ".aspx"); break; default: Response.Redirect("HOMEPAGE_EN.aspx?lang=en"); break; } } }-----------------------------------------------------
Error-there Is No Source Code Available For The Current Location.
17/2/2009 | external link
HiI am using in my site Button Link that trasfer to a switch.apsx page which get a language parameter and load the same page in the language that choose.This line is in the master page:<div align="right" class="headmenuE"><a href="HomePage_en.aspx">Home</a> | <a href="ContactN_en.aspx">Contact Us</a> |<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" OnClick="LinkButton1_Click">Hebrew-עברית</asp:LinkButton> </div> The function in the CS file:protected void LinkButton1_Click(object sender, EventArgs e) { Int32 Page = Convert.ToInt32(Session["page"]); if (Page < 11) Response.Redirect("switchpage.aspx?lang=heb"); }It work Ok in all pages on site except one page that cause the above error. I don't understand why??THE PAGE IS :ASPX FILE NAMED: ProductsTabs_En.aspx:----------------------------------------------------------------------------------------------------------------------------------------------<%@ Page Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" CodeFile="ProductsTabs_En.aspx.cs" Inherits="ProductsTabs_En" Title="Untitled Page" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><div style="width:100%; margin-left:2%;" class="layTextBlock"> <div class="infoPageText" > <!-- Name of Division --> <asp:FormView ID="FormView2" runat="server" DataKeyNames="id" DataSourceID="AccessDataSource3"> <ItemTemplate> <BR /> <asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl='<%# Eval("id", "Industries_en.aspx?industry_id=") %>'> <asp:Label ID="navigation_title_enLabel" runat="server" CssClass="Title" Text='<%# Bind("navigation_title_en") %>'></asp:Label> </asp:HyperLink> </ItemTemplate> </asp:FormView> <BR /> <!-- DataSource for page --> <asp:AccessDataSource ID="AccessDataSource3" runat="server" DataFile="~/App_Data/hbc_new.mdb" SelectCommand="SELECT id, navigation_title_en, url FROM Industries WHERE (id = ?)"> <SelectParameters> <asp:SessionParameter Name="id" SessionField="Industry" Type="Int32" /> </SelectParameters> </asp:AccessDataSource> <!-- Title of Activity + short statement + Sector being shown--> <br /> <DIV> <asp:Panel id="PageContents" runat="server" > <span class="TopPageTitle"><asp:PlaceHolder id="PlaceActivityTitle" runat="server"></asp:PlaceHolder> </span> <br /> <span class="layTextBlock" style="margin-left:2%;"><asp:PlaceHolder id="PlaceTopText" runat="server" ></asp:PlaceHolder> </span> <BR /> <span class="layTextTitle" style="margin-left:5%;"><asp:PlaceHolder id="PlacePortfolioTitle" runat="server" ></asp:PlaceHolder> </span> <!-- tabs for sector + ingredient listing --> <cc1:TabContainer ID="TabContainer1" runat="server" CssClass="ajax__tab_orange-theme " > </cc1:TabContainer> </asp:Panel> </DIV> <br /> Additional applications and materials are also available! Contact us! </div> <!-- Picture of Division being shown --> <BR /> <BR /> <BR /> <BR /> <div class="IndustrypicP" > <asp:FormView ID="FormView3" runat="server" DataKeyNames="id" DataSourceID="AccessDataSource3"> <ItemTemplate> <asp:HyperLink ID="HyperLink5" ToolTip="Return to main Industry" runat="server" NavigateUrl='<%# Eval("id", "Industries_en.aspx?industry_id=") %>'> <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("url", "") %>' /> </asp:HyperLink> <BR /> <BR /> </ItemTemplate> </asp:FormView> </div> </div> </asp:Content>------------------------------------------------------------------------------------------------------------------------cs file:----------------------------------------using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Collections.Generic;using System.Data.Odbc;using System.Data.OleDb;using AjaxControlToolkit;public partial class ProductsTabs_En : System.Web.UI.Page{ protected string subCategoryName; protected string categoryName; protected string activityTitle; protected int industryID; protected int activityID; protected int selectedActivityID; protected int subActivityID; protected string navigationTitle; protected string topText; protected string portfolioTitle; protected void Page_Load(object sender, EventArgs e) { Session["page"] = 8; activityID = Convert.ToInt32(Request.QueryString["ActivityID"]); subActivityID = Convert.ToInt32(Request.QueryString["act_id"]); industryID = GetIndustryID(activityID); Session["Industry"] = industryID; Session["activity"] = activityID; string DataPlace = Server.MapPath("App_Data\\hbc_new.mdb"); string lang = "en"; if (!Page.IsPostBack) { UpdatePannel(); List<Category> categories = Category.GetCategories(activityID, DataPlace, lang); foreach (Category category in categories) { GridView gv = new GridView(); HyperLinkField Hyperlink1 = new HyperLinkField(); gv.AutoGenerateColumns = false; gv.BorderWidth = 0; gv.DataSource = category.Products; //add hyper link field to grid gv.DataKeyNames = new string[] { "productName" }; Hyperlink1.DataNavigateUrlFields = new string[] { "productName" }; if (activityID == 352) { Hyperlink1.DataNavigateUrlFormatString = "documents/.pps"; Hyperlink1.Target = "_blank"; } else { Hyperlink1.DataNavigateUrlFormatString = "contactN_en.aspx?productID=&industry_id=" + industryID + "&activity_id=" + activityID; } Hyperlink1.DataTextField = "productName"; gv.Columns.Add(Hyperlink1); gv.DataBind(); gv.HeaderRow.Visible = false; AjaxControlToolkit.TabPanel tab = new AjaxControlToolkit.TabPanel(); tab.Controls.Add(gv); tab.HeaderText = category.CategoryName; this.Title = this.Title + " " + category.CategoryName; TabContainer1.Tabs.Add(tab); } } TabContainer1.ActiveTabIndex = 0; } protected void UpdatePannel() { string topText; string portfolioTitle; string activityTitle; //connect to database string DataPlace = Server.MapPath("App_Data\\hbc_new.mdb"); string connectionString = ConfigurationSettings.AppSettings["DataConnectionString"]; connectionString = connectionString.Replace("TEMP", DataPlace); OleDbConnection m_connection = new OleDbConnection(connectionString); OleDbCommand cmdTemp = m_connection.CreateCommand(); m_connection.Open(); cmdTemp.CommandText = "SELECT id,navigation_title_en,name_heb,products_title_en, top_text_en, portfolio_title_en, parent_id FROM Activities WHERE id=" + activityID; OleDbDataReader reader = cmdTemp.ExecuteReader(CommandBehavior.SingleRow); reader.Read(); subCategoryName = reader.GetString(1); if (reader.IsDBNull(3)) activityTitle = "Materials for " + subCategoryName; else activityTitle = reader.GetString(3); if (reader.IsDBNull(4)) topText = ""; else topText = reader.GetString(4); if (reader.IsDBNull(5)) portfolioTitle = "Our material portfolio for " + subCategoryName; else portfolioTitle = reader.GetString(5); topText = topText.Replace("Hirshberg Brothers", "<BR/><span class=Hirshberg>Hirshberg Brothers</span>"); topText = topText.Replace("אחים הרשברג", "<span class=Hirshberg>אחים הרשברג</span>"); PlaceActivityTitle.Controls.Add(new LiteralControl(activityTitle)); PlaceTopText.Controls.Add(new LiteralControl(topText)); PlacePortfolioTitle.Controls.Add(new LiteralControl(portfolioTitle)); m_connection.Close(); } protected int GetIndustryID(int pActivityID) { OleDbDataReader reader; OleDbCommand cmdTemp; int nextID, industryID; //connect to database------------------------------------------------------------ string DataPlace = Server.MapPath("App_Data\\hbc_new.mdb"); string connectionString = ConfigurationSettings.AppSettings["DataConnectionString"]; connectionString = connectionString.Replace("TEMP", DataPlace); //---------------------------------------------------------------------------- OleDbConnection m_connection = new OleDbConnection(connectionString); m_connection.Open(); cmdTemp = m_connection.CreateCommand(); cmdTemp.CommandText = "SELECT id, name_en , parent_id FROM Activities WHERE id=" + pActivityID; reader = cmdTemp.ExecuteReader(CommandBehavior.SingleRow); if (reader.Read()) { nextID = industryID = reader.GetInt32(2); //navControl.AddLevel(reader.GetString(1),"#"); while (nextID != 0) { industryID = nextID; reader.Close(); cmdTemp.CommandText = "SELECT id,navigation_title_en, parent_id FROM Activities WHERE id=" + industryID; reader = cmdTemp.ExecuteReader(CommandBehavior.SingleRow); if (reader.Read()) { nextID = reader.GetInt32(2); } else throw new Exception("No activity with id " + industryID + " was found."); } reader.Close(); return industryID; } else throw new Exception("The activity ID wasn't found!"); }}------------------------------------------------------------------------------------------------------------------------
What Is Scripting Mean In Scripting.filesystemobject
17/2/2009 | external link
Hi all,Can you tell my what "Scripting" does in the line below line?set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Password Handling
17/2/2009 | external link
Maybe someone can help me out with a login I would like to add to my site. I am adding a small CMS so the user can upload pictures and change text after logging in to a private admin page. But I'm not exactly sure how to properly authenticate them since SSL is not enabled on the server. It's not really a big deal, I don't think anyone would want to eavesdrop the connection just to mess with a small site, but nevertheless I'd like to offer at least some security. Any thoughts?JW




