cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I'll simplify this down to terms that some people might be able to understand if I'm not mistaken. when you put i++ in to a for loop it will add the value of "i" after the compiler has checked the middle comparison statement but will add 1 to "i" before the compiler proceeds to the bracket. If on the other hand you do ++i it does a similar thing except it adds 1 to i as if though it were the first line of code in the for loop. May not make much of a difference in this circumstance but in other circumstances can make a difference.

For example if you were to print i++ and ++i one would print the value of i then add and the other would add then print the value. Makes a difference.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I may be no expert on the Microsoft sql server but a few things do appear obvious. One is that if you want the version 2008 to read the file then you will need to convert the file to a 2008 file aka the 655 or earlier datatype indicated in the error message. To do so I would emajine you would get both database engines accisible from the same system and retrieve records from one database while inserting into the older version. Note that this will most likely require a script weather it's php or some other language to process the results. But if it's possible to just upgrade the problem program it would probably be easier to do so.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Also I know this isn't important but perhaps you should remove the quotations from the integers/numbers to improve efficency. Comparing two numbers is a lot faster than comparing a number and a string because of the amount of bits stored and the conversion required by php. For example:

<?php
$differenceInSeconds = 448005;
if($differenceInSeconds >= 86400){
    $calcDays = floor($differenceInSeconds / 86400);
    //echo $calcDays;
    if($calcDays === 1){
        $daysPlural = "day";
      //echo   $lastupdate = $calcDays." ".$daysPlural." ago";
    }else{
        $daysPlural = "days";
      //  echo $lastupdate = $calcDays." ".$daysPlural." ago";
    }
   $lastupdate = $calcDays." ".$daysPlural." ago";
}
echo $lastupdate;

And note that the final php deliminator isn't required when dealing with a pure php page and will take off a few milliseconds off the page loading time.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I think the name says it all. When I first saw this topic I thought 5 cents or 5 seconds. Does that reviel anything to you. Means it's worth 5c and get's tossed out in 5s.

Just joking here so don't be offended. But I was confused with the topic name until I opened it. I admit I am a fan of certain features of the iPhone and think every prisoner should have one so the government can keep track of where our prisoners are just like they do with us. Ever seen that news story for the data stored on the current iPhone containing gps data in raw format meaning any app can tell where you've been and what you've been doing. Just seems like a bit of a privacy concern to me.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi and thanks for posting. As per for fetching to appropriate entry within a range I would suggest storing the two numbers on each row in a seperate column which is the type double rather than a string as you have presented.After 4.21 and 5.0 are in two different columns, all you need to do is a sql query like the following:

SELECT * FROM `table` WHERE $value>=`min` AND $value<=`max`

After inserting that query and replacing $value with the intended value you are searching for you should get the resulting row you are looking for.

If there are any other questions just ask.

Thanks

cwarn23

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

@timetraveller92
The mysql service and other parts of the xampp package will not function correctly if it is located in a path with white spaces. So for that reason it must be located in a path without spaces. And even if you weren't to use those modules that malfunction because of the path, in Windows Vista and Windows 7 (but not XP) the "Windows" + "Program Files" + "Users" directories carry special security permissions which also cause xampp to malfunction. For this reason xampp also cannot be placed in those three directories on Windows Vista and Windows 7. It is all in the official documentation and no I can't give you the link (although I would like to) because there is a bit of an disagreement with happygeek if I can provide links.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

found your problem. You have placed xampp inside "Program Files". That is a nono for this program. The manual strictly speaks of saying install xampp at "C:\xampp\". The reason being is that "Program Files" has a space in it and also has special permissions. So perhaps you could cut and paste the xampp directory to C:\xampp\ then after making sure every single file has been cut and pasted, reinstall the services by ticking the tickboxes in the control.exe and single click start to see if it turns green. If it fails then try starting it from the bat file and post here what errors come back.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Then try opening apache_start.bat and see if there are any error messages. If there are then post them here or if there are not then you might want to reinstall xampp. To keep the mysql data you simply copy the directory xampp\mysql

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Did you try and single click on the start button for apache so that it becomes green? Does it stay green? If not then you may need to look both in services and processes for the item named "apache" or possibly "httpd" and end task to it then back in xampp single click the start button.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

No wonder why. You php configuration is limited to 13M of data. Your excel file is probably 5 or 10M. I would link you to some recourses on how to fix it but again happygeek has told me not to do so. So I can only say what the problem is and not give paragraphs of detailed descriptions on things that cause the problem and how to solve it along with side effects on some servers as well as warnings as per usage.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Do you have cookies enabled because having cookies disabled will disable sessions. If you want to know how to use sessions with cookies disabled then click here.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

To solve this problem simply delete the session_register() function wherever you have used it and also at the top of each page (on line 1) place the following.

<?php session_start();

That should solve it.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

You don't need regex. There is another function called ltrim(). Use the following.

<?php
$input='--_some_String_123';
$input=ltrim($input,'-_');
echo $input;
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Do you mean like the following:

<?php
$error='';
if (isset($_POST) && !empty($_POST)) {
if ($_POST['name']=='') {
$error = 'Name cannot be empty.<br />';
}
if ($error=='') {
//insert into mysql
}
}
?>
<form method="POST" action="">
<?php echo $error; ?>
<input type="text" name="name" />
<input type="submit" value="Send" />
</form>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

@cwarn ....Yep it's Solved for now

Then can you please click the solved link at the bottom of the page near the reply box. Thank you. :)

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

So answer is yes, are we solved? :)

Good one. Are we solved yet? Are we solved yet?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

didn't see appache process in task manager..

It should be under services in the task manager

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Thanks for your reply
Somehow I do not agree with you since php is supporting the other languages like Farsi and I can easily populate all Farsi(Persian) alphabetical characters in PHP.The only problem is working with numbers!

If you like I shall give you a little history lesson that explains it. It all started in the late 1970's when scientists were finding a way to display characters on a monitor (strings) for command line operating systems like Unix and dos. Back then all they had were binary codes that represented the flow of electrons going along the circuits. But the only problem with that was they couldn't do it or at least easily unless they placed a set of transistors in a specific order generating the electrons. So the scientists had to tackle the bigger problem first before they could get to displaying characters. This is when software was invented. To invent software what scientists would have to do is assign numbers to binary codes. For example 0=0 1=1 2=10 3=11 4=100 5=101 6=110 7=111 and so on to represent the electrons in the circuit. The scientists then tout the computer how to do mathematics with the numbers/integers allowing for graphical interfaces and 3d games to be possible later on. After mathematics had been invented on a binary level, characters were invented the same way except characters were and still are today just meaningless symbols assigned to a binary code. These symbols at first went from 0 to 127 …

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

PHP can only read its native language.

<?php

$numberArray = array();

for ($i = 1‎; $i < 31; $i++)
{
  $numberArray[] = $i;
 } 
  for ($i = 0; $i < sizeof($numberArray); $i++) {
         echo $numberArray[$i]."<br />";
	}
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Looks like you need to mark the thread solved

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Actually configuring Wamp is as breeze as right clicking the tray icon and behold all configs are there :)

I find from past experiences Wamp is a devel to configure especially to enable modules such as mssql. It is better to deal with xampp. I would suggest doing Ctrl+alt+del and end task to apache then try to enable it again but once again only single click. And as I said, I strongly recommend not to use wamp as it will cause you problems for enabling modules down the track.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

you meant xampp-control.exe in step 2?

yes indeed. They call it different names in different versions.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have had this problem many times and there is a very simple solution. Do the following.
1. Open C:\xampp\apache_stop.bat file
2. Open C:\xampp\control.exe
3. Single click Start Apache and wait 30 seconds before moving the mouse or clicking anything else otherwise you will need to repeat the above three steps.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I didn't exactly get what the question was but if you are asking what questions to use in this project then I would say something like "Who was the primary contributor to the regex module" and that would test them real hard. If however you want easier questions then you could say "What is the difference between print and echo" and have 4 possible answers.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Then I conclude that your users are double posting via redirect (design flaw). This will probably be my last post unless there is a reply in the next 12 hours as I will be away from keyboard for 4 days (due to medical reasons) and hopefully will be back better than before. Try the following. I had this problem half a decade ago until I solved it and due to a habit never had it again.

<?php
//Define Parameters
$DBhost = "localhost";
$DBuser = "bdna";
$DBpass="2010";
$DBname="bdna";
$table="trails";

//connect to DB
$con = mysql_connect($DBhost,$DBuser,$DBpass);
if(!$con) { die('Could not connect to database: ' . mysql_error()); }

//Select Database
mysql_select_db("$DBname") or die("Unable to select database $DBname");
if (isset($_POST) && !empty($_POST)) {
foreach ($_POST AS $key=>$value) {
if (!is_array($value)) {
    $_POST[$key]=mysql_real_escape_string($value);
    }
}
//Insert Data Into MYSQL
$sql="INSERT INTO $table (id, Name, Address, Suburb, Postcode, HomePhone, Mobile, DateofBirth, AgeNextYear, VNA, Email, ParentMobile, Club, AgeGroup, Position1, Position2) VALUES(' ','{$_POST['Name']}','{$_POST['Address']}','{$_POST['Suburb']}','{$_POST['Postcode']}','{$_POST['Phone']}','{$_POST['Mobile']}','{$_POST['dobd']}/{$_POST['dobm']}/{$_POST['doby']}','{$_POST['nextage']}','{$_POST['VNA']}','{$_POST['email']}','{$_POST['parentM']}','{$_POST['Club']}','{$_POST['age']}','{$_POST['pref1']}','{$_POST['pref2']}')";

//Executes
if(!mysql_query($sql))
{
	die('Error: ' . mysql_error());
}
//Close Connection
mysql_close($con)
}
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
<?php
//Define Parameters
$DBhost = "localhost";
$DBuser = "bdna";
$DBpass="2010";
$DBname="bdna";
$table="trails";

//connect to DB
$con = mysql_connect($DBhost,$DBuser,$DBpass);
if(!$con) { die('Could not connect to database: ' . mysql_error()); }

//Select Database
mysql_select_db("$DBname") or die("Unable to select database $DBname");
foreach ($_POST AS $key=>$value) {
if (!is_array($value)) {
    $_POST[$key]=mysql_real_escape_string($value);
    }
}
//Insert Data Into MYSQL
$sql="INSERT INTO $table (id, Name, Address, Suburb, Postcode, HomePhone, Mobile, DateofBirth, AgeNextYear, VNA, Email, ParentMobile, Club, AgeGroup, Position1, Position2) VALUES(' ','{$_POST['Name']}','{$_POST['Address']}','{$_POST['Suburb']}','{$_POST['Postcode']}','{$_POST['Phone']}','{$_POST['Mobile']}','{$_POST['dobd']}/{$_POST['dobm']}/{$_POST['doby']}','{$_POST['nextage']}','{$_POST['VNA']}','{$_POST['email']}','{$_POST['parentM']}','{$_POST['Club']}','{$_POST['age']}','{$_POST['pref1']}','{$_POST['pref2']}')";

//Executes
if(!mysql_query($sql))
{
	die('Error: ' . mysql_error());
}
//Close Connection
mysql_close($con)
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi and let me be the first to say you should really use the mysql_real_escape_string() on all of the variables you are putting into the $sql variable. Also as per removing blank values all I can suggest is an if statement on the individual $_POST variables before you make the sql query. For example you could check if $_POST is empty and if it is then assign a value to it. Hope that helps :)

cwarn23 387 Occupation: Genius Team Colleague Featured Poster
$name=mysql_real_escape_string($_GET['name']);
$r=mysql_query('SELECT * FROM `table` WHERE `column1`="'.$name'" OR  `column2`="'.$name'" OR  `column3`="'.$name'" OR  `column4`="'.$name'" OR  `column5`="'.$name'" OR  `column6`="'.$name'" OR  `column7`="'.$name'" OR  `column8`="'.$name'" OR  `column9`="'.$name'" OR  `column10`="'.$name'" OR  `column11`="'.$name'" OR  `column12`="'.$name'" OR  `column13`="'.$name'" OR  `column14`="'.$name'" OR  `column15`="'.$name'"') or die(mysql_error());

if (mysql_num_rows($r)>0) {
//it exists
$row=mysql_fetch_assoc($r);
echo '<xmp>'; print_r($row); echo '</xmp>';
} else {
echo 'No results found.';
}
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

There looks to be a lot of repetition going on here:

mysql_query("SELECT * FROM user WHERE (username = '" . mysql_real_escape_string($_POST['username']) . "') and (password = '" . mysql_real_escape_string(md5($_POST['password'])) . "') and admin = ...");

You seem to be checking the same data 3 times. Why not just extract the admin value for an user and use that set a session and to relocate?

Indeed. It would be better remove admin from the sql and use $row=mysql_fetch_assoc($result); and check what $row equals but it's 10:30PM and I haven't had enough caffeine today so I'm really tired and am about to go to bed. But I shall leave the following code before I close my eyes not that I can't program with my eyes closed.

<?php session_start();
 
include('config.inc');

$result=mysql_query("SELECT * FROM user WHERE username = '" . mysql_real_escape_string($_POST['username']) . "' and password = '" . mysql_real_escape_string(md5($_POST['password'])) . "'");

$row=mysql_fetch_assoc($result);

if ($row['admin']==9) {
$_SESSION['username'] = $_POST['username'];
header("Location: main.php?admin=1"); 
    exit;
    } elseif ($row['admin']==1) {
    $_SESSION['username'] = $_POST['username'];
    header("Location: main.php");
    exit;
    } elseif ($row['admin']==0) {
    header("Location: index.php?error=3");
    exit;
    }

header("Location: index.php?error=1");
exit;
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
<?php


session_start();


include('config.inc');
        
$isAdmin = mysql_query("SELECT * FROM user WHERE (username = '" . mysql_real_escape_string($_POST['username']) . "') and (password = '" . mysql_real_escape_string(md5($_POST['password'])) . "') and admin = '9'");
if(mysql_num_rows($result) == 1) {
$_SESSION['username'] = $_POST['username'];
header("Location: main.php?admin=1"); 
    exit;
    }
$result = mysql_query("SELECT * FROM user WHERE (username = '" . mysql_real_escape_string($_POST['username']) . "') and (password = '" . mysql_real_escape_string(md5($_POST['password'])) . "') and admin = '1'");
    if(mysql_num_rows($result) == 1) {
	$_SESSION['username'] = $_POST['username'];
	header("Location: main.php");
    exit;
    }
$result = mysql_query("SELECT * FROM user WHERE (username = '" . mysql_real_escape_string($_POST['username']) . "') and (password = '" . mysql_real_escape_string(md5($_POST['password'])) . "') and admin = '0'");
if(mysql_num_rows($result) == 1) {
    header("Location: index.php?error=3");
    exit;
	}

header("Location: index.php?error=1");
exit;

?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Your program is not related to del command, but permissions. Windows 7 doesn't all you to delete files from c:\windows and c:\Program Files folders for security reasons. That doesn't make del a deprecated command.

Working with a folder that you have created yourself and have permissions, to delete all the files in that folder and all sub-folders del /S /Q *.* Now if you want to also remove all the folders rmdir /Q /S <parent folder name> To get online help with these commands del /?

Thankyou. I shall make another youtube clip that features these commands. I wonder what the following will do?

C:> del /S /Q *.*

Or if that won't work is there a way to force windows core files to be deleted to mess up the system?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

>>I wonder what version of Windows Microsoft depreciated del *.* from the terminal.

What makes you think it was depreciated? That command is still alive and well in Windows 7.

Well when I loaded Windows 7 into my virtual box and performed del *.* on drive C and various other directories it did not delete a single file. Whenever I used wild cards it would not delete. And in some cases it came up with a permission denied error in the terminal even for the program files directory. So from my tests which you can see in the youtube link at my previous posts that it is impossible to delete all your files using that one simple command in windows 7 as wild cards simply just don't work on the del command. Try it yourself by installing a program you don't like and load up the terminal and perform the following:
Lets say the program installed at C:\Program Files\Astro32

C:> cd Program Files
C:\Program Files> cd Astro32
c:\Program Files\Astro32>del *.*

You will most likely come across permission denied errors or it may say their successfully deleted when in actuality the files haven't been touched at all. This is because in windows 7 the Program Files directory has special permissions and same with the Windows directory and Users directory. So try it yourself and you will see what I mean.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If you really want to get revenge without risking your job, then scrap his PERSONAL computer, not his work comp.
EDIT: Woops, i guess i should read the entire thread, or atleast the posting date of the original post before posting a comment.

I guess you should have read the fine print.;)
I wonder what version of Windows Microsoft depreciated del *.* from the terminal. In any case I shall let this thread rest in piece until somebody new answers my question which is not meant to be answered ;)

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

The books I would recommend would be "PHP5 and MySQL Bible" (about 4cm thick book). Also "Extending and Embedding PHP" if you want to make php extensions. Also if you want to learn php-gtk then you might want to consider "Pro PHP-GTK". Note that php-gtk is not used in web development but rather desktop application development as php has a module called the gtk module which gives php a interface so you can make desktop programs using php code instead of just web pages.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

thanks sir it works...but why? can you explain sir?

Well basically when checking for the value of a variable (in this case checking in the if statement) you first must check if it's defined unless you know it's defined. So in this instance the variable $_SESSION was never given a value so it triggered an error. However when the if (isset($_SESSION) was put before it, php check if the variable had a value then php found out that no it didn't so false the if statment and didn't pass on any error messages.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try replacing line 17 with the following if statement:

if(isset($_SESSION['uid']) && $_SESSION['uid']){
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the following:

<form method="post" action="Search.php">
            <table id="search">
                <tr>
                    <td>
                        Search:  <input type="text" name="search" id="search" placeholder="Search for friends"/><td><input type="image" src="graphics/search.png" id="submit"/></td>
                    </td>
                </tr>
            <table>
        </form>

That is how you have a submit button which is an image button.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Do you mean like the following?

<?php
session_start();
for($i=5;$i<=6;$i++)
{
$_SESSION['y']=$i;
$string = '<?php
$x='.$_SESSION['y'].';
echo $x;?> ';
$fp = fopen("$i.php", "w");
fwrite($fp, $string);
fclose($fp);
}
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the following:

<?php
$x=5;
session_start();
echo $x;
$_SESSION['y']=$x;

$string = '<?php 
session_start(); 
$x=$_SESSION[\'y\'];
echo $x;?> ';
$fp = fopen("6.php", "w");
fwrite($fp, $string);
fclose($fp);
?>
aaloo commented: he really undrestood my problem very fast +0
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the following:

if(mysql_num_rows($result)>0){
    $user = mysql_fetch_assoc($result);
    echo '<h1>Welcome, ';
    echo $user['Name'];
    echo '</h1>';  
}else{
    header("location:login.html?msg=$msg");
}

And on login.html you will need to place the javascript message instead of the page with the header redirect.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the following:

<?php if(!defined('CORE')) exit(0); function jspack(&$s){	$s = preg_replace(array('/\r\n/s','/\n/s'),'',$s); } ?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I think what he is saying is you should start off with the basics before going to the advanced. It's obvious your not ready for arrays yet nor are you ready for variable definitions yet. I would strongly suggest following the tizag tutorials and after you have completed them then you will soon realize really quickly what you have done wrong as this is the very basics of PHP.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

because to separate the code/syntax from the string you are inputing you need to surround your text with a quote on each side. However with numbers, this is not the case since mysql knows how to detect numbers from the syntax. So whenever inputting strings, you must surround with quotes to ensure that mysql or even in any language like in php for assigning variables because when it comes to computers, computers aren't smart at recognizing code.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

There is the php library for sockets which is used to give the user the ability to communicate over the socket protocol just like how the curl library gives users the ability to communicate over the curl protocol. It is widely used as an alternative to curl because it works more efficiently due to not being so dependent of apache there by lowering cpu and memory consumption. But when using sockets they can be hard to handle and the protocol can be hard to setup so that's why I prefer curl.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Replace line 117 with the following:

$sqlstr = "INSERT INTO static_page(judul, isi_berita)VALUES('".$judul."','".$news."')";
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Use the following:

<?php
$timestamp='1318245850';
if (mktime(0,0,0)<$timestamp) {
echo $timestamp.' is today.';
} else {
echo $timestamp.' is not today.';
}
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Sounds like in Realtek hd audio manager you need to adjust the volume control to turn off mute and increase the volume. Also a hidden volume button on the keyboard can also do it.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have made a youtube clip just for this thread for what happens when you perform del *.* on drive C: and many other directories too in Windows 7. The link is below :)
http://www.youtube.com/watch?v=LW2z5YKhL2Q

cwarn23 387 Occupation: Genius Team Colleague Featured Poster
<?php
include('variables.php');
die('Steve Jobs');
sleep($tenyears);
die('Bill Gates');
exit;
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
<?php for($i=0;$i<8;$i++) include ("files/file".$i.".php"); ?>